diff options
Diffstat (limited to 'gnu/packages/commencement.scm')
-rw-r--r-- | gnu/packages/commencement.scm | 191 |
1 files changed, 110 insertions, 81 deletions
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index 4a9aed09c1..7286e954c5 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -3,7 +3,7 @@ ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr> ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org> ;;; Copyright © 2014, 2015, 2017 Mark H Weaver <mhw@netris.org> -;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il> +;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il> ;;; ;;; This file is part of GNU Guix. ;;; @@ -47,6 +47,7 @@ #:use-module (guix download) #:use-module (guix build-system gnu) #:use-module (guix build-system trivial) + #:use-module (guix memoization) #:use-module (guix utils) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) @@ -150,23 +151,22 @@ #:modules ((guix build gnu-build-system) (guix build utils) (ice-9 ftw)) ; for 'scandir' - #:phases (alist-cons-after - 'install 'add-symlinks - (lambda* (#:key outputs #:allow-other-keys) - ;; The cross-gcc invokes 'as', 'ld', etc, without the - ;; triplet prefix, so add symlinks. - (let ((out (assoc-ref outputs "out")) - (triplet-prefix (string-append ,(boot-triplet) "-"))) - (define (has-triplet-prefix? name) - (string-prefix? triplet-prefix name)) - (define (remove-triplet-prefix name) - (substring name (string-length triplet-prefix))) - (with-directory-excursion (string-append out "/bin") - (for-each (lambda (name) - (symlink name (remove-triplet-prefix name))) - (scandir "." has-triplet-prefix?))) - #t)) - %standard-phases) + #:phases (modify-phases %standard-phases + (add-after 'install 'add-symlinks + (lambda* (#:key outputs #:allow-other-keys) + ;; The cross-gcc invokes 'as', 'ld', etc, without the + ;; triplet prefix, so add symlinks. + (let ((out (assoc-ref outputs "out")) + (triplet-prefix (string-append ,(boot-triplet) "-"))) + (define (has-triplet-prefix? name) + (string-prefix? triplet-prefix name)) + (define (remove-triplet-prefix name) + (substring name (string-length triplet-prefix))) + (with-directory-excursion (string-append out "/bin") + (for-each (lambda (name) + (symlink name (remove-triplet-prefix name))) + (scandir "." has-triplet-prefix?))) + #t)))) ,@(substitute-keyword-arguments (package-arguments binutils) ((#:configure-flags cf) @@ -174,12 +174,28 @@ ,cf))))) (inputs %boot0-inputs)))) +;; gcc-4.9 was fixed late in the core-update cycle and so this GCC is only +;; needed to prevent a full world rebuild, and can be replaced with gcc-4.9. +(define gcc-for-libstdc++ + (package (inherit gcc-4.9) + (version "4.9.4") + (source (origin + (method url-fetch) + (uri (string-append "mirror://gnu/gcc/gcc-" + version "/gcc-" version ".tar.bz2")) + (sha256 + (base32 + "14l06m7nvcvb0igkbip58x59w3nq6315k6jcz3wr9ch1rn9d44bc")) + (patches (search-patches "gcc-arm-bug-71399.patch" + "gcc-libvtv-runpath.patch" + "gcc-fix-texi2pod.patch")))))) + (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 our bootstrap compiler. - (let ((lib (package-with-bootstrap-guile (make-libstdc++ gcc-4.9)))) + ;; C++14 features missing in some of our bootstrap compilers. + (let ((lib (package-with-bootstrap-guile (make-libstdc++ gcc-for-libstdc++)))) (package (inherit lib) (name "libstdc++-boot0") @@ -287,9 +303,8 @@ ("libc-native" ,@(assoc-ref %boot0-inputs "libc")) ,@(alist-delete "libc" %boot0-inputs))) - ;; No need for Texinfo at this stage. - (native-inputs (alist-delete "texinfo" - (package-native-inputs gcc)))))) + ;; No need for the native-inputs to build the documentation at this stage. + (native-inputs `())))) (define perl-boot0 (let ((perl (package @@ -357,18 +372,21 @@ (current-source-location) #:guile %bootstrap-guile)))) -(define (linux-libre-headers-boot0) - "Return Linux-Libre header files for the bootstrap environment." - ;; Note: this is wrapped in a thunk to nicely handle circular dependencies - ;; between (gnu packages linux) and this module. - (package-with-bootstrap-guile - (package (inherit linux-libre-headers) - (arguments `(#:guile ,%bootstrap-guile - #:implicit-inputs? #f - ,@(package-arguments linux-libre-headers))) - (native-inputs - `(("perl" ,perl-boot0) - ,@%boot0-inputs))))) +(define linux-libre-headers-boot0 + (mlambda () + "Return Linux-Libre header files for the bootstrap environment." + ;; Note: this is wrapped in a thunk to nicely handle circular dependencies + ;; 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 + #:implicit-inputs? #f + ,@(package-arguments linux-libre-headers))) + (native-inputs + `(("perl" ,perl-boot0) + ,@%boot0-inputs)))))) (define gnumach-headers-boot0 (package-with-bootstrap-guile @@ -409,18 +427,19 @@ (current-source-location) #:guile %bootstrap-guile)))) -(define (hurd-core-headers-boot0) - "Return the Hurd and Mach headers as well as initial Hurd libraries for +(define hurd-core-headers-boot0 + (mlambda () + "Return the Hurd and Mach headers as well as initial Hurd libraries for the bootstrap environment." - (package-with-bootstrap-guile - (package (inherit hurd-core-headers) - (arguments `(#:guile ,%bootstrap-guile - ,@(package-arguments hurd-core-headers))) - (inputs - `(("gnumach-headers" ,gnumach-headers-boot0) - ("hurd-headers" ,hurd-headers-boot0) - ("hurd-minimal" ,hurd-minimal-boot0) - ,@%boot0-inputs))))) + (package-with-bootstrap-guile + (package (inherit hurd-core-headers) + (arguments `(#:guile ,%bootstrap-guile + ,@(package-arguments hurd-core-headers))) + (inputs + `(("gnumach-headers" ,gnumach-headers-boot0) + ("hurd-headers" ,hurd-headers-boot0) + ("hurd-minimal" ,hurd-minimal-boot0) + ,@%boot0-inputs)))))) (define* (kernel-headers-boot0 #:optional (system (%current-system))) (match system @@ -467,7 +486,7 @@ the bootstrap environment." ;; 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") (arguments `(#:guile ,%bootstrap-guile @@ -584,12 +603,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 @@ -633,7 +664,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" (define glibc-final ;; The final glibc, which embeds the statically-linked Bash built above. - (package/inherit glibc-final-with-bootstrap-bash + (package (inherit glibc-final-with-bootstrap-bash) (name "glibc") (inputs `(("static-bash" ,static-bash-for-glibc) ,@(alist-delete @@ -664,12 +695,13 @@ 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")))) (define binutils-final (package-with-bootstrap-guile - (package/inherit binutils + (package (inherit binutils) (arguments `(#:guile ,%bootstrap-guile #:implicit-inputs? #f @@ -680,34 +712,29 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" (define libstdc++ ;; Intermediate libstdc++ that will allow us to build the final GCC ;; (remember that GCC-BOOT0 cannot build libstdc++.) - ;; TODO: Write in terms of 'make-libstdc++'. - (package-with-bootstrap-guile - (package (inherit gcc) - (name "libstdc++") - (arguments - `(#:guile ,%bootstrap-guile - #:implicit-inputs? #f - #:allowed-references ("out") - #:out-of-source? #t - #:phases (alist-cons-before - 'configure 'chdir - (lambda _ - (chdir "libstdc++-v3")) - %standard-phases) - #:configure-flags `("--disable-shared" - "--disable-libstdcxx-threads" - "--disable-libstdcxx-pch" - ,(string-append "--with-gxx-include-dir=" - (assoc-ref %outputs "out") - "/include" - ;; "/include/c++/" - ;; ,(package-version gcc) - )))) - (outputs '("out")) - (inputs %boot2-inputs) - (native-inputs '()) - (propagated-inputs '()) - (synopsis "GNU C++ standard library (intermediate)")))) + (let ((lib (package-with-bootstrap-guile (make-libstdc++ gcc)))) + (package + (inherit lib) + (arguments + `(#:guile ,%bootstrap-guile + #:implicit-inputs? #f + #:allowed-references ("out") + + ;; XXX: libstdc++.so NEEDs ld.so for some reason. + #:validate-runpath? #f + + ;; All of the package arguments from 'make-libstdc++ + ;; except for the configure-flags. + ,@(package-arguments lib) + #:configure-flags `("--disable-shared" + "--disable-libstdcxx-threads" + "--disable-libstdcxx-pch" + ,(string-append "--with-gxx-include-dir=" + (assoc-ref %outputs "out") + "/include")))) + (outputs '("out")) + (inputs %boot2-inputs) + (synopsis "GNU C++ standard library (intermediate)")))) (define zlib-final ;; Zlib used by GCC-FINAL. @@ -780,6 +807,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" ;; scripts such as 'mkheaders' and 'fixinc.sh' (XXX: who cares about these ;; scripts?). (native-inputs `(("texinfo" ,texinfo-boot0) + ("perl" ,perl-boot0) ;for manpages ("static-bash" ,static-bash-for-glibc) ,@(package-native-inputs gcc-boot0))) @@ -925,12 +953,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 |