[bug#34929,10/12] gnu: Add loadkeys-static.

Message ID 20190320230435.25458-10-ludo@gnu.org
State Accepted
Commit 48e595b7a8f8f83ba00386e4dccf1ef809474226
Headers show
Series None | expand

Checks

Context Check Description
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied

Commit Message

Ludovic Courtès March 20, 2019, 11:04 p.m. UTC
* gnu/packages/linux.scm (loadkeys-static): New variable.
---
 gnu/packages/linux.scm | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

Patch

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index e9d8ea45c1..de1a9ba24e 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -1995,6 +1995,43 @@  for systems using the Linux kernel.  This includes commands such as
 'loadkeys', 'setfont', 'kbdinfo', and 'chvt'.")
     (license license:gpl2+)))
 
+(define-public loadkeys-static
+  (package
+    (inherit kbd)
+    (name "loadkeys-static")
+    (arguments
+     (substitute-keyword-arguments (package-arguments kbd)
+       ((#:configure-flags flags ''())
+        `(append '("LDFLAGS=-static" "--disable-shared" "--disable-nls"
+                   "--disable-vlock"              ;so we don't need libpam
+                   "--disable-libkeymap")
+                 ,flags))
+       ((#:make-flags flags ''())
+        `(cons "LDFLAGS=-all-static" ,flags))
+       ((#:phases phases '%standard-phases)
+        `(modify-phases ,phases
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out")))
+                 ;; The binary keeps references to gzip, among other things,
+                 ;; which we don't need in the initrd, so strip references.
+                 (remove-store-references "src/loadkeys")
+
+                 (install-file "src/loadkeys"
+                               (string-append out "/bin"))
+                 #t)))
+           (delete 'post-install)))
+       ((#:strip-flags _ '())
+        ''("--strip-all"))
+       ((#:allowed-references _ '())
+        '())))
+
+    (synopsis "Statically-linked @command{loadkeys} program")
+
+    ;; This package is meant to be used internally in the initrd so don't
+    ;; expose it.
+    (properties '((hidden? . #t)))))
+
 (define-public inotify-tools
   (package
     (name "inotify-tools")