Subject: [PATCH 2/2] gnu: kbd: Add neo layout.

From: [email-masked]
Date: Wed, 15 Feb 2017 16:48:00 +0000

From: ng0 <[email-masked]>

* gnu/packages/linux.scm (kbd): Add neo layout.
[arguments]: Add new 'install-neo-layout' and 'add-neo-directory' phases.
[native-inputs]: Add 'kbd-neo'.
---
 gnu/packages/linux.scm | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 65221579b..45314eeb0 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -1658,6 +1658,12 @@ system.")
     (arguments
      '(#:phases
        (modify-phases %standard-phases
+         (add-before 'configure 'add-neo-directory
+           (lambda _
+             (substitute* "data/Makefile.am"
+               (("mac/all")
+                "mac/all i386/neo"))
+             #t))
          (add-before 'build 'pre-build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((gzip  (assoc-ref %build-inputs "gzip"))
@@ -1675,12 +1681,21 @@ system.")
                (for-each (lambda (prog)
                            (wrap-program (string-append bin "/" prog)
                              `("PATH" ":" prefix (,bin))))
-                         '("unicode_start" "unicode_stop"))))))))
+                         '("unicode_start" "unicode_stop")))))
+         (add-before 'install 'install-neo-layout
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((neo (assoc-ref %build-inputs "kbd-neo"))
+                    (out (assoc-ref outputs "out"))
+                    (neomap (string-append neo "/share/keymaps/i386/neo/neo.map"))
+                    (keymaps (string-append out "/share/keymaps/i386/neo")))
+               (mkdir-p keymaps)
+               (install-file neomap keymaps)))))))
     (inputs `(("check" ,check)
               ("gzip" ,gzip)
               ("bzip2" ,bzip2)
               ("pam" ,linux-pam)))
-    (native-inputs `(("pkg-config" ,pkg-config)))
+    (native-inputs `(("pkg-config" ,pkg-config)
+                     ("kbd-neo" ,kbd-neo)))
     (home-page "ftp://ftp.kernel.org/pub/linux/utils/kbd/")
     (synopsis "Linux keyboard utilities and keyboard maps")
     (description
-- 
2.11.1