summary refs log tree commit diff
path: root/gnu/packages/linux.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-03-20 12:17:14 +0100
committerLudovic Courtès <ludo@gnu.org>2019-03-24 23:06:12 +0100
commit48e595b7a8f8f83ba00386e4dccf1ef809474226 (patch)
treeea309797521088abc250ead6103ec6c3c3f685cf /gnu/packages/linux.scm
parent132823c2acd34f46d6df89ce3635db62643a09c8 (diff)
downloadguix-48e595b7a8f8f83ba00386e4dccf1ef809474226.tar.gz
gnu: Add loadkeys-static.
* gnu/packages/linux.scm (loadkeys-static): New variable.
Diffstat (limited to 'gnu/packages/linux.scm')
-rw-r--r--gnu/packages/linux.scm37
1 files changed, 37 insertions, 0 deletions
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index bc2219b1fa..d52e12f9cd 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -1999,6 +1999,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")