summary refs log tree commit diff
path: root/gnu/packages/commencement.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-09-03 14:25:39 +0200
committerLudovic Courtès <ludo@gnu.org>2017-09-05 10:18:39 +0200
commit6dff905e51202bbdebbad8811b6509584d12a796 (patch)
tree860cd300b5f48616061817f73b157ea60ca1536f /gnu/packages/commencement.scm
parent48623f5be854e923b04ae83a1a882ff1cefdc742 (diff)
downloadguix-6dff905e51202bbdebbad8811b6509584d12a796.tar.gz
gnu: glibc: Add "static" output.
This shrinks glibc:out from 37 MiB to 29 MiB.

* gnu/packages/base.scm (glibc/linux)[outputs]: Add "static".
[arguments]: Add #:modules.  Add 'move-static-libs' phase.
* gnu/packages/commencement.scm (static-bash-for-glibc): Augment
 #:configure-flags to pass "-L LIBC:STATIC".  Add the "static" output of
GLIBC-FINAL to 'inputs'.
(%boot2-inputs, %final-inputs): Likewise.
(canonical-package): Adjust to deal with multiple-output packages.
* gnu/packages/cross-base.scm (cross-gcc): Add the "static" output of
LIBC to 'native-inputs'.
Diffstat (limited to 'gnu/packages/commencement.scm')
-rw-r--r--gnu/packages/commencement.scm22
1 files changed, 18 insertions, 4 deletions
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 2b67881ede..318a2795b1 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -583,12 +583,24 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
   (let* ((gcc  (cross-gcc-wrapper gcc-boot0 binutils-boot0
                                   glibc-final-with-bootstrap-bash
                                   (car (assoc-ref %boot1-inputs "bash"))))
-         (bash (package (inherit static-bash)
+         (bash (package
+                 (inherit static-bash)
                  (arguments
-                  `(#:guile ,%bootstrap-guile
-                    ,@(package-arguments static-bash)))))
+                  (substitute-keyword-arguments
+                      (package-arguments static-bash)
+                    ((#:guile _ #f)
+                     '%bootstrap-guile)
+                    ((#:configure-flags flags '())
+                     ;; Add a '-L' flag so that the pseudo-cross-ld of
+                     ;; BINUTILS-BOOT0 can find libc.a.
+                     `(append ,flags
+                              (list (string-append "LDFLAGS=-static -L"
+                                                   (assoc-ref %build-inputs
+                                                              "libc:static")
+                                                   "/lib"))))))))
          (inputs `(("gcc" ,gcc)
                    ("libc" ,glibc-final-with-bootstrap-bash)
+                   ("libc:static" ,glibc-final-with-bootstrap-bash "static")
                    ,@(fold alist-delete %boot1-inputs
                            '("gcc" "libc")))))
     (package-with-bootstrap-guile
@@ -663,6 +675,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
 (define %boot2-inputs
   ;; 3rd stage inputs.
   `(("libc" ,glibc-final)
+    ("libc:static" ,glibc-final "static")
     ("gcc" ,gcc-boot0-wrapped)
     ,@(fold alist-delete %boot1-inputs '("libc" "gcc"))))
 
@@ -923,12 +936,13 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
       ("binutils" ,binutils-final)
       ("gcc" ,gcc-final)
       ("libc" ,glibc-final)
+      ("libc:static" ,glibc-final "static")
       ("locales" ,glibc-utf8-locales-final))))
 
 (define-public canonical-package
   (let ((name->package (fold (lambda (input result)
                                (match input
-                                 ((_ package)
+                                 ((_ package . outputs)
                                   (vhash-cons (package-full-name package)
                                               package result))))
                              vlist-null