janneke pushed a commit to branch wip-bootstrap in repository guix. commit 0c8833c16f59ac689d1fc59cd95b0e4cf8f9ccd5 Author: Jan Nieuwenhuizen <jann...@gnu.org> Date: Sun Sep 9 11:54:27 2018 +0200
bootstrap: %bootstrap-inputs: Prepare for Mes bootstrap. * gnu/packages/bootstrap.scm (%bootstrap-inputs): Change to procedure. Update users. * gnu/packages/commencement.scm (%boot0-inputs, %boot1-inputs, %boot2-inputs, %boot3-inputs, %boot4-inputs, %boot5-inputs, %boot-6-inputs): Change to procedure. Update users. --- gnu/packages/bootstrap.scm | 2 +- gnu/packages/commencement.scm | 115 +++++++++++++++++++++--------------------- guix/scripts/pack.scm | 6 +-- tests/builders.scm | 6 +-- 4 files changed, 65 insertions(+), 64 deletions(-) diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm index 936d6c1..fb6e8db 100644 --- a/gnu/packages/bootstrap.scm +++ b/gnu/packages/bootstrap.scm @@ -586,7 +586,7 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \ (home-page #f) (license gpl3+))) -(define %bootstrap-inputs +(define (%bootstrap-inputs) ;; The initial, pre-built inputs. From now on, we can start building our ;; own packages. `(("libc" ,%bootstrap-glibc) diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index 30a0ffc..1207796 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2014, 2015, 2017 Mark H Weaver <m...@netris.org> ;;; Copyright © 2017, 2018 Efraim Flashner <efr...@flashner.co.il> ;;; Copyright © 2018 Tobias Geerinckx-Rice <m...@tobias.gr> +;;; Copyright © 2018 janneke <jann...@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -100,13 +101,13 @@ (install-file "make" bin) #t)))))))) (native-inputs '()) ; no need for 'pkg-config' - (inputs %bootstrap-inputs)))) + (inputs (%bootstrap-inputs))))) (define diffutils-boot0 (package-with-bootstrap-guile (let ((p (package-with-explicit-inputs diffutils `(("make" ,gnu-make-boot0) - ,@%bootstrap-inputs) + ,@(%bootstrap-inputs)) #:guile %bootstrap-guile))) (package (inherit p) (name "diffutils-boot0") @@ -120,7 +121,7 @@ (name "findutils-boot0")) `(("make" ,gnu-make-boot0) ("diffutils" ,diffutils-boot0) ; for tests - ,@%bootstrap-inputs) + ,@(%bootstrap-inputs)) (current-source-location) #:guile %bootstrap-guile))) @@ -130,17 +131,17 @@ (inherit file) (name "file-boot0")) `(("make" ,gnu-make-boot0) - ,@%bootstrap-inputs) + ,@(%bootstrap-inputs)) (current-source-location) #:guile %bootstrap-guile))) -(define %boot0-inputs +(define (%boot0-inputs) `(("make" ,gnu-make-boot0) ("diffutils" ,diffutils-boot0) ("findutils" ,findutils-boot0) ("file" ,file-boot0) - ,@%bootstrap-inputs)) + ,@(%bootstrap-inputs))) (define* (boot-triplet #:optional (system (%current-system))) ;; Return the triplet used to create the cross toolchain needed in the @@ -149,7 +150,7 @@ ;; Following Linux From Scratch, build a cross-toolchain in stage 0. That ;; toolchain actually targets the same OS and arch, but it has the advantage -;; of being independent of the libc and tools in %BOOTSTRAP-INPUTS, since +;; of being independent of the libc and tools in (%BOOTSTRAP-INPUTS), since ;; GCC-BOOT0 (below) is built without any reference to the target libc. (define binutils-boot0 @@ -184,7 +185,7 @@ ((#:configure-flags cf) `(cons ,(string-append "--target=" (boot-triplet)) ,cf))))) - (inputs %boot0-inputs)))) + (inputs (%boot0-inputs))))) (define libstdc++-boot0 ;; GCC's libcc1 is always built as a shared library (the top-level @@ -203,7 +204,7 @@ #:validate-runpath? #f ,@(package-arguments lib))) - (inputs %boot0-inputs) + (inputs (%boot0-inputs)) (native-inputs '())))) (define gcc-boot0 @@ -294,8 +295,8 @@ ;; Call it differently so that the builder can check whether ;; the "libc" input is #f. - ("libc-native" ,@(assoc-ref %boot0-inputs "libc")) - ,@(alist-delete "libc" %boot0-inputs))) + ("libc-native" ,@(assoc-ref (%boot0-inputs) "libc")) + ,@(alist-delete "libc" (%boot0-inputs)))) ;; No need for the native-inputs to build the documentation at this stage. (native-inputs `())))) @@ -325,7 +326,7 @@ `(delete "-Dusethreads" ,configure-flags)))))))) (package-with-bootstrap-guile (package-with-explicit-inputs perl - %boot0-inputs + (%boot0-inputs) (current-source-location) #:guile %bootstrap-guile)))) @@ -334,7 +335,7 @@ ;; It is also needed to rebuild Bash's parser, which is modified by ;; its CVE patches. Remove it when it's no longer needed. (let* ((m4 (package-with-bootstrap-guile - (package-with-explicit-inputs m4 %boot0-inputs + (package-with-explicit-inputs m4 (%boot0-inputs) (current-source-location) #:guile %bootstrap-guile))) (bison (package (inherit bison) @@ -350,7 +351,7 @@ "V=1")))))) (package (inherit (package-with-bootstrap-guile - (package-with-explicit-inputs bison %boot0-inputs + (package-with-explicit-inputs bison (%boot0-inputs) (current-source-location) #:guile %bootstrap-guile))) (native-inputs `(("perl" ,perl-boot0)))))) @@ -363,7 +364,7 @@ (inputs `(("indent" ,indent))) (arguments '(#:tests? #f))))) (package-with-bootstrap-guile - (package-with-explicit-inputs flex %boot0-inputs + (package-with-explicit-inputs flex (%boot0-inputs) (current-source-location) #:guile %bootstrap-guile)))) @@ -381,12 +382,12 @@ ,@(package-arguments linux-libre-headers))) (native-inputs `(("perl" ,perl-boot0) - ,@%boot0-inputs)))))) + ,@(%boot0-inputs))))))) (define gnumach-headers-boot0 (package-with-bootstrap-guile (package-with-explicit-inputs gnumach-headers - %boot0-inputs + (%boot0-inputs) (current-source-location) #:guile %bootstrap-guile))) @@ -400,7 +401,7 @@ `(,(string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %build-inputs "flex") "/lib/"))))))) (package-with-bootstrap-guile - (package-with-explicit-inputs mig %boot0-inputs + (package-with-explicit-inputs mig (%boot0-inputs) (current-source-location) #:guile %bootstrap-guile)))) @@ -409,7 +410,7 @@ (native-inputs `(("mig" ,mig-boot0))) (inputs '())))) (package-with-bootstrap-guile - (package-with-explicit-inputs hurd-headers %boot0-inputs + (package-with-explicit-inputs hurd-headers (%boot0-inputs) (current-source-location) #:guile %bootstrap-guile)))) @@ -418,7 +419,7 @@ (native-inputs `(("mig" ,mig-boot0))) (inputs '())))) (package-with-bootstrap-guile - (package-with-explicit-inputs hurd-minimal %boot0-inputs + (package-with-explicit-inputs hurd-minimal (%boot0-inputs) (current-source-location) #:guile %bootstrap-guile)))) @@ -434,7 +435,7 @@ the bootstrap environment." `(("gnumach-headers" ,gnumach-headers-boot0) ("hurd-headers" ,hurd-headers-boot0) ("hurd-minimal" ,hurd-minimal-boot0) - ,@%boot0-inputs)))))) + ,@(%boot0-inputs))))))) (define* (kernel-headers-boot0 #:optional (system (%current-system))) (match system @@ -445,7 +446,7 @@ the bootstrap environment." ;; Texinfo used to build libc's manual. ;; We build without ncurses because it fails to build at this stage, and ;; because we don't need the stand-alone Info reader. - ;; Also, use %BOOT0-INPUTS to avoid building Perl once more. + ;; Also, use (%BOOT0-INPUTS) to avoid building Perl once more. (let ((texinfo (package (inherit texinfo) (native-inputs '()) (inputs `(("perl" ,perl-boot0))) @@ -455,7 +456,7 @@ the bootstrap environment." ;; UTF-8 locale at this stage, so skip them. (arguments '(#:tests? #f))))) (package-with-bootstrap-guile - (package-with-explicit-inputs texinfo %boot0-inputs + (package-with-explicit-inputs texinfo (%boot0-inputs) (current-source-location) #:guile %bootstrap-guile)))) @@ -466,14 +467,14 @@ the bootstrap environment." #:target boot-triplet #:binutils binutils-boot0 #:guile %bootstrap-guile - #:bash (car (assoc-ref %boot0-inputs "bash")))) + #:bash (car (assoc-ref (%boot0-inputs) "bash")))) -(define %boot1-inputs +(define (%boot1-inputs) ;; 2nd stage inputs. `(("gcc" ,gcc-boot0) ("ld-wrapper-cross" ,ld-wrapper-boot0) ("binutils-cross" ,binutils-boot0) - ,@(alist-delete "binutils" %boot0-inputs))) + ,@(alist-delete "binutils" (%boot0-inputs)))) (define glibc-final-with-bootstrap-bash ;; The final libc, "cross-built". If everything went well, the resulting @@ -529,7 +530,7 @@ the bootstrap environment." (inputs `(;; The boot inputs. That includes the bootstrap libc. We don't want ;; it in $CPATH, hence the 'pre-configure' phase above. - ,@%boot1-inputs + ,@(%boot1-inputs) ;; A native MiG is needed to build Glibc on Hurd. ,@(if (hurd-triplet? (%current-system)) @@ -537,11 +538,11 @@ the bootstrap environment." '()) ;; A native GCC is needed to build `cross-rpcgen'. - ("native-gcc" ,@(assoc-ref %boot0-inputs "gcc")) + ("native-gcc" ,@(assoc-ref (%boot0-inputs) "gcc")) ;; Here, we use the bootstrap Bash, which is not satisfactory ;; because we don't want to depend on bootstrap tools. - ("static-bash" ,@(assoc-ref %boot0-inputs "bash"))))))) + ("static-bash" ,@(assoc-ref (%boot0-inputs) "bash"))))))) (define (cross-gcc-wrapper gcc binutils glibc bash) "Return a wrapper for the pseudo-cross toolchain GCC/BINUTILS/GLIBC @@ -600,7 +601,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" ;; A statically-linked Bash to be used by GLIBC-FINAL in system(3) & co. (let* ((gcc (cross-gcc-wrapper gcc-boot0 binutils-boot0 glibc-final-with-bootstrap-bash - (car (assoc-ref %boot1-inputs "bash")))) + (car (assoc-ref (%boot1-inputs) "bash")))) (bash (package (inherit static-bash) (arguments @@ -619,7 +620,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" (inputs `(("gcc" ,gcc) ("libc" ,glibc-final-with-bootstrap-bash) ("libc:static" ,glibc-final-with-bootstrap-bash "static") - ,@(fold alist-delete %boot1-inputs + ,@(fold alist-delete (%boot1-inputs) '("gcc" "libc"))))) (package-with-bootstrap-guile (package-with-explicit-inputs bash inputs @@ -657,7 +658,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" (delete 'patch-tests)))))))) (package-with-bootstrap-guile (package-with-explicit-inputs gettext-minimal - %boot1-inputs + (%boot1-inputs) (current-source-location) #:guile %bootstrap-guile)))) @@ -694,14 +695,14 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the ;; non-cross names. (cross-gcc-wrapper gcc-boot0 binutils-boot0 glibc-final - (car (assoc-ref %boot1-inputs "bash")))) + (car (assoc-ref (%boot1-inputs) "bash")))) -(define %boot2-inputs +(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")))) + ,@(fold alist-delete (%boot1-inputs) '("libc" "gcc")))) (define binutils-final (package-with-bootstrap-guile @@ -711,7 +712,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" #:implicit-inputs? #f #:allowed-references ("out" ,glibc-final) ,@(package-arguments binutils))) - (inputs %boot2-inputs)))) + (inputs (%boot2-inputs))))) (define libstdc++ ;; Intermediate libstdc++ that will allow us to build the final GCC @@ -737,7 +738,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" (assoc-ref %outputs "out") "/include")))) (outputs '("out")) - (inputs %boot2-inputs) + (inputs (%boot2-inputs)) (synopsis "GNU C++ standard library (intermediate)")))) (define zlib-final @@ -750,14 +751,14 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" #:implicit-inputs? #f #:allowed-references ("out" ,glibc-final) ,@(package-arguments zlib))) - (inputs %boot2-inputs)))) + (inputs (%boot2-inputs))))) (define ld-wrapper-boot3 ;; A linker wrapper that uses the bootstrap Guile. (make-ld-wrapper "ld-wrapper-boot3" #:binutils binutils-final #:guile %bootstrap-guile - #:bash (car (assoc-ref %boot2-inputs "bash")))) + #:bash (car (assoc-ref (%boot2-inputs) "bash")))) (define gcc-final ;; The final GCC. @@ -822,13 +823,13 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" ("binutils" ,binutils-final) ("libstdc++" ,libstdc++) ("zlib" ,zlib-final) - ,@%boot2-inputs)))) + ,@(%boot2-inputs))))) -(define %boot3-inputs +(define (%boot3-inputs) ;; 4th stage inputs. `(("gcc" ,gcc-final) ("ld-wrapper" ,ld-wrapper-boot3) - ,@(alist-delete "gcc" %boot2-inputs))) + ,@(alist-delete "gcc" (%boot2-inputs)))) (define bash-final ;; Link with `-static-libgcc' to make sure we don't retain a reference @@ -838,25 +839,25 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" (inherit bash-minimal) (arguments `(#:disallowed-references - ,(assoc-ref %boot3-inputs "coreutils&co") + ,(assoc-ref (%boot3-inputs) "coreutils&co") ,@(package-arguments bash-minimal)))))) (package-with-bootstrap-guile (package-with-explicit-inputs (static-libgcc-package bash) - %boot3-inputs + (%boot3-inputs) (current-source-location) #:guile %bootstrap-guile)))) -(define %boot4-inputs +(define (%boot4-inputs) ;; Now use the final Bash. `(("bash" ,bash-final) - ,@(alist-delete "bash" %boot3-inputs))) + ,@(alist-delete "bash" (%boot3-inputs)))) (define-public guile-final ;; This package must be public because other modules refer to it. However, ;; mark it as hidden so that 'fold-packages' ignores it. (package-with-bootstrap-guile (package-with-explicit-inputs (hidden-package guile-2.2/fixed) - %boot4-inputs + (%boot4-inputs) (current-source-location) #:guile %bootstrap-guile))) @@ -870,7 +871,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" (inherit glibc-utf8-locales) (inputs `(("glibc" ,glibc-final) ("gzip" - ,(package-with-explicit-inputs gzip %boot4-inputs + ,(package-with-explicit-inputs gzip (%boot4-inputs) (current-source-location) #:guile %bootstrap-guile)))))) @@ -881,19 +882,19 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" #:guile guile-final #:bash bash-final)) -(define %boot5-inputs +(define (%boot5-inputs) ;; Now with UTF-8 locales. Remember that the bootstrap binaries were built ;; with an older libc, which cannot load the new locale format. See ;; <https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00737.html>. `(("locales" ,glibc-utf8-locales-final) - ,@%boot4-inputs)) + ,@(%boot4-inputs))) (define gnu-make-final ;; The final GNU Make, which uses the final Guile. (package-with-bootstrap-guile (package-with-explicit-inputs gnu-make `(("guile" ,guile-final) - ,@%boot5-inputs) + ,@(%boot5-inputs)) (current-source-location)))) (define coreutils-final @@ -901,7 +902,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" ;; Findutils, keep a reference to the Coreutils they were built with. (package-with-bootstrap-guile (package-with-explicit-inputs coreutils - %boot5-inputs + (%boot5-inputs) (current-source-location) ;; Use the final Guile, linked against the @@ -914,23 +915,23 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" ;; The final grep. Gzip holds a reference to it (via zgrep), so it must be ;; built before gzip. (let ((grep (package-with-bootstrap-guile - (package-with-explicit-inputs grep %boot5-inputs + (package-with-explicit-inputs grep (%boot5-inputs) (current-source-location) #:guile guile-final)))) (package/inherit grep (inputs (alist-delete "pcre" (package-inputs grep))) (native-inputs `(("perl" ,perl-boot0)))))) -(define %boot6-inputs +(define (%boot6-inputs) ;; Now use the final Coreutils. `(("coreutils" ,coreutils-final) ("grep" ,grep-final) - ,@%boot5-inputs)) + ,@(%boot5-inputs))) (define sed-final ;; The final sed. (let ((sed (package-with-bootstrap-guile - (package-with-explicit-inputs sed %boot6-inputs + (package-with-explicit-inputs sed (%boot6-inputs) (current-source-location) #:guile guile-final)))) (package/inherit sed (native-inputs `(("perl" ,perl-boot0)))))) @@ -941,7 +942,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" ;; used for origins that have patches, thereby avoiding circular ;; dependencies. (let ((finalize (compose package-with-bootstrap-guile - (cut package-with-explicit-inputs <> %boot6-inputs + (cut package-with-explicit-inputs <> (%boot6-inputs) (current-source-location))))) `(,@(map (match-lambda ((name package) diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index 1916f3b..28462d9 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -388,9 +388,9 @@ the image." "Return the C compiler that uses the bootstrap toolchain. This is used only by '--bootstrap', for testing purposes." (define bootstrap-toolchain - (list (first (assoc-ref %bootstrap-inputs "gcc")) - (first (assoc-ref %bootstrap-inputs "binutils")) - (first (assoc-ref %bootstrap-inputs "libc")))) + (list (first (assoc-ref (%bootstrap-inputs) "gcc")) + (first (assoc-ref (%bootstrap-inputs) "binutils")) + (first (assoc-ref (%bootstrap-inputs) "libc")))) (c-compiler bootstrap-toolchain #:guile %bootstrap-guile)) diff --git a/tests/builders.scm b/tests/builders.scm index 8b8ef01..634c331 100644 --- a/tests/builders.scm +++ b/tests/builders.scm @@ -39,7 +39,7 @@ (define %store (open-connection-for-tests)) -(define %bootstrap-inputs +(define (%bootstrap-inputs) ;; Use the bootstrap inputs so it doesn't take ages to run these tests. ;; This still involves building Make, Diffutils, and Findutils. ;; XXX: We're relying on the higher-level `package-derivations' here. @@ -47,14 +47,14 @@ (map (match-lambda ((name package) (list name (package-derivation %store package)))) - (@@ (gnu packages commencement) %boot0-inputs)))) + (@@ (gnu packages commencement) (%boot0-inputs))))) (define %bootstrap-search-paths ;; Search path specifications that go with %BOOTSTRAP-INPUTS. (append-map (match-lambda ((name package _ ...) (package-native-search-paths package))) - (@@ (gnu packages commencement) %boot0-inputs))) + (@@ (gnu packages commencement) (%boot0-inputs)))) (define url-fetch* (store-lower url-fetch))