summaryrefslogtreecommitdiff
path: root/gnu/packages/bootstrap.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/bootstrap.scm')
-rw-r--r--gnu/packages/bootstrap.scm449
1 files changed, 336 insertions, 113 deletions
diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index 5030b815b9..8dbe52435e 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 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.
;;;
@@ -32,21 +33,30 @@
#:select (derivation derivation-input derivation->output-path))
#:use-module ((guix utils) #:select (gnu-triplet->nix-system))
#:use-module (guix memoization)
+ #:use-module (guix i18n)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
+ #:use-module (srfi srfi-34)
+ #:use-module (srfi srfi-35)
#:use-module (ice-9 match)
#:export (bootstrap-origin
package-with-bootstrap-guile
glibc-dynamic-linker
+ bootstrap-executable
bootstrap-guile-origin
%bootstrap-guile
%bootstrap-coreutils&co
+ %bootstrap-linux-libre-headers
%bootstrap-binutils
%bootstrap-gcc
%bootstrap-glibc
- %bootstrap-inputs))
+ %bootstrap-inputs
+ %bootstrap-mescc-tools
+ %bootstrap-mes
+
+ %bootstrap-inputs-for-tests))
;;; Commentary:
;;;
@@ -58,6 +68,82 @@
;;;
+;;; The bootstrap executables: 'bash', 'mkdir', 'tar', 'xz'. They allow us to
+;;; extract the very first tarball.
+;;;
+
+(define %bootstrap-executables
+ ;; List of bootstrap executables and their recursive hashes (as per 'guix
+ ;; hash -r'), taking their executable bit into account.
+ `(("aarch64-linux"
+ ("bash"
+ ,(base32 "13aqhqb8nydlwq1ah9974q0iadx1pb95v13wzzyf7vgv6nasrwzr"))
+ ("mkdir"
+ ,(base32 "1pxhdp7ldwavmm71xbh9wc197cb2nr66acjn26yjx3732cixh9ws"))
+ ("tar"
+ ,(base32 "1j51gv08sfg277yxj73xd564wjq3f8xwd6s9rbcg8v9gms47m4cx"))
+ ("xz"
+ ,(base32 "1d779rwsrasphg5g3r37qppcqy3p7ay1jb1y83w7x4i3qsc7zjy2")))
+ ("armhf-linux"
+ ("bash"
+ ,(base32 "0s6f1s26g4dsrrkl39zblvwpxmbzi6n9mgqf6vxsqz42gik6bgyn"))
+ ("mkdir"
+ ,(base32 "1r5rcp35niyxfkrdf00y2ba8ifrq9bi76cr63lwjf2l655j1i5p7"))
+ ("tar"
+ ,(base32 "0dksx5im3fv8ximz7368bsax9f26nn47ds74298flm5lnvpv9xly"))
+ ("xz"
+ ,(base32 "1cqqavghjfr0iwxqf61lrssv27wfigysgq2rs4rm1gkmn04yn1k3")))
+ ("i686-linux"
+ ("bash"
+ ,(base32 "0rjaxyzjdllfkf1abczvgaf3cdcc7mmahyvdbkjmjzhgz92pv23g"))
+ ("mkdir"
+ ,(base32 "133ybmfpkmsnysrzbngwvbysqnsmfi8is8zifs7i7n6n600h4s1w"))
+ ("tar"
+ ,(base32 "07830bx29ad5i0l1ykj0g0b1jayjdblf01sr3ww9wbnwdbzinqms"))
+ ("xz"
+ ,(base32 "0i9kxdi17bm5gxfi2xzm0y73p3ii0cqxli1sbljm6rh2fjgyn90k")))
+ ("mips64el-linux"
+ ("bash"
+ ,(base32 "1aw046dhda240k9pb9iaj5aqkm23gkvxa9j82n4k7fk87nbrixw6"))
+ ("mkdir"
+ ,(base32 "0c9j6qgyw84zxbry3ypifzll13gy8ax71w40kdk1h11jbgla3f5k"))
+ ("tar"
+ ,(base32 "06gmqdjq3rl8lr47b9fyx4ifnm5x56ymc8lyryp1ax1j2s4y5jb4"))
+ ("xz"
+ ,(base32 "09j1d69qr0hhhx4k4ih8wp00dfc9y4rp01hfg3vc15yxd0jxabh5")))))
+
+(define (bootstrap-executable-url program system)
+ "Return the URL where PROGRAM can be found for SYSTEM."
+ (string-append
+ "https://git.savannah.gnu.org/cgit/guix.git/plain/gnu/packages/bootstrap/"
+ system "/" program
+ "?id=44f07d1dc6806e97c4e9ee3e6be883cc59dc666e"))
+
+(define bootstrap-executable
+ (mlambda (program system)
+ "Return an origin for PROGRAM, a statically-linked bootstrap executable
+built for SYSTEM."
+ (let ((system (if (string=? system "x86_64-linux")
+ "i686-linux"
+ system)))
+ (match (assoc-ref (assoc-ref %bootstrap-executables system)
+ program)
+ (#f
+ (raise (condition
+ (&message
+ (message
+ (format #f (G_ "could not find bootstrap binary '~a' \
+for system '~a'")
+ program system))))))
+ ((sha256)
+ (origin
+ (method url-fetch/executable)
+ (uri (bootstrap-executable-url program system))
+ (file-name program)
+ (sha256 sha256)))))))
+
+
+;;;
;;; Helper procedures.
;;;
@@ -97,10 +183,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,25 +195,28 @@ 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)))
+ `(("tar" ,(bootstrap-executable "tar" (%current-system)))
+ ("xz" ,(bootstrap-executable "xz" (%current-system)))
("tarball" ,(bootstrap-origin (source (%current-system))))))
(source #f)
(synopsis description)
@@ -251,11 +340,9 @@ return value is ignored."
#:key outputs system search-paths
#:allow-other-keys)
(define (->store file)
- (add-to-store store file #t "sha256"
- (or (search-bootstrap-binary file
- system)
- (error "bootstrap binary not found"
- file system))))
+ (run-with-store store
+ (origin->derivation (bootstrap-executable file system)
+ system)))
(let* ((tar (->store "tar"))
(xz (->store "xz"))
@@ -305,15 +392,17 @@ $out/bin/guile -c ~s $out ~a
# Sanity check.
$out/bin/guile --version~%"
- mkdir xz tar
+ (derivation->output-path mkdir)
+ (derivation->output-path xz)
+ (derivation->output-path tar)
(format #f "~s" make-guile-wrapper)
- bash)
- (list mkdir xz tar bash))))
+ (derivation->output-path bash)))))
(derivation store name
- bash `(,builder)
+ (derivation->output-path bash) `(,builder)
#:system system
- #:inputs (list (derivation-input guile))
- #:sources (list bash builder)
+ #:inputs (map derivation-input
+ (list bash mkdir tar xz guile))
+ #:sources (list builder)
#:env-vars `(("GUILE_TARBALL"
. ,(derivation->output-path guile))))))
@@ -394,6 +483,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)
@@ -439,31 +544,33 @@ $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)))
+ `(("tar" ,(bootstrap-executable "tar" (%current-system)))
+ ("xz" ,(bootstrap-executable "xz" (%current-system)))
("tarball" ,(bootstrap-origin
(origin
(method url-fetch)
@@ -510,73 +617,75 @@ $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)))
- ("bash" ,(search-bootstrap-binary "bash" (%current-system)))
+ `(("tar" ,(bootstrap-executable "tar" (%current-system)))
+ ("xz" ,(bootstrap-executable "xz" (%current-system)))
+ ("bash" ,(bootstrap-executable "bash" (%current-system)))
("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")
@@ -589,15 +698,129 @@ 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" ,(bootstrap-executable "tar" (%current-system)))
+ ("xz" ,(bootstrap-executable "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" ,(bootstrap-executable "tar" (%current-system)))
+ ("xz" ,(bootstrap-executable "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.
+ `(,@(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.
+ ("bash" ,%bootstrap-coreutils&co)))
+
+(define %bootstrap-inputs-for-tests
+ ;; These are bootstrap inputs that are cheap to produce (no compilation
+ ;; needed) and that are meant to be used for testing. (These are those we
+ ;; used before the Mes-based reduced bootstrap.)
`(("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.
("bash" ,%bootstrap-coreutils&co)))
;;; bootstrap.scm ends here