Subject: Re: bug#25741: [PATCH 2/2] gnu: kbd: Add neo layout.

From: ng0 <[email-masked]>
Date: Thu, 27 Apr 2017 21:53:37 +0000

Alright, here is the reworked version.

Because it is equal to the result of the previous one, I am
positive that it works like this (the previous version did).
-- 
PGP and more: https://people.pragmatique.xyz/ng0/
From 0377688c2db24ca87979f362433434bafd737040 Mon Sep 17 00:00:00 2001
From: ng0 <[email-masked]>
Date: Sun, 1 Jan 2017 16:36:27 +0000
Subject: [PATCH] gnu: kbd: Add neo layout.

* 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 | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 0b299f9e5..b2a552718 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -1674,6 +1674,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"))
@@ -1691,12 +1697,33 @@ 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"))
+                    (neo-keymaps (string-append out "/share/keymaps/i386/neo")))
+               (mkdir-p neo-keymaps)
+               (install-file neo neo-keymaps)
+               ;; Rename the file as it includes a hash in the filename.
+               (for-each (lambda (file)
+                           (rename-file file (string-append neo-keymaps "/neo.map")))
+                         (find-files (string-append out "/share/keymaps")
+                                      "neo\\.map$"))
+               #t))))))
     (inputs `(("check" ,check)
               ("gzip" ,gzip)
               ("bzip2" ,bzip2)
               ("pam" ,linux-pam)))
-    (native-inputs `(("pkg-config" ,pkg-config)))
+    (native-inputs `(("pkg-config" ,pkg-config)
+                     ("kbd-neo"
+                      ,(origin
+                         (method url-fetch)
+                         (uri (string-append "https://svn.neo-layout.org/!svn/bc/"
+                                             "2476/linux/console/neo.map"))
+                         (sha256
+                          (base32
+                           "19mfrd31vzpsjiwc7pshxm0b0sz5dd17xrz6k079cy4im1vf0r4g"))))))
     (home-page "ftp://ftp.kernel.org/pub/linux/utils/kbd/")
     (synopsis "Linux keyboard utilities and keyboard maps")
     (description
-- 
2.12.2