janneke pushed a commit to branch wip-bootstrap in repository guix. commit 2855fdee15d52c679b866206791757fa52cfac1d Author: Jan Nieuwenhuizen <jann...@gnu.org> Date: Tue Sep 4 06:32:31 2018 +0200
build: make %boot*-inputs a procedure. This fixes creating the graph for x86 on x86_64, doing ./pre-inst-env guix graph --type=bag -e '(begin (use-modules (guix packages)) (%current-system "i686-linux") (@@ (gnu packages commencement) gnu-make-boot0))' > make-boot0.dot * gnu/packages/bootstrap.scm (%bootstrap-inputs): Make procedure. Update users. * gnu/packages/commencement.scm (%boot0-inputs): Likewise. (%boot1-inputs): Likewise. (%boot2-inputs): Likewise. (%boot3-inputs): Likewise. (%boot4-inputs): Likewise. (%boot5-inputs): Likewise. (%boot6-inputs): Likewise. * tests/builders.scm (%bootstrap-inputs): Likewise. * guix/scripts/pack.scm (bootstrap-c-compiler): Update users. * gnu/packages/mes.scm (stage0-boot): Update users. --- gnu/packages/bootstrap.scm | 2 +- gnu/packages/commencement.scm | 106 +++++++++++++++++++++--------------------- gnu/packages/mes.scm | 2 +- guix/scripts/pack.scm | 6 +-- tests/builders.scm | 6 +-- 5 files changed, 61 insertions(+), 61 deletions(-) diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm index 01300eb..b0740c0 100644 --- a/gnu/packages/bootstrap.scm +++ b/gnu/packages/bootstrap.scm @@ -695,7 +695,7 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \ (base32 "0rnkppwdkxbzkgp9s9ccmby9f7p3ijxjlmvj0pzqxwmrmpy7jwmb")))) -(define %bootstrap-inputs +(define (%bootstrap-inputs) ;; The initial, pre-built inputs. From now on, we can start building our ;; own packages. `(,@(match (%current-system) diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index d9b7c78..10e4030 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -1472,7 +1472,7 @@ exec " gcc "/bin/" program ("binutils" ,binutils-mesboot) ("gcc" ,gcc-mesboot-wrapper))) (_ '())) - %bootstrap-inputs)) + (%bootstrap-inputs))) (define gnu-make-boot0 (package-with-bootstrap-guile @@ -1552,7 +1552,7 @@ exec " gcc "/bin/" program ,@(package-arguments p))))))) -(define %boot0-inputs +(define (%boot0-inputs) `(("make" ,gnu-make-boot0) ("diffutils" ,diffutils-boot0) ("findutils" ,findutils-boot0) @@ -1566,7 +1566,7 @@ exec " gcc "/bin/" program ;; 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 @@ -1601,7 +1601,7 @@ exec " gcc "/bin/" program ((#: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 @@ -1620,7 +1620,7 @@ exec " gcc "/bin/" program #:validate-runpath? #f ,@(package-arguments lib))) - (inputs %boot0-inputs) + (inputs (%boot0-inputs)) (native-inputs '())))) (define gcc-boot0 @@ -1711,8 +1711,8 @@ exec " gcc "/bin/" program ;; 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 `())))) @@ -1742,7 +1742,7 @@ exec " gcc "/bin/" program `(delete "-Dusethreads" ,configure-flags)))))))) (package-with-bootstrap-guile (package-with-explicit-inputs perl - %boot0-inputs + (%boot0-inputs) (current-source-location) #:guile %bootstrap-guile)))) @@ -1751,7 +1751,7 @@ exec " gcc "/bin/" program ;; 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) @@ -1767,7 +1767,7 @@ exec " gcc "/bin/" program "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)))))) @@ -1780,7 +1780,7 @@ exec " gcc "/bin/" program (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)))) @@ -1798,12 +1798,12 @@ exec " gcc "/bin/" program ,@(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))) @@ -1817,7 +1817,7 @@ exec " gcc "/bin/" program `(,(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)))) @@ -1826,7 +1826,7 @@ exec " gcc "/bin/" program (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)))) @@ -1835,7 +1835,7 @@ exec " gcc "/bin/" program (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)))) @@ -1851,7 +1851,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 @@ -1862,7 +1862,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))) @@ -1872,7 +1872,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)))) @@ -1883,14 +1883,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 @@ -1946,7 +1946,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)) @@ -1954,11 +1954,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 @@ -2017,7 +2017,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 @@ -2036,7 +2036,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 @@ -2074,7 +2074,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)))) @@ -2111,14 +2111,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 @@ -2128,7 +2128,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 @@ -2154,7 +2154,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 @@ -2167,14 +2167,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. @@ -2239,13 +2239,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 @@ -2255,25 +2255,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))) @@ -2287,7 +2287,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)))))) @@ -2298,19 +2298,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 @@ -2318,7 +2318,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 @@ -2331,23 +2331,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)))))) @@ -2358,7 +2358,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/gnu/packages/mes.scm b/gnu/packages/mes.scm index e691ed4..5c8e26e 100644 --- a/gnu/packages/mes.scm +++ b/gnu/packages/mes.scm @@ -59,7 +59,7 @@ (base32 "0svmdz4ayv1lcqm49n4wn6wcfa7msvrjqg2h50hpx1kywg0rwqdr")))) (native-inputs - `(("static-bash" ,@(assoc-ref (@ (gnu packages bootstrap) %bootstrap-inputs) "bash")) + `(("static-bash" ,@(assoc-ref ((@ (gnu packages bootstrap) %bootstrap-inputs)) "bash")) ("bash" ,(search-bootstrap-binary "bash" (%current-system))) ("tar" ,(search-bootstrap-binary "tar" (%current-system))) ("xz" ,(search-bootstrap-binary "xz" (%current-system))) diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index 7298508..fe998e6 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -416,9 +416,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 bb9e0fa..d5c3d1b 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))