1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014, 2015, 2018, 2019 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2017, 2020 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2018, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
6 ;;; Copyright © 2019 Carl Dong <contact@carldong.me>
7 ;;; Copyright © 2019 Léo Le Bouter <lle-bout@zaclys.net>
8 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
9 ;;; Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
11 ;;; This file is part of GNU Guix.
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26 (define-module (gnu packages bootstrap)
27 #:use-module (guix licenses)
28 #:use-module (gnu packages)
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix build-system)
32 #:use-module (guix build-system gnu)
33 #:use-module (guix build-system trivial)
34 #:use-module ((guix store)
35 #:select (run-with-store add-to-store add-text-to-store))
36 #:use-module ((guix derivations)
37 #:select (derivation derivation-input derivation->output-path))
38 #:use-module ((guix utils) #:select (gnu-triplet->nix-system))
39 #:use-module ((guix gexp) #:select (lower-object))
40 #:use-module (guix memoization)
41 #:use-module (guix i18n)
42 #:use-module (srfi srfi-1)
43 #:use-module (srfi srfi-26)
44 #:use-module (srfi srfi-34)
45 #:use-module (srfi srfi-35)
46 #:use-module (ice-9 match)
47 #:export (bootstrap-origin
48 package-with-bootstrap-guile
52 bootstrap-guile-origin
55 %bootstrap-coreutils&co
56 %bootstrap-linux-libre-headers
61 %bootstrap-mescc-tools
64 %bootstrap-inputs-for-tests))
68 ;;; Pre-built packages that are used to bootstrap the
69 ;;; distribution--i.e., to build all the core packages from scratch.
76 ;;; The bootstrap executables: 'bash', 'mkdir', 'tar', 'xz'. They allow us to
77 ;;; extract the very first tarball.
80 (define %bootstrap-executables
81 ;; List of bootstrap executables and their recursive hashes (as per 'guix
82 ;; hash -r'), taking their executable bit into account.
85 ,(base32 "13aqhqb8nydlwq1ah9974q0iadx1pb95v13wzzyf7vgv6nasrwzr"))
87 ,(base32 "1pxhdp7ldwavmm71xbh9wc197cb2nr66acjn26yjx3732cixh9ws"))
89 ,(base32 "1j51gv08sfg277yxj73xd564wjq3f8xwd6s9rbcg8v9gms47m4cx"))
91 ,(base32 "1d779rwsrasphg5g3r37qppcqy3p7ay1jb1y83w7x4i3qsc7zjy2")))
94 ,(base32 "0s6f1s26g4dsrrkl39zblvwpxmbzi6n9mgqf6vxsqz42gik6bgyn"))
96 ,(base32 "1r5rcp35niyxfkrdf00y2ba8ifrq9bi76cr63lwjf2l655j1i5p7"))
98 ,(base32 "0dksx5im3fv8ximz7368bsax9f26nn47ds74298flm5lnvpv9xly"))
100 ,(base32 "1cqqavghjfr0iwxqf61lrssv27wfigysgq2rs4rm1gkmn04yn1k3")))
103 ,(base32 "0rjaxyzjdllfkf1abczvgaf3cdcc7mmahyvdbkjmjzhgz92pv23g"))
105 ,(base32 "133ybmfpkmsnysrzbngwvbysqnsmfi8is8zifs7i7n6n600h4s1w"))
107 ,(base32 "07830bx29ad5i0l1ykj0g0b1jayjdblf01sr3ww9wbnwdbzinqms"))
109 ,(base32 "0i9kxdi17bm5gxfi2xzm0y73p3ii0cqxli1sbljm6rh2fjgyn90k")))
112 ,(base32 "1as8649aqaibahhhrvkj10ci8shpi4hq5n7gnik8rhhy0dc1jarg"))
114 ,(base32 "1snqgpfrl00hfn82lm29jqylzjsfb9jd6ha74dp12phwb8fpbmb9"))
116 ,(base32 "0nq2c1zb3wv5bf7kd83sziaashydazrn7xgq6kijlk0zj2syzc2m"))
118 ,(base32 "033rhpk6zrpxpd6ffjyg5y2zwq9x9cnq0zljb7k8jlncbalsayq5")))
121 ,(base32 "1aw046dhda240k9pb9iaj5aqkm23gkvxa9j82n4k7fk87nbrixw6"))
123 ,(base32 "0c9j6qgyw84zxbry3ypifzll13gy8ax71w40kdk1h11jbgla3f5k"))
125 ,(base32 "06gmqdjq3rl8lr47b9fyx4ifnm5x56ymc8lyryp1ax1j2s4y5jb4"))
127 ,(base32 "09j1d69qr0hhhx4k4ih8wp00dfc9y4rp01hfg3vc15yxd0jxabh5")))
130 ,(base32 "1kiw7n6mkdy2x9in97646nb7aiayxr090ws1hbrlazah3fjqi6nj"))
132 ,(base32 "04dpvi231zcl40ig048vqqnyvmnkw1byrm1q1qqvs1f0g16yhrrk"))
134 ,(base32 "150c8948cz8r208g6qgn2dn4f4zs5kpgbpbg6bwag6yw42rapw2l"))
136 ,(base32 "0v5738idy9pqzcbrjdpxi5c6qs5m78zrpsydmrpx5cfcfzbkxzjh")))))
138 (define %bootstrap-executable-base-urls
139 ;; This is where the bootstrap executables come from.
140 '("https://git.savannah.gnu.org/cgit/guix.git/plain/gnu/packages/bootstrap/"
141 "https://alpha.gnu.org/gnu/guix/bootstrap/"
142 "http://lilypond.org/janneke/guix/"))
144 (define (bootstrap-executable-file-name system program)
145 "Return the FILE-NAME part of url where PROGRAM can be found for SYSTEM."
147 ("powerpc64le-linux" (string-append system "/20210106/" program))
148 ("i586-gnu" (string-append system "/20200326/" program))
149 (_ (string-append system "/" program
150 "?id=44f07d1dc6806e97c4e9ee3e6be883cc59dc666e"))))
152 (define bootstrap-executable
153 (mlambda (program system)
154 "Return an origin for PROGRAM, a statically-linked bootstrap executable
156 (let ((system (if (string=? system "x86_64-linux")
159 (match (assoc-ref (assoc-ref %bootstrap-executables system)
165 (format #f (G_ "could not find bootstrap binary '~a' \
170 (method url-fetch/executable)
171 (uri (map (cute string-append <>
172 (bootstrap-executable-file-name system program))
173 %bootstrap-executable-base-urls))
175 (hash (content-hash bv sha256))))))))
179 ;;; Helper procedures.
182 (define bootstrap-origin
184 "Return a variant of SOURCE, an <origin> instance, whose method uses
185 %BOOTSTRAP-GUILE to do its job."
187 (lambda* (url hash-algo hash
188 #:optional name #:key system)
189 (fetch url hash-algo hash name
190 #:guile %bootstrap-guile
193 (define %bootstrap-patch-inputs
194 ;; Packages used when an <origin> has a non-empty 'patches' field.
195 `(("tar" ,%bootstrap-coreutils&co)
196 ("xz" ,%bootstrap-coreutils&co)
197 ("bzip2" ,%bootstrap-coreutils&co)
198 ("gzip" ,%bootstrap-coreutils&co)
199 ("patch" ,%bootstrap-coreutils&co)))
201 (let ((orig-method (origin-method source)))
202 (if (or (not (null? (origin-patches source)))
203 (origin-snippet source))
204 (origin (inherit source)
205 (method (if (eq? orig-method url-fetch)
208 (patch-guile %bootstrap-guile)
209 (patch-inputs %bootstrap-patch-inputs)
211 ;; Patches can be origins as well, so process them.
212 (patches (map (match-lambda
214 (bootstrap-origin patch))
216 (origin-patches source))))
219 (define* (package-from-tarball name source program-to-test description
221 "Return a package that correspond to the extraction of SOURCE.
222 PROGRAM-TO-TEST is #f or a string: the program to run after extraction of
223 SOURCE to check whether everything is alright. If SNIPPET is provided, it is
224 evaluated after extracting SOURCE. SNIPPET should return true if successful,
225 or false to signal an error."
229 (build-system trivial-build-system)
231 `(#:guile ,%bootstrap-guile
232 #:modules ((guix build utils))
235 (use-modules (guix build utils))
237 (let ((out (assoc-ref %outputs "out"))
238 (tar (assoc-ref %build-inputs "tar"))
239 (xz (assoc-ref %build-inputs "xz"))
240 (tarball (assoc-ref %build-inputs "tarball")))
243 (copy-file tarball "binaries.tar.xz")
244 (invoke xz "-d" "binaries.tar.xz")
245 (let ((builddir (getcwd)))
246 (with-directory-excursion out
248 (string-append builddir "/binaries.tar"))
249 ,@(if snippet (list snippet) '())
250 (or (not ,program-to-test)
251 (invoke (string-append "bin/" ,program-to-test)
254 `(("tar" ,(bootstrap-executable "tar" (%current-system)))
255 ("xz" ,(bootstrap-executable "xz" (%current-system)))
256 ("tarball" ,(bootstrap-origin (source (%current-system))))))
258 (synopsis description)
259 (description description)
263 (define package-with-bootstrap-guile
265 "Return a variant of P such that all its origins are fetched with
267 (define rewritten-input
269 ((name (? origin? o))
270 `(,name ,(bootstrap-origin o)))
271 ((name (? package? p) sub-drvs ...)
272 `(,name ,(package-with-bootstrap-guile p) ,@sub-drvs))
276 (source (match (package-source p)
277 ((? origin? o) (bootstrap-origin o))
279 (inputs (map rewritten-input
281 (native-inputs (map rewritten-input
282 (package-native-inputs p)))
283 (propagated-inputs (map rewritten-input
284 (package-propagated-inputs p)))
285 (replacement (and=> (package-replacement p)
286 package-with-bootstrap-guile)))))
288 (define* (glibc-dynamic-linker
289 #:optional (system (or (and=> (%current-target-system)
290 gnu-triplet->nix-system)
292 "Return the name of Glibc's dynamic linker for SYSTEM."
293 ;; See the 'SYSDEP_KNOWN_INTERPRETER_NAMES' cpp macro in libc.
294 (cond ((string=? system "x86_64-linux") "/lib/ld-linux-x86-64.so.2")
295 ((string=? system "i686-linux") "/lib/ld-linux.so.2")
296 ((string=? system "armhf-linux") "/lib/ld-linux-armhf.so.3")
297 ((string=? system "mips64el-linux") "/lib/ld.so.1")
298 ((string=? system "i586-gnu") "/lib/ld.so.1")
299 ((string=? system "i686-gnu") "/lib/ld.so.1")
300 ((string=? system "aarch64-linux") "/lib/ld-linux-aarch64.so.1")
301 ((string=? system "powerpc-linux") "/lib/ld.so.1")
302 ((string=? system "powerpc64-linux") "/lib/ld64.so.1")
303 ((string=? system "powerpc64le-linux") "/lib/ld64.so.2")
304 ((string=? system "alpha-linux") "/lib/ld-linux.so.2")
305 ((string=? system "s390x-linux") "/lib/ld64.so.1")
306 ((string=? system "riscv64-linux") "/lib/ld-linux-riscv64-lp64d.so.1")
308 ;; XXX: This one is used bare-bones, without a libc, so add a case
309 ;; here just so we can keep going.
310 ((string=? system "arm-elf") "no-ld.so")
311 ((string=? system "arm-eabi") "no-ld.so")
312 ((string=? system "xtensa-elf") "no-ld.so")
313 ((string=? system "avr") "no-ld.so")
314 ((string=? system "propeller-elf") "no-ld.so")
315 ((string=? system "i686-mingw") "no-ld.so")
316 ((string=? system "x86_64-mingw") "no-ld.so")
317 ((string=? system "vc4-elf") "no-ld.so")
319 (else (error "dynamic linker name not known for this system"
324 ;;; Bootstrap packages.
327 (define %bootstrap-base-urls
328 ;; This is where the initial binaries come from.
329 '("https://ftp.gnu.org/gnu/guix/bootstrap"
330 "https://alpha.gnu.org/gnu/guix/bootstrap"
331 "http://ftp.gnu.org/gnu/guix/bootstrap"
332 "http://alpha.gnu.org/gnu/guix/bootstrap"
333 "ftp://alpha.gnu.org/gnu/guix/bootstrap"
334 "http://www.fdn.fr/~lcourtes/software/guix/packages"
335 "http://flashner.co.il/guix/bootstrap"
336 "http://lilypond.org/janneke/guix/"))
338 (define (bootstrap-guile-url-path system)
339 "Return the URI for FILE."
340 (string-append "/" system
343 "/20170217/guile-2.0.14.tar.xz")
345 "/20150101/guile-2.0.11.tar.xz")
347 "/20200326/guile-static-stripped-2.0.14-i586-pc-gnu.tar.xz")
349 "/20210106/guile-static-stripped-2.0.14-powerpc64le-linux-gnu.tar.xz")
351 "/20131110/guile-2.0.9.tar.xz"))))
353 (define (bootstrap-guile-hash system)
354 "Return the SHA256 hash of the Guile bootstrap tarball for SYSTEM."
357 (base32 "1w2p5zyrglzzniqgvyn1b55vprfzhgk8vzbzkkbdgl5248si0yq3"))
359 (base32 "0im800m30abgh7msh331pcbjvb4n02smz5cfzf1srv0kpx3csmxp"))
361 (base32 "0fzp93lvi0hn54acc0fpvhc7bvl0yc853k62l958cihk03q80ilr"))
363 (base32 "1mi3brl7l58aww34rawhvja84xc7l1b4hmwdmc36fp9q9mfx0lg5"))
365 (base32 "1rnyfz5q38jyvxddj617443bnnzql4vw0mxzqpj8wz48wx4bhbq0"))
367 (base32 "1giy2aprjmn5fp9c4s9r125fljw4wv6ixy5739i5bffw4jgr0f9r"))
369 (base32 "0wgqpsmvg25rnqn49ap7kwd2qxccd8dr4lllzp7i3rjvgav27vac"))))
371 (define (bootstrap-guile-origin system)
372 "Return an <origin> object for the Guile tarball of SYSTEM."
375 (uri (map (cute string-append <> (bootstrap-guile-url-path system))
376 %bootstrap-base-urls))
377 (sha256 (bootstrap-guile-hash system))))
379 (define (download-bootstrap-guile store system)
380 "Return a derivation that downloads the bootstrap Guile tarball for SYSTEM."
381 (let* ((path (bootstrap-guile-url-path system))
382 (base (basename path))
383 (urls (map (cut string-append <> path) %bootstrap-base-urls)))
384 (run-with-store store
385 (url-fetch urls 'sha256 (bootstrap-guile-hash system)
388 (define* (raw-build store name inputs
389 #:key outputs system search-paths
391 (define (->store file)
392 (run-with-store store
393 (lower-object (bootstrap-executable file system)
396 (let* ((tar (->store "tar"))
398 (mkdir (->store "mkdir"))
399 (bash (->store "bash"))
400 (guile (download-bootstrap-guile store system))
401 ;; The following code, run by the bootstrap guile after it is
402 ;; unpacked, creates a wrapper for itself to set its load path.
403 ;; This replaces the previous non-portable method based on
404 ;; reading the /proc/self/exe symlink.
407 (use-modules (ice-9 match))
408 (match (command-line)
410 (let ((bin-dir (string-append out "/bin"))
411 (guile (string-append out "/bin/guile"))
412 (guile-real (string-append out "/bin/.guile-real"))
413 ;; We must avoid using a bare dollar sign in this code,
414 ;; because it would be interpreted by the shell.
415 (dollar (string (integer->char 36))))
416 (chmod bin-dir #o755)
417 (rename-file guile guile-real)
418 (call-with-output-file guile
422 export GUILE_SYSTEM_PATH=~a/share/guile/2.0
423 export GUILE_SYSTEM_COMPILED_PATH=~a/lib/guile/2.0/ccache
424 exec -a \"~a0\" ~a \"~a@\"\n"
425 bash out out dollar guile-real dollar)))
427 (chmod bin-dir #o555))))))
429 (add-text-to-store store
430 "build-bootstrap-guile.sh"
432 echo \"unpacking bootstrap Guile to '$out'...\"
435 ~a -dc < $GUILE_TARBALL | ~a xv
437 # Use the bootstrap guile to create its own wrapper to set the load path.
438 GUILE_SYSTEM_PATH=$out/share/guile/2.0 \
439 GUILE_SYSTEM_COMPILED_PATH=$out/lib/guile/2.0/ccache \
440 $out/bin/guile -c ~s $out ~a
443 $out/bin/guile --version~%"
444 (derivation->output-path mkdir)
445 (derivation->output-path xz)
446 (derivation->output-path tar)
447 (format #f "~s" make-guile-wrapper)
448 (derivation->output-path bash)))))
449 (derivation store name
450 (derivation->output-path bash) `(,builder)
452 #:inputs (map derivation-input
453 (list bash mkdir tar xz guile))
454 #:sources (list builder)
455 #:env-vars `(("GUILE_TARBALL"
456 . ,(derivation->output-path guile))))))
458 (define* (make-raw-bag name
459 #:key source inputs native-inputs outputs
464 (build-inputs inputs)
467 (define %bootstrap-guile
468 ;; The Guile used to run the build scripts of the initial derivations.
469 ;; It is just unpacked from a tarball containing a pre-built binary.
470 ;; This is typically built using %GUILE-BOOTSTRAP-TARBALL below.
472 ;; XXX: Would need libc's `libnss_files2.so' for proper `getaddrinfo'
473 ;; support (for /etc/services).
474 (let ((raw (build-system
476 (description "Raw build system with direct store access")
477 (lower make-raw-bag))))
479 (name "guile-bootstrap")
483 (synopsis "Bootstrap Guile")
484 (description "Pre-built Guile for bootstrapping purposes.")
488 (define %bootstrap-coreutils&co
489 (package-from-tarball "bootstrap-binaries"
493 (uri (map (cut string-append <> "/" system
496 "/20150101/static-binaries.tar.xz")
498 "/20170217/static-binaries.tar.xz")
500 "/20210106/static-binaries-0-powerpc64le-linux-gnu.tar.xz")
502 "/20200326/static-binaries-0-i586-pc-gnu.tar.xz")
504 "/20131110/static-binaries.tar.xz")))
505 %bootstrap-base-urls))
510 "0c533p9dhczzcsa1117gmfq3pc8w362g4mx84ik36srpr7cx2bg4"))
513 "0s5b3jb315n13m1k8095l0a5hfrsz8g0fv1b6riyc5hnxqyphlak"))
516 "0gf0fn2kbpxkjixkmx5f4z6hv6qpmgixl69zgg74dbsfdfj8jdv5"))
519 "18dfiq6c6xhsdpbidigw6480wh0vdgsxqq3xindq4lpdgqlccpfh"))
522 "0afs2j9z2d1hjq42myz4iwjh0aqgzf59inifw87x6b6p1z9wv92v"))
525 "17kllqnf3fg79gzy9ansgi801c46yh9c23h4d923plvb0nfm1cfn"))
528 "072y4wyfsj1bs80r6vbybbafy8ya4vfy7qj25dklwk97m6g71753"))))))
529 "fgrep" ; the program to test
530 "Bootstrap binaries of Coreutils, Awk, etc."
532 '(let ((path (list (string-append (getcwd) "/bin"))))
534 (patch-shebang "bin/egrep" path)
535 (patch-shebang "bin/fgrep" path)
536 ;; Starting with grep@2.25 'egrep' and 'fgrep' are shell files
537 ;; that call 'grep'. If the bootstrap 'egrep' and 'fgrep'
538 ;; are not binaries then patch them to execute 'grep' via its
539 ;; absolute file name instead of searching for it in $PATH.
540 (if (not (elf-file? "bin/egrep"))
541 (substitute* '("bin/egrep" "bin/fgrep")
542 (("^exec grep") (string-append (getcwd) "/bin/grep"))))
543 (chmod "bin" #o555))))
545 (define-public %bootstrap-linux-libre-headers
546 (package-from-tarball
547 "linux-libre-headers-bootstrap"
551 (uri (map (cute string-append <>
552 "/i686-linux/20190815/"
553 "linux-libre-headers-stripped-4.14.67-i686-linux.tar.xz")
554 %bootstrap-base-urls))
557 "0sm2z9x4wk45bh6qfs94p0w1d6hsy6dqx9sw38qsqbvxwa1qzk8s"))))
558 #f ; no program to test
559 "Bootstrap linux-libre-headers"))
561 (define %bootstrap-binutils
562 (package-from-tarball "binutils-bootstrap"
566 (uri (map (cut string-append <> "/" system
569 "/20150101/binutils-2.25.tar.xz")
571 "/20170217/binutils-2.27.tar.xz")
573 "/20210106/binutils-static-stripped-2.34-powerpc64le-linux-gnu.tar.xz")
575 "/20200326/binutils-static-stripped-2.34-i586-pc-gnu.tar.xz")
577 "/20131110/binutils-2.23.2.tar.xz")))
578 %bootstrap-base-urls))
583 "1j5yivz7zkjqfsfmxzrrrffwyayjqyfxgpi89df0w4qziqs2dg20"))
586 "14jgwf9gscd7l2pnz610b1zia06dvcm2qyzvni31b8zpgmcai2v9"))
589 "1v7dj6bzn6m36f20gw31l99xaabq4xrhrx3gwqkhhig0mdlmr69q"))
592 "111s7ilfiby033rczc71797xrmaa3qlv179wdvsaq132pd51xv3n"))
595 "1klxy945c61134mzhqzz2gbk8w0n8jq7arwkrvz78d22ff2q0cwz"))
598 "11kykv1kmqc5wln57rs4klaqa13hm952smkc57qcsyss21kfjprs"))
601 "1x8kkhcxmfyzg1ddpz2pxs6fbdl6412r7x0nzbmi5n7mj8zw2gy7"))))))
602 "ld" ; the program to test
603 "Bootstrap binaries of the GNU Binutils"))
605 (define %bootstrap-glibc
608 (name "glibc-bootstrap")
611 (build-system trivial-build-system)
613 `(#:guile ,%bootstrap-guile
614 #:modules ((guix build utils))
617 (use-modules (guix build utils))
619 (let ((out (assoc-ref %outputs "out"))
620 (tar (assoc-ref %build-inputs "tar"))
621 (xz (assoc-ref %build-inputs "xz"))
622 (tarball (assoc-ref %build-inputs "tarball")))
625 (copy-file tarball "binaries.tar.xz")
626 (invoke xz "-d" "binaries.tar.xz")
627 (let ((builddir (getcwd)))
628 (with-directory-excursion out
630 (string-append builddir
634 ;; Patch libc.so so it refers to the right path.
635 (substitute* "lib/libc.so"
636 (("/[^ ]+/lib/(libc|ld)" _ prefix)
637 (string-append out "/lib/" prefix)))
641 `(("tar" ,(bootstrap-executable "tar" (%current-system)))
642 ("xz" ,(bootstrap-executable "xz" (%current-system)))
643 ("tarball" ,(bootstrap-origin
646 (uri (map (cut string-append <> "/" (%current-system)
647 (match (%current-system)
649 "/20150101/glibc-2.20.tar.xz")
651 "/20170217/glibc-2.25.tar.xz")
653 "/20210106/glibc-stripped-2.31-powerpc64le-linux-gnu.tar.xz")
655 "/20200326/glibc-stripped-2.31-i586-pc-gnu.tar.xz")
657 "/20131110/glibc-2.18.tar.xz")))
658 %bootstrap-base-urls))
660 (match (%current-system)
663 "0jlqrgavvnplj1b083s20jj9iddr4lzfvwybw5xrcis9spbfzk7v"))
666 "1hgrccw1zqdc7lvgivwa54d9l3zsim5pqm0dykxg0z522h6gr05w"))
669 "18cmgvpllqfpn6khsmivqib7ys8ymnq0hdzi3qp24prik0ykz8gn"))
672 "07nx3x8598i2924rjnlrncg6rm61c9bmcczbbcpbx0fb742nvv5c"))
675 "1a1df6z8gkaq09md3jy94lixnh20599p58p0s856p10xwjaqr1iz"))
678 "14ddm10lpbas8bankmn5bcrlqvz1v5dnn1qjzxb19r57vd2w5952"))
681 "0k97a3whzx3apsi9n2cbsrr79ad6lh00klxph9hw4fqyp1abkdsg")))))))))
682 (synopsis "Bootstrap binaries and headers of the GNU C Library")
683 (description synopsis)
687 (define %bootstrap-gcc
688 ;; The initial GCC. Uses binaries from a tarball typically built by
689 ;; %GCC-BOOTSTRAP-TARBALL.
691 (name "gcc-bootstrap")
694 (build-system trivial-build-system)
696 `(#:guile ,%bootstrap-guile
697 #:modules ((guix build utils))
700 (use-modules (guix build utils)
703 (let ((out (assoc-ref %outputs "out"))
704 (tar (assoc-ref %build-inputs "tar"))
705 (xz (assoc-ref %build-inputs "xz"))
706 (bash (assoc-ref %build-inputs "bash"))
707 (libc (assoc-ref %build-inputs "libc"))
708 (tarball (assoc-ref %build-inputs "tarball")))
711 (copy-file tarball "binaries.tar.xz")
712 (invoke xz "-d" "binaries.tar.xz")
713 (let ((builddir (getcwd))
714 (bindir (string-append out "/bin")))
715 (with-directory-excursion out
717 (string-append builddir "/binaries.tar")))
719 (with-directory-excursion bindir
721 (rename-file "gcc" ".gcc-wrapped")
722 (call-with-output-file "gcc"
725 exec ~a/bin/.gcc-wrapped -B~a/lib \
726 -Wl,-rpath -Wl,~a/lib \
727 -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
730 ,(glibc-dynamic-linker))))
735 `(("tar" ,(bootstrap-executable "tar" (%current-system)))
736 ("xz" ,(bootstrap-executable "xz" (%current-system)))
737 ("bash" ,(bootstrap-executable "bash" (%current-system)))
738 ("libc" ,%bootstrap-glibc)
739 ("tarball" ,(bootstrap-origin
742 (uri (map (cut string-append <> "/" (%current-system)
743 (match (%current-system)
745 "/20150101/gcc-4.8.4.tar.xz")
747 "/20170217/gcc-5.4.0.tar.xz")
749 "/20210106/gcc-stripped-5.5.0-powerpc64le-linux-gnu.tar.xz")
751 "/20200326/gcc-stripped-5.5.0-i586-pc-gnu.tar.xz")
753 "/20131110/gcc-4.8.2.tar.xz")))
754 %bootstrap-base-urls))
756 (match (%current-system)
759 "17ga4m6195n4fnbzdkmik834znkhs53nkypp6557pl1ps7dgqbls"))
762 "150c1arrf2k8vfy6dpxh59vcgs4p1bgiz2av5m19dynpks7rjnyw"))
765 "0ghz825yzp43fxw53kd6afm8nkz16f7dxi9xi40bfwc8x3nbbr8v"))
768 "1ar3vdzyqbfm0z36kmvazvfswxhcihlacl2dzdjgiq25cqnq9ih1"))
771 "151kjsai25vz2s667bgzpisx8f281fpl3n9pxz2yrp9jlnadz3m1"))
774 "1j2zc58wzil71a34h7c70sd68dmqvcscrw3rmn2whq79vd70zvv5"))
777 "1m5miqkyng45l745n0sfafdpjkqv9225xf44jqkygwsipj2cv9ks")))))))))
779 (list (search-path-specification
781 (files '("include")))
782 (search-path-specification
783 (variable "LIBRARY_PATH")
784 (files '("lib" "lib64")))))
785 (synopsis "Bootstrap binaries of the GNU Compiler Collection")
786 (description synopsis)
790 (define %bootstrap-mescc-tools
791 ;; The initial MesCC tools. Uses binaries from a tarball typically built by
792 ;; %MESCC-TOOLS-BOOTSTRAP-TARBALL.
794 (name "bootstrap-mescc-tools")
797 (build-system trivial-build-system)
799 `(#:guile ,%bootstrap-guile
800 #:modules ((guix build utils))
803 (use-modules (guix build utils)
805 (let ((out (assoc-ref %outputs "out"))
806 (tar (assoc-ref %build-inputs "tar"))
807 (xz (assoc-ref %build-inputs "xz"))
808 (tarball (assoc-ref %build-inputs "tarball")))
811 (copy-file tarball "binaries.tar.xz")
812 (invoke xz "-d" "binaries.tar.xz")
813 (let ((builddir (getcwd))
814 (bindir (string-append out "/bin")))
815 (with-directory-excursion out
817 (string-append builddir "/binaries.tar"))))))))
819 `(("tar" ,(bootstrap-executable "tar" (%current-system)))
820 ("xz" ,(bootstrap-executable "xz" (%current-system)))
826 (cute string-append <>
827 "/i686-linux/20190815/"
828 "mescc-tools-static-stripped-0.5.2-i686-linux.tar.xz")
829 %bootstrap-base-urls))
832 "0c3kklgghzh4q2dbpl6asb74cimp7hp6jscdwqwmzxbapgcl6582")))))))
833 (synopsis "Bootstrap binaries of MesCC Tools")
834 (description synopsis)
836 (supported-systems '("i686-linux" "x86_64-linux"))
839 (define %bootstrap-mes
840 ;; The initial Mes. Uses binaries from a tarball typically built by
841 ;; %MES-BOOTSTRAP-TARBALL.
843 (name "bootstrap-mes")
846 (build-system trivial-build-system)
848 `(#:guile ,%bootstrap-guile
849 #:modules ((guix build utils))
852 (use-modules (guix build utils)
854 (let ((out (assoc-ref %outputs "out"))
855 (tar (assoc-ref %build-inputs "tar"))
856 (xz (assoc-ref %build-inputs "xz"))
857 (tarball (assoc-ref %build-inputs "tarball")))
860 (copy-file tarball "binaries.tar.xz")
861 (invoke xz "-d" "binaries.tar.xz")
862 (let ((builddir (getcwd))
863 (bindir (string-append out "/bin")))
864 (with-directory-excursion out
866 (string-append builddir "/binaries.tar"))))))))
868 `(("tar" ,(bootstrap-executable "tar" (%current-system)))
869 ("xz" ,(bootstrap-executable "xz" (%current-system)))
875 (cute string-append <>
876 "/i686-linux/20190815/"
877 "mes-minimal-stripped-0.19-i686-linux.tar.xz")
878 %bootstrap-base-urls))
881 "1q4xjpx6nbn44kxnilpgl12bhpmwy2bblzwszc2ci7xkf400jcpv")))))))
882 (supported-systems '("i686-linux" "x86_64-linux"))
883 (synopsis "Bootstrap binaries of Mes")
884 (description synopsis)
888 (define (%bootstrap-inputs)
889 ;; The initial, pre-built inputs. From now on, we can start building our
891 (match (%current-system)
892 ((or "i686-linux" "x86_64-linux")
893 `(("linux-libre-headers" ,%bootstrap-linux-libre-headers)
894 ("bootstrap-mescc-tools" ,%bootstrap-mescc-tools)
895 ("mes" ,%bootstrap-mes)))
897 `(("libc" ,%bootstrap-glibc)
898 ("gcc" ,%bootstrap-gcc)
899 ("binutils" ,%bootstrap-binutils)
900 ("coreutils&co" ,%bootstrap-coreutils&co)
901 ;; In gnu-build-system.scm, we rely on the availability of Bash.
902 ("bash" ,%bootstrap-coreutils&co)))))
904 (define %bootstrap-inputs-for-tests
905 ;; These are bootstrap inputs that are cheap to produce (no compilation
906 ;; needed) and that are meant to be used for testing. (These are those we
907 ;; used before the Mes-based reduced bootstrap.)
908 `(("libc" ,%bootstrap-glibc)
909 ("gcc" ,%bootstrap-gcc)
910 ("binutils" ,%bootstrap-binutils)
911 ("coreutils&co" ,%bootstrap-coreutils&co)
912 ("bash" ,%bootstrap-coreutils&co)))
914 ;;; bootstrap.scm ends here