gnu: Add 'bash-static'.
authorLudovic Courtès <ludo@gnu.org>
Wed, 19 Aug 2015 12:40:59 +0000 (14:40 +0200)
committerLudovic Courtès <ludo@gnu.org>
Fri, 28 Aug 2015 23:25:07 +0000 (01:25 +0200)
* gnu/packages/bash.scm (static-bash): New variable.

gnu/packages/bash.scm

index 6b2d0b8..fcfa337 100644 (file)
@@ -239,6 +239,28 @@ without modification.")
                        '("bash_cv_job_control_missing=no")
                        '()))))))))
 
+(define-public static-bash
+  ;; Statically-linked Bash that contains nothing but the 'bash' binary and
+  ;; 'sh' symlink, without any reference.
+  (let ((bash (static-package bash-light)))
+    (package
+      (inherit bash)
+      (name "bash-static")
+      (arguments
+       (substitute-keyword-arguments
+           `(#:allowed-references ("out") ,@(package-arguments bash))
+         ((#:phases phases)
+          `(alist-cons-after
+            'strip 'remove-everything-but-the-binary
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (bin (string-append out "/bin")))
+                (remove-store-references (string-append bin "/bash"))
+                (delete-file (string-append bin "/bashbug"))
+                (delete-file-recursively (string-append out "/share"))
+                #t))
+            ,phases)))))))
+
 (define-public bash-completion
   (package
     (name "bash-completion")