me
/
guix
Archived
1
0
Fork 0

gnu: commencement: Reduce the graph of package objects.

The graph returned by:

  guix graph -e '(@@ (gnu packages commencement) guile-final)'

now contains 94 nodes (664 edges) instead of 394 (2674 edges).

Likewise, this command:

  GUIX_PROFILING=add-data-to-store-cache guix build coreutils -nd

shows that the number of lookups to the 'add-data-to-store' caches goes
from 8935 to 5303.

Overall, "guix build libreoffice -nd" goes from 3.17s to 2.60s (-18%).

* gnu/packages/commencement.scm (diffutils-boot0): Remove call to
'package-with-bootstrap-guile' and 'package-with-explicit-inputs', and
adjust accordingly.
(findutils-boot0, file-boot0, binutils-boot0, libstdc++-boot0)
(gcc-boot0, perl-boot0, m4-boot0, bison-boot0, flex-boot0)
(linux-libre-headers-boot0, texinfo-boot0, python-boot0)
(ld-wrapper-boot0, glibc-final-with-bootstrap-bash)
(static-bash-for-glibc, gettext-boot0, glibc-final, binutils-final)
(libstdc++, zlib-final, bash-final): Likewise.
(expat-sans-tests)[inputs]: New field.
[arguments]: Add #:implicit-inputs? and #:guile.
(m4-boot0*): New variable.
master
Ludovic Courtès 2019-10-12 11:35:43 +02:00
parent 9a45a24f7f
commit 99b73d0f0c
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 496 additions and 478 deletions

View File

