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>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages bootstrap)
25 #:use-module (guix licenses)
26 #:use-module (gnu packages)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix build-system)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system trivial)
32 #:use-module ((guix store)
33 #:select (run-with-store add-to-store add-text-to-store))
34 #:use-module ((guix derivations)
35 #:select (derivation derivation-input derivation->output-path))
36 #:use-module ((guix utils) #:select (gnu-triplet->nix-system))
37 #:use-module ((guix gexp) #:select (lower-object))
38 #:use-module (guix memoization)
39 #:use-module (guix i18n)
40 #:use-module (srfi srfi-1)
41 #:use-module (srfi srfi-26)
42 #:use-module (srfi srfi-34)
43 #:use-module (srfi srfi-35)
44 #:use-module (ice-9 match)
45 #:export (bootstrap-origin
46 package-with-bootstrap-guile
50 bootstrap-guile-origin
53 %bootstrap-coreutils&co
54 %bootstrap-linux-libre-headers
59 %bootstrap-mescc-tools
62 %bootstrap-inputs-for-tests))
66 ;;; Pre-built packages that are used to bootstrap the
67 ;;; distribution--i.e., to build all the core packages from scratch.
74 ;;; The bootstrap executables: 'bash', 'mkdir', 'tar', 'xz'. They allow us to
75 ;;; extract the very first tarball.
78 (define %bootstrap-executables
79 ;; List of bootstrap executables and their recursive hashes (as per 'guix
80 ;; hash -r'), taking their executable bit into account.
83 ,(base32 "13aqhqb8nydlwq1ah9974q0iadx1pb95v13wzzyf7vgv6nasrwzr"))
85 ,(base32 "1pxhdp7ldwavmm71xbh9wc197cb2nr66acjn26yjx3732cixh9ws"))
87 ,(base32 "1j51gv08sfg277yxj73xd564wjq3f8xwd6s9rbcg8v9gms47m4cx"))
89 ,(base32 "1d779rwsrasphg5g3r37qppcqy3p7ay1jb1y83w7x4i3qsc7zjy2")))
92 ,(base32 "0s6f1s26g4dsrrkl39zblvwpxmbzi6n9mgqf6vxsqz42gik6bgyn"))
94 ,(base32 "1r5rcp35niyxfkrdf00y2ba8ifrq9bi76cr63lwjf2l655j1i5p7"))
96 ,(base32 "0dksx5im3fv8ximz7368bsax9f26nn47ds74298flm5lnvpv9xly"))
98 ,(base32 "1cqqavghjfr0iwxqf61lrssv27wfigysgq2rs4rm1gkmn04yn1k3")))
101 ,(base32 "0rjaxyzjdllfkf1abczvgaf3cdcc7mmahyvdbkjmjzhgz92pv23g"))
103 ,(base32 "133ybmfpkmsnysrzbngwvbysqnsmfi8is8zifs7i7n6n600h4s1w"))
105 ,(base32 "07830bx29ad5i0l1ykj0g0b1jayjdblf01sr3ww9wbnwdbzinqms"))
107 ,(base32 "0i9kxdi17bm5gxfi2xzm0y73p3ii0cqxli1sbljm6rh2fjgyn90k")))
110 ,(base32 "1as8649aqaibahhhrvkj10ci8shpi4hq5n7gnik8rhhy0dc1jarg"))
112 ,(base32 "1snqgpfrl00hfn82lm29jqylzjsfb9jd6ha74dp12phwb8fpbmb9"))
114 ,(base32 "0nq2c1zb3wv5bf7kd83sziaashydazrn7xgq6kijlk0zj2syzc2m"))
116 ,(base32 "033rhpk6zrpxpd6ffjyg5y2zwq9x9cnq0zljb7k8jlncbalsayq5")))
119 ,(base32 "1aw046dhda240k9pb9iaj5aqkm23gkvxa9j82n4k7fk87nbrixw6"))
121 ,(base32 "0c9j6qgyw84zxbry3ypifzll13gy8ax71w40kdk1h11jbgla3f5k"))
123 ,(base32 "06gmqdjq3rl8lr47b9fyx4ifnm5x56ymc8lyryp1ax1j2s4y5jb4"))
125 ,(base32 "09j1d69qr0hhhx4k4ih8wp00dfc9y4rp01hfg3vc15yxd0jxabh5")))))
127 (define %bootstrap-executable-base-urls
128 ;; This is where the bootstrap executables come from.
129 '("https://git.savannah.gnu.org/cgit/guix.git/plain/gnu/packages/bootstrap/"
130 "http://lilypond.org/janneke/guix/"))
132 (define (bootstrap-executable-file-name system program)
133 "Return the FILE-NAME part of url where PROGRAM can be found for SYSTEM."
135 ("i586-gnu" (string-append system "/20200326/" program))
136 (_ (string-append system "/" program
137 "?id=44f07d1dc6806e97c4e9ee3e6be883cc59dc666e"))))
139 (define bootstrap-executable
140 (mlambda (program system)
141 "Return an origin for PROGRAM, a statically-linked bootstrap executable
143 (let ((system (if (string=? system "x86_64-linux")
146 (match (assoc-ref (assoc-ref %bootstrap-executables system)
152 (format #f (G_ "could not find bootstrap binary '~a' \
157 (method url-fetch/executable)
158 (uri (map (cute string-append <>
159 (bootstrap-executable-file-name system program))
160 %bootstrap-executable-base-urls))
162 (hash (content-hash bv sha256))))))))
166 ;;; Helper procedures.
169 (define bootstrap-origin
171 "Return a variant of SOURCE, an <origin> instance, whose method uses
172 %BOOTSTRAP-GUILE to do its job."
174 (lambda* (url hash-algo hash
175 #:optional name #:key system)
176 (fetch url hash-algo hash name
177 #:guile %bootstrap-guile
180 (define %bootstrap-patch-inputs
181 ;; Packages used when an <origin> has a non-empty 'patches' field.
182 `(("tar" ,%bootstrap-coreutils&co)
183 ("xz" ,%bootstrap-coreutils&co)
184 ("bzip2" ,%bootstrap-coreutils&co)
185 ("gzip" ,%bootstrap-coreutils&co)
186 ("patch" ,%bootstrap-coreutils&co)))
188 (let ((orig-method (origin-method source)))
189 (if (or (not (null? (origin-patches source)))
190 (origin-snippet source))
191 (origin (inherit source)
192 (method (if (eq? orig-method url-fetch)
195 (patch-guile %bootstrap-guile)
196 (patch-inputs %bootstrap-patch-inputs)
198 ;; Patches can be origins as well, so process them.
199 (patches (map (match-lambda
201 (bootstrap-origin patch))
203 (origin-patches source))))
206 (define* (package-from-tarball name source program-to-test description
208 "Return a package that correspond to the extraction of SOURCE.
209 PROGRAM-TO-TEST is #f or a string: the program to run after extraction of
210 SOURCE to check whether everything is alright. If SNIPPET is provided, it is
211 evaluated after extracting SOURCE. SNIPPET should return true if successful,
212 or false to signal an error."
216 (build-system trivial-build-system)
218 `(#:guile ,%bootstrap-guile
219 #:modules ((guix build utils))
222 (use-modules (guix build utils))
224 (let ((out (assoc-ref %outputs "out"))
225 (tar (assoc-ref %build-inputs "tar"))
226 (xz (assoc-ref %build-inputs "xz"))
227 (tarball (assoc-ref %build-inputs "tarball")))
230 (copy-file tarball "binaries.tar.xz")
231 (invoke xz "-d" "binaries.tar.xz")
232 (let ((builddir (getcwd)))
233 (with-directory-excursion out
235 (string-append builddir "/binaries.tar"))
236 ,@(if snippet (list snippet) '())
237 (or (not ,program-to-test)
238 (invoke (string-append "bin/" ,program-to-test)
241 `(("tar" ,(bootstrap-executable "tar" (%current-system)))
242 ("xz" ,(bootstrap-executable "xz" (%current-system)))
243 ("tarball" ,(bootstrap-origin (source (%current-system))))))
245 (synopsis description)
246 (description description)
250 (define package-with-bootstrap-guile
252 "Return a variant of P such that all its origins are fetched with
254 (define rewritten-input
256 ((name (? origin? o))
257 `(,name ,(bootstrap-origin o)))
258 ((name (? package? p) sub-drvs ...)
259 `(,name ,(package-with-bootstrap-guile p) ,@sub-drvs))
263 (source (match (package-source p)
264 ((? origin? o) (bootstrap-origin o))
266 (inputs (map rewritten-input
268 (native-inputs (map rewritten-input
269 (package-native-inputs p)))
270 (propagated-inputs (map rewritten-input
271 (package-propagated-inputs p)))
272 (replacement (and=> (package-replacement p)
273 package-with-bootstrap-guile)))))
275 (define* (glibc-dynamic-linker
276 #:optional (system (or (and=> (%current-target-system)
277 gnu-triplet->nix-system)
279 "Return the name of Glibc's dynamic linker for SYSTEM."
280 ;; See the 'SYSDEP_KNOWN_INTERPRETER_NAMES' cpp macro in libc.
281 (cond ((string=? system "x86_64-linux") "/lib/ld-linux-x86-64.so.2")
282 ((string=? system "i686-linux") "/lib/ld-linux.so.2")
283 ((string=? system "armhf-linux") "/lib/ld-linux-armhf.so.3")
284 ((string=? system "mips64el-linux") "/lib/ld.so.1")
285 ((string=? system "i586-gnu") "/lib/ld.so.1")
286 ((string=? system "i686-gnu") "/lib/ld.so.1")
287 ((string=? system "aarch64-linux") "/lib/ld-linux-aarch64.so.1")
288 ((string=? system "powerpc-linux") "/lib/ld.so.1")
289 ((string=? system "powerpc64-linux") "/lib/ld64.so.1")
290 ((string=? system "powerpc64le-linux") "/lib/ld64.so.2")
291 ((string=? system "alpha-linux") "/lib/ld-linux.so.2")
292 ((string=? system "s390x-linux") "/lib/ld64.so.1")
293 ((string=? system "riscv64-linux") "/lib/ld-linux-riscv64-lp64d.so.1")
295 ;; XXX: This one is used bare-bones, without a libc, so add a case
296 ;; here just so we can keep going.
297 ((string=? system "arm-elf") "no-ld.so")
298 ((string=? system "arm-eabi") "no-ld.so")
299 ((string=? system "xtensa-elf") "no-ld.so")
300 ((string=? system "avr") "no-ld.so")
301 ((string=? system "propeller-elf") "no-ld.so")
302 ((string=? system "i686-mingw") "no-ld.so")
303 ((string=? system "x86_64-mingw") "no-ld.so")
304 ((string=? system "vc4-elf") "no-ld.so")
306 (else (error "dynamic linker name not known for this system"
311 ;;; Bootstrap packages.
314 (define %bootstrap-base-urls
315 ;; This is where the initial binaries come from.
316 '("https://ftp.gnu.org/gnu/guix/bootstrap"
317 "https://alpha.gnu.org/gnu/guix/bootstrap"
318 "http://ftp.gnu.org/gnu/guix/bootstrap"
319 "http://alpha.gnu.org/gnu/guix/bootstrap"
320 "ftp://alpha.gnu.org/gnu/guix/bootstrap"
321 "http://www.fdn.fr/~lcourtes/software/guix/packages"
322 "http://flashner.co.il/guix/bootstrap"
323 "http://lilypond.org/janneke/guix/"))
325 (define (bootstrap-guile-url-path system)
326 "Return the URI for FILE."
327 (string-append "/" system
330 "/20170217/guile-2.0.14.tar.xz")
332 "/20150101/guile-2.0.11.tar.xz")
334 "/20200326/guile-static-stripped-2.0.14-i586-pc-gnu.tar.xz")
336 "/20131110/guile-2.0.9.tar.xz"))))
338 (define (bootstrap-guile-hash system)
339 "Return the SHA256 hash of the Guile bootstrap tarball for SYSTEM."
342 (base32 "1w2p5zyrglzzniqgvyn1b55vprfzhgk8vzbzkkbdgl5248si0yq3"))
344 (base32 "0im800m30abgh7msh331pcbjvb4n02smz5cfzf1srv0kpx3csmxp"))
346 (base32 "0fzp93lvi0hn54acc0fpvhc7bvl0yc853k62l958cihk03q80ilr"))
348 (base32 "1mi3brl7l58aww34rawhvja84xc7l1b4hmwdmc36fp9q9mfx0lg5"))
350 (base32 "1giy2aprjmn5fp9c4s9r125fljw4wv6ixy5739i5bffw4jgr0f9r"))
352 (base32 "0wgqpsmvg25rnqn49ap7kwd2qxccd8dr4lllzp7i3rjvgav27vac"))))
354 (define (bootstrap-guile-origin system)
355 "Return an <origin> object for the Guile tarball of SYSTEM."
358 (uri (map (cute string-append <> (bootstrap-guile-url-path system))
359 %bootstrap-base-urls))
360 (sha256 (bootstrap-guile-hash system))))
362 (define (download-bootstrap-guile store system)
363 "Return a derivation that downloads the bootstrap Guile tarball for SYSTEM."
364 (let* ((path (bootstrap-guile-url-path system))
365 (base (basename path))
366 (urls (map (cut string-append <> path) %bootstrap-base-urls)))
367 (run-with-store store
368 (url-fetch urls 'sha256 (bootstrap-guile-hash system)
371 (define* (raw-build store name inputs
372 #:key outputs system search-paths
374 (define (->store file)
375 (run-with-store store
376 (lower-object (bootstrap-executable file system)
379 (let* ((tar (->store "tar"))
381 (mkdir (->store "mkdir"))
382 (bash (->store "bash"))
383 (guile (download-bootstrap-guile store system))
384 ;; The following code, run by the bootstrap guile after it is
385 ;; unpacked, creates a wrapper for itself to set its load path.
386 ;; This replaces the previous non-portable method based on
387 ;; reading the /proc/self/exe symlink.
390 (use-modules (ice-9 match))
391 (match (command-line)
393 (let ((bin-dir (string-append out "/bin"))
394 (guile (string-append out "/bin/guile"))
395 (guile-real (string-append out "/bin/.guile-real"))
396 ;; We must avoid using a bare dollar sign in this code,
397 ;; because it would be interpreted by the shell.
398 (dollar (string (integer->char 36))))
399 (chmod bin-dir #o755)
400 (rename-file guile guile-real)
401 (call-with-output-file guile
405 export GUILE_SYSTEM_PATH=~a/share/guile/2.0
406 export GUILE_SYSTEM_COMPILED_PATH=~a/lib/guile/2.0/ccache
407 exec -a \"~a0\" ~a \"~a@\"\n"
408 bash out out dollar guile-real dollar)))
410 (chmod bin-dir #o555))))))
412 (add-text-to-store store
413 "build-bootstrap-guile.sh"
415 echo \"unpacking bootstrap Guile to '$out'...\"
418 ~a -dc < $GUILE_TARBALL | ~a xv
420 # Use the bootstrap guile to create its own wrapper to set the load path.
421 GUILE_SYSTEM_PATH=$out/share/guile/2.0 \
422 GUILE_SYSTEM_COMPILED_PATH=$out/lib/guile/2.0/ccache \
423 $out/bin/guile -c ~s $out ~a
426 $out/bin/guile --version~%"
427 (derivation->output-path mkdir)
428 (derivation->output-path xz)
429 (derivation->output-path tar)
430 (format #f "~s" make-guile-wrapper)
431 (derivation->output-path bash)))))
432 (derivation store name
433 (derivation->output-path bash) `(,builder)
435 #:inputs (map derivation-input
436 (list bash mkdir tar xz guile))
437 #:sources (list builder)
438 #:env-vars `(("GUILE_TARBALL"
439 . ,(derivation->output-path guile))))))
441 (define* (make-raw-bag name
442 #:key source inputs native-inputs outputs
447 (build-inputs inputs)
450 (define %bootstrap-guile
451 ;; The Guile used to run the build scripts of the initial derivations.
452 ;; It is just unpacked from a tarball containing a pre-built binary.
453 ;; This is typically built using %GUILE-BOOTSTRAP-TARBALL below.
455 ;; XXX: Would need libc's `libnss_files2.so' for proper `getaddrinfo'
456 ;; support (for /etc/services).
457 (let ((raw (build-system
459 (description "Raw build system with direct store access")
460 (lower make-raw-bag))))
462 (name "guile-bootstrap")
466 (synopsis "Bootstrap Guile")
467 (description "Pre-built Guile for bootstrapping purposes.")
471 (define %bootstrap-coreutils&co
472 (package-from-tarball "bootstrap-binaries"
476 (uri (map (cut string-append <> "/" system
479 "/20150101/static-binaries.tar.xz")
481 "/20170217/static-binaries.tar.xz")
483 "/20200326/static-binaries-0-i586-pc-gnu.tar.xz")
485 "/20131110/static-binaries.tar.xz")))
486 %bootstrap-base-urls))
491 "0c533p9dhczzcsa1117gmfq3pc8w362g4mx84ik36srpr7cx2bg4"))
494 "0s5b3jb315n13m1k8095l0a5hfrsz8g0fv1b6riyc5hnxqyphlak"))
497 "0gf0fn2kbpxkjixkmx5f4z6hv6qpmgixl69zgg74dbsfdfj8jdv5"))
500 "18dfiq6c6xhsdpbidigw6480wh0vdgsxqq3xindq4lpdgqlccpfh"))
503 "17kllqnf3fg79gzy9ansgi801c46yh9c23h4d923plvb0nfm1cfn"))
506 "072y4wyfsj1bs80r6vbybbafy8ya4vfy7qj25dklwk97m6g71753"))))))
507 "fgrep" ; the program to test
508 "Bootstrap binaries of Coreutils, Awk, etc."
510 '(let ((path (list (string-append (getcwd) "/bin"))))
512 (patch-shebang "bin/egrep" path)
513 (patch-shebang "bin/fgrep" path)
514 ;; Starting with grep@2.25 'egrep' and 'fgrep' are shell files
515 ;; that call 'grep'. If the bootstrap 'egrep' and 'fgrep'
516 ;; are not binaries then patch them to execute 'grep' via its
517 ;; absolute file name instead of searching for it in $PATH.
518 (if (not (elf-file? "bin/egrep"))
519 (substitute* '("bin/egrep" "bin/fgrep")
520 (("^exec grep") (string-append (getcwd) "/bin/grep"))))
521 (chmod "bin" #o555))))
523 (define-public %bootstrap-linux-libre-headers
524 (package-from-tarball
525 "linux-libre-headers-bootstrap"
529 (uri (map (cute string-append <>
530 "/i686-linux/20190815/"
531 "linux-libre-headers-stripped-4.14.67-i686-linux.tar.xz")
532 %bootstrap-base-urls))
535 "0sm2z9x4wk45bh6qfs94p0w1d6hsy6dqx9sw38qsqbvxwa1qzk8s"))))
536 #f ; no program to test
537 "Bootstrap linux-libre-headers"))
539 (define %bootstrap-binutils
540 (package-from-tarball "binutils-bootstrap"
544 (uri (map (cut string-append <> "/" system
547 "/20150101/binutils-2.25.tar.xz")
549 "/20170217/binutils-2.27.tar.xz")
551 "/20200326/binutils-static-stripped-2.34-i586-pc-gnu.tar.xz")
553 "/20131110/binutils-2.23.2.tar.xz")))
554 %bootstrap-base-urls))
559 "1j5yivz7zkjqfsfmxzrrrffwyayjqyfxgpi89df0w4qziqs2dg20"))
562 "14jgwf9gscd7l2pnz610b1zia06dvcm2qyzvni31b8zpgmcai2v9"))
565 "1v7dj6bzn6m36f20gw31l99xaabq4xrhrx3gwqkhhig0mdlmr69q"))
568 "111s7ilfiby033rczc71797xrmaa3qlv179wdvsaq132pd51xv3n"))
571 "11kykv1kmqc5wln57rs4klaqa13hm952smkc57qcsyss21kfjprs"))
574 "1x8kkhcxmfyzg1ddpz2pxs6fbdl6412r7x0nzbmi5n7mj8zw2gy7"))))))
575 "ld" ; the program to test
576 "Bootstrap binaries of the GNU Binutils"))
578 (define %bootstrap-glibc
581 (name "glibc-bootstrap")
584 (build-system trivial-build-system)
586 `(#:guile ,%bootstrap-guile
587 #:modules ((guix build utils))
590 (use-modules (guix build utils))
592 (let ((out (assoc-ref %outputs "out"))
593 (tar (assoc-ref %build-inputs "tar"))
594 (xz (assoc-ref %build-inputs "xz"))
595 (tarball (assoc-ref %build-inputs "tarball")))
598 (copy-file tarball "binaries.tar.xz")
599 (invoke xz "-d" "binaries.tar.xz")
600 (let ((builddir (getcwd)))
601 (with-directory-excursion out
603 (string-append builddir
607 ;; Patch libc.so so it refers to the right path.
608 (substitute* "lib/libc.so"
609 (("/[^ ]+/lib/(libc|ld)" _ prefix)
610 (string-append out "/lib/" prefix)))
614 `(("tar" ,(bootstrap-executable "tar" (%current-system)))
615 ("xz" ,(bootstrap-executable "xz" (%current-system)))
616 ("tarball" ,(bootstrap-origin
619 (uri (map (cut string-append <> "/" (%current-system)
620 (match (%current-system)
622 "/20150101/glibc-2.20.tar.xz")
624 "/20170217/glibc-2.25.tar.xz")
626 "/20200326/glibc-stripped-2.31-i586-pc-gnu.tar.xz")
628 "/20131110/glibc-2.18.tar.xz")))
629 %bootstrap-base-urls))
631 (match (%current-system)
634 "0jlqrgavvnplj1b083s20jj9iddr4lzfvwybw5xrcis9spbfzk7v"))
637 "1hgrccw1zqdc7lvgivwa54d9l3zsim5pqm0dykxg0z522h6gr05w"))
640 "18cmgvpllqfpn6khsmivqib7ys8ymnq0hdzi3qp24prik0ykz8gn"))
643 "07nx3x8598i2924rjnlrncg6rm61c9bmcczbbcpbx0fb742nvv5c"))
646 "14ddm10lpbas8bankmn5bcrlqvz1v5dnn1qjzxb19r57vd2w5952"))
649 "0k97a3whzx3apsi9n2cbsrr79ad6lh00klxph9hw4fqyp1abkdsg")))))))))
650 (synopsis "Bootstrap binaries and headers of the GNU C Library")
651 (description synopsis)
655 (define %bootstrap-gcc
656 ;; The initial GCC. Uses binaries from a tarball typically built by
657 ;; %GCC-BOOTSTRAP-TARBALL.
659 (name "gcc-bootstrap")
662 (build-system trivial-build-system)
664 `(#:guile ,%bootstrap-guile
665 #:modules ((guix build utils))
668 (use-modules (guix build utils)
671 (let ((out (assoc-ref %outputs "out"))
672 (tar (assoc-ref %build-inputs "tar"))
673 (xz (assoc-ref %build-inputs "xz"))
674 (bash (assoc-ref %build-inputs "bash"))
675 (libc (assoc-ref %build-inputs "libc"))
676 (tarball (assoc-ref %build-inputs "tarball")))
679 (copy-file tarball "binaries.tar.xz")
680 (invoke xz "-d" "binaries.tar.xz")
681 (let ((builddir (getcwd))
682 (bindir (string-append out "/bin")))
683 (with-directory-excursion out
685 (string-append builddir "/binaries.tar")))
687 (with-directory-excursion bindir
689 (rename-file "gcc" ".gcc-wrapped")
690 (call-with-output-file "gcc"
693 exec ~a/bin/.gcc-wrapped -B~a/lib \
694 -Wl,-rpath -Wl,~a/lib \
695 -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
698 ,(glibc-dynamic-linker))))
703 `(("tar" ,(bootstrap-executable "tar" (%current-system)))
704 ("xz" ,(bootstrap-executable "xz" (%current-system)))
705 ("bash" ,(bootstrap-executable "bash" (%current-system)))
706 ("libc" ,%bootstrap-glibc)
707 ("tarball" ,(bootstrap-origin
710 (uri (map (cut string-append <> "/" (%current-system)
711 (match (%current-system)
713 "/20150101/gcc-4.8.4.tar.xz")
715 "/20170217/gcc-5.4.0.tar.xz")
717 "/20200326/gcc-stripped-5.5.0-i586-pc-gnu.tar.xz")
719 "/20131110/gcc-4.8.2.tar.xz")))
720 %bootstrap-base-urls))
722 (match (%current-system)
725 "17ga4m6195n4fnbzdkmik834znkhs53nkypp6557pl1ps7dgqbls"))
728 "150c1arrf2k8vfy6dpxh59vcgs4p1bgiz2av5m19dynpks7rjnyw"))
731 "0ghz825yzp43fxw53kd6afm8nkz16f7dxi9xi40bfwc8x3nbbr8v"))
734 "1ar3vdzyqbfm0z36kmvazvfswxhcihlacl2dzdjgiq25cqnq9ih1"))
737 "1j2zc58wzil71a34h7c70sd68dmqvcscrw3rmn2whq79vd70zvv5"))
740 "1m5miqkyng45l745n0sfafdpjkqv9225xf44jqkygwsipj2cv9ks")))))))))
742 (list (search-path-specification
744 (files '("include")))
745 (search-path-specification
746 (variable "LIBRARY_PATH")
747 (files '("lib" "lib64")))))
748 (synopsis "Bootstrap binaries of the GNU Compiler Collection")
749 (description synopsis)
753 (define %bootstrap-mescc-tools
754 ;; The initial MesCC tools. Uses binaries from a tarball typically built by
755 ;; %MESCC-TOOLS-BOOTSTRAP-TARBALL.
757 (name "bootstrap-mescc-tools")
760 (build-system trivial-build-system)
762 `(#:guile ,%bootstrap-guile
763 #:modules ((guix build utils))
766 (use-modules (guix build utils)
768 (let ((out (assoc-ref %outputs "out"))
769 (tar (assoc-ref %build-inputs "tar"))
770 (xz (assoc-ref %build-inputs "xz"))
771 (tarball (assoc-ref %build-inputs "tarball")))
774 (copy-file tarball "binaries.tar.xz")
775 (invoke xz "-d" "binaries.tar.xz")
776 (let ((builddir (getcwd))
777 (bindir (string-append out "/bin")))
778 (with-directory-excursion out
780 (string-append builddir "/binaries.tar"))))))))
782 `(("tar" ,(bootstrap-executable "tar" (%current-system)))
783 ("xz" ,(bootstrap-executable "xz" (%current-system)))
789 (cute string-append <>
790 "/i686-linux/20190815/"
791 "mescc-tools-static-stripped-0.5.2-i686-linux.tar.xz")
792 %bootstrap-base-urls))
795 "0c3kklgghzh4q2dbpl6asb74cimp7hp6jscdwqwmzxbapgcl6582")))))))
796 (synopsis "Bootstrap binaries of MesCC Tools")
797 (description synopsis)
799 (supported-systems '("i686-linux" "x86_64-linux"))
802 (define %bootstrap-mes
803 ;; The initial Mes. Uses binaries from a tarball typically built by
804 ;; %MES-BOOTSTRAP-TARBALL.
806 (name "bootstrap-mes")
809 (build-system trivial-build-system)
811 `(#:guile ,%bootstrap-guile
812 #:modules ((guix build utils))
815 (use-modules (guix build utils)
817 (let ((out (assoc-ref %outputs "out"))
818 (tar (assoc-ref %build-inputs "tar"))
819 (xz (assoc-ref %build-inputs "xz"))
820 (tarball (assoc-ref %build-inputs "tarball")))
823 (copy-file tarball "binaries.tar.xz")
824 (invoke xz "-d" "binaries.tar.xz")
825 (let ((builddir (getcwd))
826 (bindir (string-append out "/bin")))
827 (with-directory-excursion out
829 (string-append builddir "/binaries.tar"))))))))
831 `(("tar" ,(bootstrap-executable "tar" (%current-system)))
832 ("xz" ,(bootstrap-executable "xz" (%current-system)))
838 (cute string-append <>
839 "/i686-linux/20190815/"
840 "mes-minimal-stripped-0.19-i686-linux.tar.xz")
841 %bootstrap-base-urls))
844 "1q4xjpx6nbn44kxnilpgl12bhpmwy2bblzwszc2ci7xkf400jcpv")))))))
845 (supported-systems '("i686-linux" "x86_64-linux"))
846 (synopsis "Bootstrap binaries of Mes")
847 (description synopsis)
851 (define (%bootstrap-inputs)
852 ;; The initial, pre-built inputs. From now on, we can start building our
854 (match (%current-system)
855 ((or "i686-linux" "x86_64-linux")
856 `(("linux-libre-headers" ,%bootstrap-linux-libre-headers)
857 ("bootstrap-mescc-tools" ,%bootstrap-mescc-tools)
858 ("mes" ,%bootstrap-mes)))
860 `(("libc" ,%bootstrap-glibc)
861 ("gcc" ,%bootstrap-gcc)
862 ("binutils" ,%bootstrap-binutils)
863 ("coreutils&co" ,%bootstrap-coreutils&co)
864 ;; In gnu-build-system.scm, we rely on the availability of Bash.
865 ("bash" ,%bootstrap-coreutils&co)))))
867 (define %bootstrap-inputs-for-tests
868 ;; These are bootstrap inputs that are cheap to produce (no compilation
869 ;; needed) and that are meant to be used for testing. (These are those we
870 ;; used before the Mes-based reduced bootstrap.)
871 `(("libc" ,%bootstrap-glibc)
872 ("gcc" ,%bootstrap-gcc)
873 ("binutils" ,%bootstrap-binutils)
874 ("coreutils&co" ,%bootstrap-coreutils&co)
875 ("bash" ,%bootstrap-coreutils&co)))
877 ;;; bootstrap.scm ends here