diff options
Diffstat (limited to 'gnu/packages/bootstrap.scm')
-rw-r--r-- | gnu/packages/bootstrap.scm | 323 |
1 files changed, 227 insertions, 96 deletions
diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm index a3ecbeb076..16ed15c237 100644 --- a/gnu/packages/bootstrap.scm +++ b/gnu/packages/bootstrap.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il> +;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -43,10 +44,13 @@ %bootstrap-guile %bootstrap-coreutils&co + %bootstrap-linux-libre-headers %bootstrap-binutils %bootstrap-gcc %bootstrap-glibc - %bootstrap-inputs)) + %bootstrap-inputs + %bootstrap-mescc-tools + %bootstrap-mes)) ;;; Commentary: ;;; @@ -97,10 +101,10 @@ (define* (package-from-tarball name source program-to-test description #:key snippet) "Return a package that correspond to the extraction of SOURCE. -PROGRAM-TO-TEST is a program to run after extraction of SOURCE, to check -whether everything is alright. If SNIPPET is provided, it is evaluated after -extracting SOURCE. SNIPPET should raise an exception to signal an error; its -return value is ignored." +PROGRAM-TO-TEST is #f or a string: the program to run after extraction of +SOURCE to check whether everything is alright. If SNIPPET is provided, it is +evaluated after extracting SOURCE. SNIPPET should return true if successful, +or false to signal an error." (package (name name) (version "0") @@ -109,22 +113,25 @@ return value is ignored." `(#:guile ,%bootstrap-guile #:modules ((guix build utils)) #:builder - (let ((out (assoc-ref %outputs "out")) - (tar (assoc-ref %build-inputs "tar")) - (xz (assoc-ref %build-inputs "xz")) - (tarball (assoc-ref %build-inputs "tarball"))) + (begin (use-modules (guix build utils)) - (mkdir out) - (copy-file tarball "binaries.tar.xz") - (invoke xz "-d" "binaries.tar.xz") - (let ((builddir (getcwd))) - (with-directory-excursion out - (invoke tar "xvf" - (string-append builddir "/binaries.tar")) - ,@(if snippet (list snippet) '()) - (invoke (string-append "bin/" ,program-to-test) - "--version")))))) + (let ((out (assoc-ref %outputs "out")) + (tar (assoc-ref %build-inputs "tar")) + (xz (assoc-ref %build-inputs "xz")) + (tarball (assoc-ref %build-inputs "tarball"))) + + (mkdir out) + (copy-file tarball "binaries.tar.xz") + (invoke xz "-d" "binaries.tar.xz") + (let ((builddir (getcwd))) + (with-directory-excursion out + (invoke tar "xvf" + (string-append builddir "/binaries.tar")) + ,@(if snippet (list snippet) '()) + (or (not ,program-to-test) + (invoke (string-append "bin/" ,program-to-test) + "--version")))))))) (inputs `(("tar" ,(search-bootstrap-binary "tar" (%current-system))) ("xz" ,(search-bootstrap-binary "xz" (%current-system))) @@ -392,6 +399,22 @@ $out/bin/guile --version~%" (("^exec grep") (string-append (getcwd) "/bin/grep")))) (chmod "bin" #o555)))) +(define-public %bootstrap-linux-libre-headers + (package-from-tarball + "linux-libre-headers-bootstrap" + (lambda (system) + (origin + (method url-fetch) + (uri (map (cute string-append <> + "/i686-linux/20181020/" + "linux-libre-headers-stripped-4.14.67-i686-linux.tar.xz") + %bootstrap-base-urls)) + (sha256 + (base32 + "0sm2z9x4wk45bh6qfs94p0w1d6hsy6dqx9sw38qsqbvxwa1qzk8s")))) + #f ; no program to test + "Bootstrap linux-libre-headers")) + (define %bootstrap-binutils (package-from-tarball "binutils-bootstrap" (lambda (system) @@ -437,28 +460,30 @@ $out/bin/guile --version~%" `(#:guile ,%bootstrap-guile #:modules ((guix build utils)) #:builder - (let ((out (assoc-ref %outputs "out")) - (tar (assoc-ref %build-inputs "tar")) - (xz (assoc-ref %build-inputs "xz")) - (tarball (assoc-ref %build-inputs "tarball"))) + (begin (use-modules (guix build utils)) - (mkdir out) - (copy-file tarball "binaries.tar.xz") - (invoke xz "-d" "binaries.tar.xz") - (let ((builddir (getcwd))) - (with-directory-excursion out - (invoke tar "xvf" - (string-append builddir - "/binaries.tar")) - (chmod "lib" #o755) - - ;; Patch libc.so so it refers to the right path. - (substitute* "lib/libc.so" - (("/[^ ]+/lib/(libc|ld)" _ prefix) - (string-append out "/lib/" prefix))) - - #t))))) + (let ((out (assoc-ref %outputs "out")) + (tar (assoc-ref %build-inputs "tar")) + (xz (assoc-ref %build-inputs "xz")) + (tarball (assoc-ref %build-inputs "tarball"))) + + (mkdir out) + (copy-file tarball "binaries.tar.xz") + (invoke xz "-d" "binaries.tar.xz") + (let ((builddir (getcwd))) + (with-directory-excursion out + (invoke tar "xvf" + (string-append builddir + "/binaries.tar")) + (chmod "lib" #o755) + + ;; Patch libc.so so it refers to the right path. + (substitute* "lib/libc.so" + (("/[^ ]+/lib/(libc|ld)" _ prefix) + (string-append out "/lib/" prefix))) + + #t)))))) (inputs `(("tar" ,(search-bootstrap-binary "tar" (%current-system))) ("xz" ,(search-bootstrap-binary "xz" (%current-system))) @@ -508,39 +533,41 @@ $out/bin/guile --version~%" `(#:guile ,%bootstrap-guile #:modules ((guix build utils)) #:builder - (let ((out (assoc-ref %outputs "out")) - (tar (assoc-ref %build-inputs "tar")) - (xz (assoc-ref %build-inputs "xz")) - (bash (assoc-ref %build-inputs "bash")) - (libc (assoc-ref %build-inputs "libc")) - (tarball (assoc-ref %build-inputs "tarball"))) + (begin (use-modules (guix build utils) (ice-9 popen)) - (mkdir out) - (copy-file tarball "binaries.tar.xz") - (invoke xz "-d" "binaries.tar.xz") - (let ((builddir (getcwd)) - (bindir (string-append out "/bin"))) - (with-directory-excursion out - (invoke tar "xvf" - (string-append builddir "/binaries.tar"))) - - (with-directory-excursion bindir - (chmod "." #o755) - (rename-file "gcc" ".gcc-wrapped") - (call-with-output-file "gcc" - (lambda (p) - (format p "#!~a + (let ((out (assoc-ref %outputs "out")) + (tar (assoc-ref %build-inputs "tar")) + (xz (assoc-ref %build-inputs "xz")) + (bash (assoc-ref %build-inputs "bash")) + (libc (assoc-ref %build-inputs "libc")) + (tarball (assoc-ref %build-inputs "tarball"))) + + (mkdir out) + (copy-file tarball "binaries.tar.xz") + (invoke xz "-d" "binaries.tar.xz") + (let ((builddir (getcwd)) + (bindir (string-append out "/bin"))) + (with-directory-excursion out + (invoke tar "xvf" + (string-append builddir "/binaries.tar"))) + + (with-directory-excursion bindir + (chmod "." #o755) + (rename-file "gcc" ".gcc-wrapped") + (call-with-output-file "gcc" + (lambda (p) + (format p "#!~a exec ~a/bin/.gcc-wrapped -B~a/lib \ -Wl,-rpath -Wl,~a/lib \ -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" - bash - out libc libc libc - ,(glibc-dynamic-linker)))) + bash + out libc libc libc + ,(glibc-dynamic-linker)))) - (chmod "gcc" #o555) - #t))))) + (chmod "gcc" #o555) + #t)))))) (inputs `(("tar" ,(search-bootstrap-binary "tar" (%current-system))) ("xz" ,(search-bootstrap-binary "xz" (%current-system))) @@ -548,33 +575,33 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \ ("libc" ,%bootstrap-glibc) ("tarball" ,(bootstrap-origin (origin - (method url-fetch) - (uri (map (cut string-append <> "/" (%current-system) - (match (%current-system) - ("armhf-linux" - "/20150101/gcc-4.8.4.tar.xz") - ("aarch64-linux" - "/20170217/gcc-5.4.0.tar.xz") - (_ - "/20131110/gcc-4.8.2.tar.xz"))) - %bootstrap-base-urls)) - (sha256 - (match (%current-system) - ("x86_64-linux" - (base32 - "17ga4m6195n4fnbzdkmik834znkhs53nkypp6557pl1ps7dgqbls")) - ("i686-linux" - (base32 - "150c1arrf2k8vfy6dpxh59vcgs4p1bgiz2av5m19dynpks7rjnyw")) - ("armhf-linux" - (base32 - "0ghz825yzp43fxw53kd6afm8nkz16f7dxi9xi40bfwc8x3nbbr8v")) - ("aarch64-linux" - (base32 - "1ar3vdzyqbfm0z36kmvazvfswxhcihlacl2dzdjgiq25cqnq9ih1")) - ("mips64el-linux" - (base32 - "1m5miqkyng45l745n0sfafdpjkqv9225xf44jqkygwsipj2cv9ks"))))))))) + (method url-fetch) + (uri (map (cut string-append <> "/" (%current-system) + (match (%current-system) + ("armhf-linux" + "/20150101/gcc-4.8.4.tar.xz") + ("aarch64-linux" + "/20170217/gcc-5.4.0.tar.xz") + (_ + "/20131110/gcc-4.8.2.tar.xz"))) + %bootstrap-base-urls)) + (sha256 + (match (%current-system) + ("x86_64-linux" + (base32 + "17ga4m6195n4fnbzdkmik834znkhs53nkypp6557pl1ps7dgqbls")) + ("i686-linux" + (base32 + "150c1arrf2k8vfy6dpxh59vcgs4p1bgiz2av5m19dynpks7rjnyw")) + ("armhf-linux" + (base32 + "0ghz825yzp43fxw53kd6afm8nkz16f7dxi9xi40bfwc8x3nbbr8v")) + ("aarch64-linux" + (base32 + "1ar3vdzyqbfm0z36kmvazvfswxhcihlacl2dzdjgiq25cqnq9ih1")) + ("mips64el-linux" + (base32 + "1m5miqkyng45l745n0sfafdpjkqv9225xf44jqkygwsipj2cv9ks"))))))))) (native-search-paths (list (search-path-specification (variable "CPATH") @@ -587,12 +614,116 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \ (home-page #f) (license gpl3+))) -(define %bootstrap-inputs +(define %bootstrap-mescc-tools + ;; The initial MesCC tools. Uses binaries from a tarball typically built by + ;; %MESCC-TOOLS-BOOTSTRAP-TARBALL. + (package + (name "bootstrap-mescc-tools") + (version "0.5.2") + (source #f) + (build-system trivial-build-system) + (arguments + `(#:guile ,%bootstrap-guile + #:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils) + (ice-9 popen)) + (let ((out (assoc-ref %outputs "out")) + (tar (assoc-ref %build-inputs "tar")) + (xz (assoc-ref %build-inputs "xz")) + (tarball (assoc-ref %build-inputs "tarball"))) + + (mkdir out) + (copy-file tarball "binaries.tar.xz") + (invoke xz "-d" "binaries.tar.xz") + (let ((builddir (getcwd)) + (bindir (string-append out "/bin"))) + (with-directory-excursion out + (invoke tar "xvf" + (string-append builddir "/binaries.tar")))))))) + (inputs + `(("tar" ,(search-bootstrap-binary "tar" (%current-system))) + ("xz" ,(search-bootstrap-binary "xz" (%current-system))) + ("tarball" + ,(bootstrap-origin + (origin + (method url-fetch) + (uri (map + (cute string-append <> + "/i686-linux/20181020/" + "mescc-tools-static-0.5.2-0.bb062b0-i686-linux.tar.xz") + %bootstrap-base-urls)) + (sha256 + (base32 + "11lniw0vg61kmyhvnwkmcnkci9ym6hbmiksiqggd0hkipbq7hvlz"))))))) + (synopsis "Bootstrap binaries of MesCC Tools") + (description synopsis) + (home-page #f) + (supported-systems '("i686-linux" "x86_64-linux")) + (license gpl3+))) + +(define %bootstrap-mes + ;; The initial Mes. Uses binaries from a tarball typically built by + ;; %MES-BOOTSTRAP-TARBALL. + (package + (name "bootstrap-mes") + (version "0") + (source #f) + (build-system trivial-build-system) + (arguments + `(#:guile ,%bootstrap-guile + #:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils) + (ice-9 popen)) + (let ((out (assoc-ref %outputs "out")) + (tar (assoc-ref %build-inputs "tar")) + (xz (assoc-ref %build-inputs "xz")) + (tarball (assoc-ref %build-inputs "tarball"))) + + (mkdir out) + (copy-file tarball "binaries.tar.xz") + (invoke xz "-d" "binaries.tar.xz") + (let ((builddir (getcwd)) + (bindir (string-append out "/bin"))) + (with-directory-excursion out + (invoke tar "xvf" + (string-append builddir "/binaries.tar")))))))) + (inputs + `(("tar" ,(search-bootstrap-binary "tar" (%current-system))) + ("xz" ,(search-bootstrap-binary "xz" (%current-system))) + ("tarball" + ,(bootstrap-origin + (origin + (method url-fetch) + (uri (map + (cute string-append <> + "/i686-linux/20181020/" + "mes-minimal-stripped-0.19-i686-linux.tar.xz") + %bootstrap-base-urls)) + (sha256 + (base32 + "0k7kkl68a6xaadv47ij0nr9jm5ca1ffj38n7f2lg80y72wdkwr9h"))))))) + (supported-systems '("i686-linux" "x86_64-linux")) + (synopsis "Bootstrap binaries of Mes") + (description synopsis) + (home-page #f) + (license gpl3+))) + +(define (%bootstrap-inputs) ;; The initial, pre-built inputs. From now on, we can start building our ;; own packages. - `(("libc" ,%bootstrap-glibc) - ("gcc" ,%bootstrap-gcc) - ("binutils" ,%bootstrap-binutils) + `(,@(match (%current-system) + ((or "i686-linux" "x86_64-linux") + `(("linux-libre-headers" ,%bootstrap-linux-libre-headers) + ("bootstrap-mescc-tools" ,%bootstrap-mescc-tools) + ("mes" ,%bootstrap-mes))) + (_ + `(("libc" ,%bootstrap-glibc) + ("gcc" ,%bootstrap-gcc) + ("binutils" ,%bootstrap-binutils)))) ("coreutils&co" ,%bootstrap-coreutils&co) ;; In gnu-build-system.scm, we rely on the availability of Bash. |