@ -1425,43 +1425,46 @@ exec " gcc "/bin/" program
(inputs (%bootstrap-inputs+toolchain))))
(define diffutils-boot0
(package-with-bootstrap-guile
(let ((p (package-with-explicit-inputs diffutils
(lambda _
`(("make" ,gnu-make-boot0)
,@(%bootstrap-inputs+toolchain)))
#:guile %bootstrap-guile)))
(package (inherit p)
(package
(inherit diffutils)
(name "diffutils-boot0")
(native-inputs `())
(arguments `(#:tests? #f ; the test suite needs diffutils
,@(package-arguments p)))))))
(inputs
`(("make" ,gnu-make-boot0)
,@(%bootstrap-inputs+toolchain)))
(arguments
`(#:tests? #f ; the test suite needs diffutils
#:guile ,%bootstrap-guile
#:implicit-inputs? #f
,@(package-arguments diffutils)))))
(define findutils-boot0
(package-with-bootstrap-guile
(package-with-explicit-inputs (package
(package
(inherit findutils)
(name "findutils-boot0"))
(lambda _
(name "findutils-boot0")
(source (bootstrap-origin (package-source findutils)))
(inputs
`(("make" ,gnu-make-boot0)
("diffutils" ,diffutils-boot0) ; for tests
,@(%bootstrap-inputs+toolchain)))
(current-source-location)
#:guile %bootstrap-guile)))
(arguments
`(#:implicit-inputs? #f
#:guile ,%bootstrap-guile
,@(package-arguments findutils)))))
(define file-boot0
(package-with-bootstrap-guile
(package-with-explicit-inputs (package
(package
(inherit file)
(source (bootstrap-origin (package-source file)))
(name "file-boot0")
(arguments
'(#:strip-binaries? #f
#:validate-runpath? #f)))
(lambda _
(inputs
`(("make" ,gnu-make-boot0)
,@(%bootstrap-inputs+toolchain)))
(current-source-location)
#:guile %bootstrap-guile)))
(arguments
`(#:implicit-inputs? #f
#:guile ,%bootstrap-guile
#:strip-binaries? #f
#:validate-runpath? #f))))
(define (%boot0-inputs)
`(("make" ,gnu-make-boot0)
@ -1482,8 +1485,9 @@ exec " gcc "/bin/" program
;; reference to the target libc.
(define binutils-boot0
(package-with-bootstrap-guile
(package (inherit binutils)
(package
(inherit binutils)
(source (bootstrap-origin (package-source binutils)))
(name "binutils-cross-boot0")
(arguments
`(#:guile ,%bootstrap-guile
@ -1513,16 +1517,17 @@ 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
;; 'Makefile.def' forcefully adds --enable-shared) and thus needs to refer
;; to libstdc++.so. We cannot build libstdc++-5.3 because it relies on
;; C++14 features missing in some of our bootstrap compilers.
(let ((lib (package-with-bootstrap-guile (make-libstdc++ gcc-4.9))))
(let ((lib (make-libstdc++ gcc-4.9)))
(package
(inherit lib)
(source (bootstrap-origin (package-source lib)))
(name "libstdc++-boot0")
(arguments
`(#:guile ,%bootstrap-guile
@ -1548,9 +1553,10 @@ exec " gcc "/bin/" program
(native-inputs '()))))
(define gcc-boot0
(package-with-bootstrap-guile
(package (inherit gcc)
(package
(inherit gcc)
(name "gcc-cross-boot0")
(source (bootstrap-origin (package-source gcc)))
(arguments
`(#:guile ,%bootstrap-guile
#:implicit-inputs? #f
@ -1653,9 +1659,9 @@ exec " gcc "/bin/" program
(symlink "libgcc.a" "libgcc_eh.a"))
#t))))))))
(inputs `(("gmp-source" ,(package-source gmp-6.0))
("mpfr-source" ,(package-source mpfr))
("mpc-source" ,(package-source mpc))
(inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp-6.0)))
("mpfr-source" ,(bootstrap-origin (package-source mpfr)))
("mpc-source" ,(bootstrap-origin (package-source mpc)))
("binutils-cross" ,binutils-boot0)
;; The libstdc++ that libcc1 links against.
@ -1667,18 +1673,22 @@ exec " gcc "/bin/" program
,@(alist-delete "libc" (%boot0-inputs))))
;; No need for the native-inputs to build the documentation at this stage.
(native-inputs `()))))
(native-inputs `())))
(define perl-boot0
(let ((perl (package
(package
(inherit perl)
(name "perl-boot0")
(source (bootstrap-origin (package-source perl)))
(inputs (%boot0-inputs))
(arguments
`(#:implicit-inputs? #f
#:guile ,%bootstrap-guile
#:validate-runpath? #f
;; At the very least, this must not depend on GCC & co.
(let ((args `(#:validate-runpath? #f
#:disallowed-references
,(list %bootstrap-binutils))))
`(,@args
#:disallowed-references ,(list %bootstrap-binutils)
,@(substitute-keyword-arguments (package-arguments perl)
((#:phases phases)
`(modify-phases ,phases
@ -1693,32 +1703,39 @@ exec " gcc "/bin/" program
;; Do not configure with '-Dusethreads' since pthread
;; support is missing.
((#:configure-flags configure-flags)
`(delete "-Dusethreads" ,configure-flags)))))))))
(package-with-bootstrap-guile
(package-with-explicit-inputs perl
%boot0-inputs
(current-source-location)
#:guile %bootstrap-guile))))
`(delete "-Dusethreads" ,configure-flags)))))))
(define m4-boot0
(package-with-bootstrap-guile
(package
(inherit m4)
(name "m4-boot0")
(source (bootstrap-origin (package-source m4)))
(inputs (%boot0-inputs))
(arguments
`(#:guile ,%bootstrap-guile
#:implicit-inputs? #f
,@(package-arguments m4))))))
,@(package-arguments m4)))))
(define m4-boot0*
(package
;; TODO: On the next rebuild cycle, use M4-BOOT0 as is.
(inherit m4-boot0)
(name "m4")))
(define bison-boot0
;; This Bison is needed to build MiG so we need it early in the process.
;; Recent versions of Linux-Libre headers also depend on this.
(let* ((bison (package (inherit bison)
(propagated-inputs `(("m4" ,m4)))
(inputs '()) ;remove Flex...
(package
(inherit bison)
;; TODO: On the next build cycle, do:
;;(name "bison-boot0")
(propagated-inputs `(("m4" ,m4-boot0*)))
(native-inputs `(("perl" ,perl-boot0)))
(inputs (%boot0-inputs)) ;remove Flex...
(arguments
`(#:tests? #f ;... and thus disable tests
#:implicit-inputs? #f
#:guile ,%bootstrap-guile
;; XXX: These flags should be unconditional, but for now
;; we just add them on x86 to avoid a full rebuild.
@ -1741,25 +1758,24 @@ exec " gcc "/bin/" program
"RANLIB=ranlib")
(_
"RANLIB=ranlib -D"))
"V=1"))))))
(package
(inherit (package-with-bootstrap-guile
(package-with-explicit-inputs bison %boot0-inputs
(current-source-location)
#:guile %bootstrap-guile)))
(native-inputs `(("perl" ,perl-boot0))))))
"V=1")))))
(define flex-boot0
;; This Flex is needed to build MiG as well as Linux-Libre headers.
(let* ((flex (package (inherit flex)
(package
(inherit flex)
(native-inputs `(("bison" ,bison-boot0)))
(propagated-inputs `(("m4" ,m4)))
(inputs '())
(arguments '(#:tests? #f)))))
(package-with-bootstrap-guile
(package-with-explicit-inputs flex %boot0-inputs
(current-source-location)
#:guile %bootstrap-guile))))
(propagated-inputs
;; XXX: Here we use an 'm4-boot0' package that's not eq? so that it
;; appears twice in '%build-inputs', like when we were using
;; 'package-with-explicit-inputs'.
;; TODO: Remove this hack on the next rebuild cycle.
`(("m4" ,(package (inherit m4-boot0*)))))
(inputs (%boot0-inputs))
(arguments
`(#:implicit-inputs? #f
#:guile ,%bootstrap-guile
#:tests? #f))))
(define linux-libre-headers-boot0
(mlambda ()
@ -1768,9 +1784,10 @@ exec " gcc "/bin/" program
;; between (gnu packages linux) and this module. Additionally, memoize
;; the result to play well with further memoization and code that relies
;; on pointer identity; see <https://bugs.gnu.org/30155>.
(package-with-bootstrap-guile
(package (inherit linux-libre-headers)
(arguments `(#:guile ,%bootstrap-guile
(package
(inherit linux-libre-headers)
(arguments
`(#:guile ,%bootstrap-guile
#:implicit-inputs? #f
,@(package-arguments linux-libre-headers)))
(native-inputs
@ -1779,7 +1796,7 @@ exec " gcc "/bin/" program
;; Flex and Bison are required since version 4.16.
("flex" ,flex-boot0)
("bison" ,bison-boot0)
,@(%boot0-inputs)))))))
,@(%boot0-inputs))))))
(define gnumach-headers-boot0
(package-with-bootstrap-guile
@ -1844,57 +1861,66 @@ the bootstrap environment."
;; 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.
(let ((texinfo (package (inherit texinfo)
(package
(inherit texinfo)
(native-inputs '())
(inputs `(("perl" ,perl-boot0)))
(inputs `(,@(%boot0-inputs)
("perl" ,perl-boot0)))
(arguments
`(#:implicit-inputs? #f
#:guile ,%bootstrap-guile
;; Some of Texinfo 6.1's tests would fail with "Couldn't
;; set UTF-8 character type in locale" but we don't have a
;; UTF-8 locale at this stage, so skip them.
(arguments '(#:tests? #f)))))
(package-with-bootstrap-guile
(package-with-explicit-inputs texinfo %boot0-inputs
(current-source-location)
#:guile %bootstrap-guile))))
;; Some of Texinfo 6.1's tests would fail with "Couldn't set UTF-8
;; character type in locale" but we don't have a UTF-8 locale at this
;; stage, so skip them.
#:tests? #f))))
(define expat-sans-tests
(package
(inherit expat)
(inputs (%boot0-inputs))
(arguments
;; XXX: Linking 'runtestscpp' fails with things like:
;;
;; ld: Dwarf Error: found dwarf version '3789', this reader only handles version 2 and 3 information.
;;
;; Skip tests altogether.
(substitute-keyword-arguments (package-arguments expat)
`(#:implicit-inputs? #f
#:guile ,%bootstrap-guile
,@(substitute-keyword-arguments (package-arguments expat)
((#:configure-flags flags ''())
;; Since we're not passing the right -Wl,-rpath flags, build the
;; static library to avoid RUNPATH validation failure.
`(cons "--disable-shared" ,flags))
((#:tests? _ #f) #f)))))
((#:tests? _ #f) #f))))))
(define python-boot0
(let ((python (package
(package
(inherit python-minimal)
;; We cannot use Python 3.7 and later here, because they require
;; pthreads, which is missing on non-x86 platforms at this stage.
;; Python 3.6 technically supports being built without threading
;; support, but requires additional patches.
(version "3.5.7")
(source (origin
(source (bootstrap-origin
(origin
(inherit (package-source python))
(uri (string-append "https://www.python.org/ftp/python/"
version "/Python-" version ".tar.xz"))
(patches '())
(sha256
(base32
"1p67pnp2ca5przx2s45r8m55dcn6f5hsm0l4s1zp7mglkf4r4n18"))))
"1p67pnp2ca5przx2s45r8m55dcn6f5hsm0l4s1zp7mglkf4r4n18")))))
(inputs
`(("expat" ,expat-sans-tests))) ;remove OpenSSL, zlib, etc.
`(,@(%boot0-inputs)
("expat" ,expat-sans-tests))) ;remove OpenSSL, zlib, etc.
(native-inputs '()) ;and pkg-config
(arguments
(substitute-keyword-arguments (package-arguments
python-minimal)
`(#:implicit-inputs? #f
#:guile ,%bootstrap-guile
,@(substitute-keyword-arguments (package-arguments python-minimal)
;; Disable features that cannot be built at this stage.
((#:configure-flags _ ''())
`(list "--without-ensurepip"
@ -1915,10 +1941,6 @@ the bootstrap environment."
#t))
(delete 'set-TZDIR)))
((#:tests? _ #f) #f))))))
(package-with-bootstrap-guile
(package-with-explicit-inputs python %boot0-inputs
(current-source-location)
#:guile %bootstrap-guile))))
(define (ld-wrapper-boot0)
;; We need this so binaries on Hurd will have libmachuser and libhurduser
@ -1942,9 +1964,10 @@ the bootstrap environment."
;; store path has no dependencies. Actually, the really-final libc is
;; built just below; the only difference is that this one uses the
;; bootstrap Bash.
(package-with-bootstrap-guile
(package (inherit glibc)
(package
(inherit glibc)
(name "glibc-intermediate")
(source (bootstrap-origin (package-source glibc)))
(arguments
`(#:guile ,%bootstrap-guile
#:implicit-inputs? #f
@ -2000,7 +2023,7 @@ the bootstrap environment."
;; 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
@ -2064,13 +2087,19 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
(define static-bash-for-glibc
;; A statically-linked Bash to be used by GLIBC-FINAL in system(3) & co.
(let ((bash (package
(package
(inherit static-bash)
(source (bootstrap-origin (package-source static-bash)))
(inputs `(("gcc" ,(gcc-boot0-intermediate-wrapped))
("libc" ,glibc-final-with-bootstrap-bash)
("libc:static" ,glibc-final-with-bootstrap-bash "static")
,@(fold alist-delete (%boot1-inputs)
'("gcc" "libc"))))
(arguments
(substitute-keyword-arguments
(package-arguments static-bash)
((#:guile _ #f)
'%bootstrap-guile)
`(#:implicit-inputs? #f
#:guile ,%bootstrap-guile
,@(substitute-keyword-arguments (package-arguments static-bash)
((#:configure-flags flags '())
;; Add a '-L' flag so that the pseudo-cross-ld of
;; BINUTILS-BOOT0 can find libc.a.
@ -2079,22 +2108,11 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
(assoc-ref %build-inputs
"libc:static")
"/lib")))))))))
(package-with-bootstrap-guile
(package-with-explicit-inputs
bash
(lambda _
`(("gcc" ,(gcc-boot0-intermediate-wrapped))
("libc" ,glibc-final-with-bootstrap-bash)
("libc:static" ,glibc-final-with-bootstrap-bash "static")
,@(fold alist-delete (%boot1-inputs)
'("gcc" "libc"))))
(current-source-location)
#:guile %bootstrap-guile))))
(define gettext-boot0
;; A minimal gettext used during bootstrap.
(let ((gettext-minimal
(package (inherit gettext-minimal)
(package
(inherit gettext-minimal)
(name "gettext-boot0")
;; Newer versions of GNU gettext depends on libxml2 and ncurses. To
;; simplify the dependency chain, we stick to this version here.
@ -2106,9 +2124,11 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
(sha256
(base32
"0hsw28f9q9xaggjlsdp2qmbp2rbd1mp0njzan2ld9kiqwkq2m57z"))))
(inputs '()) ;zero dependencies
(inputs (%boot1-inputs)) ;zero dependencies
(arguments
`(#:tests? #f
`(#:implicit-inputs? #f
#:guile ,%bootstrap-guile
#:tests? #f
#:phases (modify-phases %standard-phases
;; Build only the tools.
(add-after 'unpack 'chdir
@ -2122,19 +2142,15 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
(substitute* "tests/Makefile.in"
(("^PROGRAMS =.*$")
"PROGRAMS =\n"))
#t))))))))
(package-with-bootstrap-guile
(package-with-explicit-inputs gettext-minimal
%boot1-inputs
(current-source-location)
#:guile %bootstrap-guile))))
#t)))))))
(define glibc-final
;; The final glibc, which embeds the statically-linked Bash built above.
;; Use 'package/inherit' so we get the 'replacement' of 'glibc', if any.
(let ((glibc (package-with-bootstrap-guile glibc)))
(package/inherit glibc
(package/inherit
glibc
(name "glibc")
(source (bootstrap-origin (package-source glibc)))
(inputs `(("static-bash" ,static-bash-for-glibc)
,@(alist-delete
"static-bash"
@ -2156,7 +2172,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
static-bash-for-glibc
(package-outputs glibc-final-with-bootstrap-bash))
,@(package-arguments glibc-final-with-bootstrap-bash))))))
,@(package-arguments glibc-final-with-bootstrap-bash)))))
(define (gcc-boot0-wrapped)
;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
@ -2172,21 +2188,23 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
,@(fold alist-delete (%boot1-inputs) '("libc" "gcc" "linux-libre-headers"))))
(define binutils-final
(package-with-bootstrap-guile
(package (inherit binutils)
(package
(inherit binutils)
(source (bootstrap-origin (package-source binutils)))
(arguments
`(#:guile ,%bootstrap-guile
#: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
;; (remember that GCC-BOOT0 cannot build libstdc++.)
(let ((lib (package-with-bootstrap-guile (make-libstdc++ gcc))))
(let ((lib (make-libstdc++ gcc)))
(package
(inherit lib)
(source (bootstrap-origin (package-source lib)))
(arguments
`(#:guile ,%bootstrap-guile
#:implicit-inputs? #f
@ -2211,7 +2229,6 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
(define zlib-final
;; Zlib used by GCC-FINAL.
(package-with-bootstrap-guile
(package
(inherit zlib)
(arguments
@ -2219,7 +2236,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 zlib)))
(inputs (%boot2-inputs)))))
(inputs (%boot2-inputs))))
(define (ld-wrapper-boot3)
;; A linker wrapper that uses the bootstrap Guile.
@ -2328,17 +2345,18 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
;; Link with `-static-libgcc' to make sure we don't retain a reference
;; to the bootstrap GCC. Use "bash-minimal" to avoid an extra dependency
;; on Readline and ncurses.
(let ((bash (package
(inherit bash-minimal)
(let ((bash (static-libgcc-package bash-minimal)))
(package
(inherit bash)
(source (bootstrap-origin (package-source bash)))
(inputs (%boot3-inputs))
(arguments
`(#:disallowed-references
,(assoc-ref (%boot3-inputs) "coreutils&co")
,@(package-arguments bash-minimal))))))
(package-with-bootstrap-guile
(package-with-explicit-inputs (static-libgcc-package bash)
%boot3-inputs
(current-source-location)
#:guile %bootstrap-guile))))
`(#:implicit-inputs? #f
#:guile ,%bootstrap-guile
#:disallowed-references ,(assoc-ref (%boot3-inputs) "coreutils&co")
,@(package-arguments bash))))))
(define (%boot4-inputs)
;; Now use the final Bash.