summary refs log tree commit diff
path: root/gnu/packages/make-bootstrap.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/make-bootstrap.scm')
-rw-r--r--gnu/packages/make-bootstrap.scm165
1 files changed, 85 insertions, 80 deletions
diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index 99488fb4c4..a57491aeb4 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -1,6 +1,8 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -143,24 +145,24 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                  (arguments
                   (substitute-keyword-arguments (package-arguments bzip2)
                     ((#:phases phases)
-                     `(alist-cons-before
-                       'build 'dash-static
-                       (lambda _
-                         (substitute* "Makefile"
-                           (("^LDFLAGS[[:blank:]]*=.*$")
-                            "LDFLAGS = -static")))
-                       ,phases))))))
+                     `(modify-phases ,phases
+                        (add-before 'build 'dash-static
+                          (lambda _
+                            (substitute* "Makefile"
+                              (("^LDFLAGS[[:blank:]]*=.*$")
+                               "LDFLAGS = -static"))
+                            #t))))))))
         (xz (package (inherit xz)
               (arguments
                `(#:strip-flags '("--strip-all")
-                 #:phases (alist-cons-before
-                           'configure 'static-executable
-                           (lambda _
-                             ;; Ask Libtool for a static executable.
-                             (substitute* "src/xz/Makefile.in"
-                               (("^xz_LDADD =")
-                                "xz_LDADD = -all-static")))
-                           %standard-phases)))))
+                 #:phases (modify-phases %standard-phases
+                            (add-before 'configure 'static-executable
+                              (lambda _
+                                ;; Ask Libtool for a static executable.
+                                (substitute* "src/xz/Makefile.in"
+                                  (("^xz_LDADD =")
+                                   "xz_LDADD = -all-static"))
+                                #t)))))))
         (gawk (package (inherit gawk)
                 (source (origin (inherit (package-source gawk))
                           (patches (cons (search-patch "gawk-shell.patch")
@@ -175,14 +177,14 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
 
                    ,@(substitute-keyword-arguments (package-arguments gawk)
                        ((#:phases phases)
-                        `(alist-cons-before
-                          'configure 'no-export-dynamic
-                          (lambda _
-                            ;; Since we use `-static', remove
-                            ;; `-export-dynamic'.
-                            (substitute* "configure"
-                              (("-Wl,-export-dynamic") "")))
-                          ,phases)))))
+                        `(modify-phases ,phases
+                           (add-before 'configure 'no-export-dynamic
+                             (lambda _
+                               ;; Since we use `-static', remove
+                               ;; `-export-dynamic'.
+                               (substitute* "configure"
+                                 (("-Wl,-export-dynamic") ""))
+                               #t)))))))
                 (inputs (if (%current-target-system)
                             `(("bash" ,static-bash))
                             '()))))
@@ -306,19 +308,19 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                                   ((#:configure-flags flags _ ...)
                                    flags)))
        #:strip-flags '("--strip-all")
-       #:phases (alist-cons-before
-                 'configure 'all-static
-                 (lambda _
-                   ;; The `-all-static' libtool flag can only be passed
-                   ;; after `configure', since configure tests don't use
-                   ;; libtool, and only for executables built with libtool.
-                   (substitute* '("binutils/Makefile.in"
-                                  "gas/Makefile.in"
-                                  "ld/Makefile.in")
-                     (("^LDFLAGS =(.*)$" line)
-                      (string-append line
-                                     "\nAM_LDFLAGS = -static -all-static\n"))))
-                 %standard-phases)))))
+       #:phases (modify-phases %standard-phases
+                  (add-before 'configure 'all-static
+                    (lambda _
+                      ;; The `-all-static' libtool flag can only be passed
+                      ;; after `configure', since configure tests don't use
+                      ;; libtool, and only for executables built with libtool.
+                      (substitute* '("binutils/Makefile.in"
+                                     "gas/Makefile.in"
+                                     "ld/Makefile.in")
+                        (("^LDFLAGS =(.*)$" line)
+                         (string-append line
+                                        "\nAM_LDFLAGS = -static -all-static\n")))
+                      #t)))))))
 
 (define %binutils-static-stripped
   ;; The subset of Binutils that we need.
@@ -424,18 +426,18 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                       (remove (cut string-match "--(.*plugin|enable-languages)" <>)
                               ,flags)))
             ((#:phases phases)
-             `(alist-cons-after
-               'pre-configure 'remove-lgcc_s
-               (lambda _
-                 ;; Remove the '-lgcc_s' added to GNU_USER_TARGET_LIB_SPEC in
-                 ;; the 'pre-configure phase of our main gcc package, because
-                 ;; that shared library is not present in this static gcc.  See
-                 ;; <https://lists.gnu.org/archive/html/guix-devel/2015-01/msg00008.html>.
-                 (substitute* (cons "gcc/config/rs6000/sysv4.h"
-                                    (find-files "gcc/config"
-                                                "^gnu-user.*\\.h$"))
-                   ((" -lgcc_s}}") "}}")))
-               ,phases)))))
+             `(modify-phases ,phases
+                (add-after 'pre-configure 'remove-lgcc_s
+                  (lambda _
+                    ;; Remove the '-lgcc_s' added to GNU_USER_TARGET_LIB_SPEC in
+                    ;; the 'pre-configure phase of our main gcc package, because
+                    ;; that shared library is not present in this static gcc.  See
+                    ;; <https://lists.gnu.org/archive/html/guix-devel/2015-01/msg00008.html>.
+                    (substitute* (cons "gcc/config/rs6000/sysv4.h"
+                                       (find-files "gcc/config"
+                                                   "^gnu-user.*\\.h$"))
+                      ((" -lgcc_s}}") "}}"))
+                    #t)))))))
      (native-inputs
       (if (%current-target-system)
           `(;; When doing a Canadian cross, we need GMP/MPFR/MPC both
@@ -493,12 +495,14 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                              (string-append includedir "/c++"))
 
            ;; For native builds, check whether the binaries actually work.
-           ,(if (%current-target-system)
-                '#t
-                '(every (lambda (prog)
-                          (zero? (system* (string-append gcc "/bin/" prog)
-                                          "--version")))
-                        '("gcc" "g++" "cpp")))))))
+           ,@(if (%current-target-system)
+                 '()
+                 '((for-each (lambda (prog)
+                               (invoke (string-append gcc "/bin/" prog)
+                                       "--version"))
+                             '("gcc" "g++" "cpp"))))
+
+           #t))))
     (inputs `(("gcc" ,%gcc-static)))))
 
 (define %guile-static
@@ -586,21 +590,22 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
            (mkdir (string-append out "/bin"))
            (copy-file guile1 guile2)
 
-           ;; Does the relocated Guile work?
-           (and ,(if (%current-target-system)
-                     #t
-                     '(zero? (system* guile2 "--version")))
-                (begin
-                  ;; Strip store references.
-                  (remove-store-references guile2)
-
-                  ;; Does the stripped Guile work?  If it aborts, it could be
-                  ;; that it tries to open iconv descriptors and fails because
-                  ;; libc's iconv data isn't available (see
-                  ;; `guile-default-utf8.patch'.)
-                  ,(if (%current-target-system)
-                       #t
-                       '(zero? (system* guile2 "--version")))))))))
+           ;; Verify that the relocated Guile works.
+           ,@(if (%current-target-system)
+                 '()
+                 '((invoke guile2 "--version")))
+
+           ;; Strip store references.
+           (remove-store-references guile2)
+
+           ;; Verify that the stripped Guile works.  If it aborts, it could be
+           ;; that it tries to open iconv descriptors and fails because libc's
+           ;; iconv data isn't available (see `guile-default-utf8.patch'.)
+           ,@(if (%current-target-system)
+                 '()
+                 '((invoke guile2 "--version")))
+
+           #t))))
     (inputs `(("guile" ,%guile-static)))
     (outputs '("out"))
     (synopsis "Minimal statically-linked and relocatable Guile")))
@@ -627,17 +632,17 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
              (mkdir out)
              (set-path-environment-variable "PATH" '("bin") (list tar xz))
              (with-directory-excursion input
-               (zero? (system* "tar" "cJvf"
-                               (string-append out "/"
-                                              ,name "-" ,version
-                                              "-"
-                                              ,(or (%current-target-system)
-                                                   (%current-system))
-                                              ".tar.xz")
-                               "."
-                               ;; avoid non-determinism in the archive
-                               "--sort=name" "--mtime=@0"
-                               "--owner=root:0" "--group=root:0"))))))))))
+               (invoke "tar" "cJvf"
+                       (string-append out "/"
+                                      ,name "-" ,version
+                                      "-"
+                                      ,(or (%current-target-system)
+                                           (%current-system))
+                                      ".tar.xz")
+                       "."
+                       ;; avoid non-determinism in the archive
+                       "--sort=name" "--mtime=@0"
+                       "--owner=root:0" "--group=root:0")))))))))
 
 (define %bootstrap-binaries-tarball
   ;; A tarball with the statically-linked bootstrap binaries.