1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
7 ;;; This file is part of GNU Guix.
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages bootstrap)
23 #:use-module (guix licenses)
24 #:use-module (gnu packages)
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix build-system)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix build-system trivial)
30 #:use-module ((guix store)
31 #:select (run-with-store add-to-store add-text-to-store))
32 #:use-module ((guix derivations)
33 #:select (derivation derivation->output-path))
34 #:use-module ((guix utils) #:select (gnu-triplet->nix-system))
35 #:use-module (guix memoization)
36 #:use-module (guix i18n)
37 #:use-module (srfi srfi-1)
38 #:use-module (srfi srfi-26)
39 #:use-module (srfi srfi-34)
40 #:use-module (srfi srfi-35)
41 #:use-module (ice-9 match)
42 #:export (bootstrap-origin
43 package-with-bootstrap-guile
47 bootstrap-guile-origin
50 %bootstrap-coreutils&co
51 %bootstrap-linux-libre-headers
56 %bootstrap-mescc-tools
59 %bootstrap-inputs-for-tests))
63 ;;; Pre-built packages that are used to bootstrap the
64 ;;; distribution--i.e., to build all the core packages from scratch.
71 ;;; The bootstrap executables: 'bash', 'mkdir', 'tar', 'xz'. They allow us to
72 ;;; extract the very first tarball.
75 (define %bootstrap-executables
76 ;; List of bootstrap executables and their recursive hashes (as per 'guix
77 ;; hash -r'), taking their executable bit into account.
80 ,(base32 "13aqhqb8nydlwq1ah9974q0iadx1pb95v13wzzyf7vgv6nasrwzr"))
82 ,(base32 "1pxhdp7ldwavmm71xbh9wc197cb2nr66acjn26yjx3732cixh9ws"))
84 ,(base32 "1j51gv08sfg277yxj73xd564wjq3f8xwd6s9rbcg8v9gms47m4cx"))
86 ,(base32 "1d779rwsrasphg5g3r37qppcqy3p7ay1jb1y83w7x4i3qsc7zjy2")))
89 ,(base32 "0s6f1s26g4dsrrkl39zblvwpxmbzi6n9mgqf6vxsqz42gik6bgyn"))
91 ,(base32 "1r5rcp35niyxfkrdf00y2ba8ifrq9bi76cr63lwjf2l655j1i5p7"))
93 ,(base32 "0dksx5im3fv8ximz7368bsax9f26nn47ds74298flm5lnvpv9xly"))
95 ,(base32 "1cqqavghjfr0iwxqf61lrssv27wfigysgq2rs4rm1gkmn04yn1k3")))
98 ,(base32 "0rjaxyzjdllfkf1abczvgaf3cdcc7mmahyvdbkjmjzhgz92pv23g"))
100 ,(base32 "133ybmfpkmsnysrzbngwvbysqnsmfi8is8zifs7i7n6n600h4s1w"))
102 ,(base32 "07830bx29ad5i0l1ykj0g0b1jayjdblf01sr3ww9wbnwdbzinqms"))
104 ,(base32 "0i9kxdi17bm5gxfi2xzm0y73p3ii0cqxli1sbljm6rh2fjgyn90k")))
107 ,(base32 "1aw046dhda240k9pb9iaj5aqkm23gkvxa9j82n4k7fk87nbrixw6"))
109 ,(base32 "0c9j6qgyw84zxbry3ypifzll13gy8ax71w40kdk1h11jbgla3f5k"))
111 ,(base32 "06gmqdjq3rl8lr47b9fyx4ifnm5x56ymc8lyryp1ax1j2s4y5jb4"))
113 ,(base32 "09j1d69qr0hhhx4k4ih8wp00dfc9y4rp01hfg3vc15yxd0jxabh5")))))
115 (define (bootstrap-executable-url program system)
116 "Return the URL where PROGRAM can be found for SYSTEM."
118 "https://git.savannah.gnu.org/cgit/guix.git/plain/gnu/packages/bootstrap/"
120 "?id=44f07d1dc6806e97c4e9ee3e6be883cc59dc666e"))
122 (define bootstrap-executable
123 (mlambda (program system)
124 "Return an origin for PROGRAM, a statically-linked bootstrap executable
126 (let ((system (if (string=? system "x86_64-linux")
129 (match (assoc-ref (assoc-ref %bootstrap-executables system)
135 (format #f (G_ "could not find bootstrap binary '~a' \
140 (method url-fetch/executable)
141 (uri (bootstrap-executable-url program system))
143 (sha256 sha256)))))))
147 ;;; Helper procedures.
150 (define (bootstrap-origin source)
151 "Return a variant of SOURCE, an <origin> instance, whose method uses
152 %BOOTSTRAP-GUILE to do its job."
154 (lambda* (url hash-algo hash
155 #:optional name #:key system)
156 (fetch url hash-algo hash name
157 #:guile %bootstrap-guile
160 (define %bootstrap-patch-inputs
161 ;; Packages used when an <origin> has a non-empty 'patches' field.
162 `(("tar" ,%bootstrap-coreutils&co)
163 ("xz" ,%bootstrap-coreutils&co)
164 ("bzip2" ,%bootstrap-coreutils&co)
165 ("gzip" ,%bootstrap-coreutils&co)
166 ("patch" ,%bootstrap-coreutils&co)))
168 (let ((orig-method (origin-method source)))
169 (origin (inherit source)
170 (method (cond ((eq? orig-method url-fetch)
173 (patch-guile %bootstrap-guile)
174 (patch-inputs %bootstrap-patch-inputs)
176 ;; Patches can be origins as well, so process them.
177 (patches (map (match-lambda
179 (bootstrap-origin patch))
181 (origin-patches source))))))
183 (define* (package-from-tarball name source program-to-test description
185 "Return a package that correspond to the extraction of SOURCE.
186 PROGRAM-TO-TEST is #f or a string: the program to run after extraction of
187 SOURCE to check whether everything is alright. If SNIPPET is provided, it is
188 evaluated after extracting SOURCE. SNIPPET should return true if successful,
189 or false to signal an error."
193 (build-system trivial-build-system)
195 `(#:guile ,%bootstrap-guile
196 #:modules ((guix build utils))
199 (use-modules (guix build utils))
201 (let ((out (assoc-ref %outputs "out"))
202 (tar (assoc-ref %build-inputs "tar"))
203 (xz (assoc-ref %build-inputs "xz"))
204 (tarball (assoc-ref %build-inputs "tarball")))
207 (copy-file tarball "binaries.tar.xz")
208 (invoke xz "-d" "binaries.tar.xz")
209 (let ((builddir (getcwd)))
210 (with-directory-excursion out
212 (string-append builddir "/binaries.tar"))
213 ,@(if snippet (list snippet) '())
214 (or (not ,program-to-test)
215 (invoke (string-append "bin/" ,program-to-test)
218 `(("tar" ,(bootstrap-executable "tar" (%current-system)))
219 ("xz" ,(bootstrap-executable "xz" (%current-system)))
220 ("tarball" ,(bootstrap-origin (source (%current-system))))))
222 (synopsis description)
223 (description description)
227 (define package-with-bootstrap-guile
229 "Return a variant of P such that all its origins are fetched with
231 (define rewritten-input
233 ((name (? origin? o))
234 `(,name ,(bootstrap-origin o)))
235 ((name (? package? p) sub-drvs ...)
236 `(,name ,(package-with-bootstrap-guile p) ,@sub-drvs))
240 (source (match (package-source p)
241 ((? origin? o) (bootstrap-origin o))
243 (inputs (map rewritten-input
245 (native-inputs (map rewritten-input
246 (package-native-inputs p)))
247 (propagated-inputs (map rewritten-input
248 (package-propagated-inputs p)))
249 (replacement (and=> (package-replacement p)
250 package-with-bootstrap-guile)))))
252 (define* (glibc-dynamic-linker
253 #:optional (system (or (and=> (%current-target-system)
254 gnu-triplet->nix-system)
256 "Return the name of Glibc's dynamic linker for SYSTEM."
257 ;; See the 'SYSDEP_KNOWN_INTERPRETER_NAMES' cpp macro in libc.
258 (cond ((string=? system "x86_64-linux") "/lib/ld-linux-x86-64.so.2")
259 ((string=? system "i686-linux") "/lib/ld-linux.so.2")
260 ((string=? system "armhf-linux") "/lib/ld-linux-armhf.so.3")
261 ((string=? system "mips64el-linux") "/lib/ld.so.1")
262 ((string=? system "i586-gnu") "/lib/ld.so.1")
263 ((string=? system "i686-gnu") "/lib/ld.so.1")
264 ((string=? system "aarch64-linux") "/lib/ld-linux-aarch64.so.1")
265 ((string=? system "powerpc-linux") "/lib/ld.so.1")
266 ((string=? system "powerpc64le-linux") "/lib/ld64.so.2")
267 ((string=? system "alpha-linux") "/lib/ld-linux.so.2")
268 ((string=? system "s390x-linux") "/lib/ld64.so.1")
269 ((string=? system "riscv64-linux") "/lib/ld-linux-riscv64-lp64d.so.1")
271 ;; XXX: This one is used bare-bones, without a libc, so add a case
272 ;; here just so we can keep going.
273 ((string=? system "arm-elf") "no-ld.so")
274 ((string=? system "arm-eabi") "no-ld.so")
275 ((string=? system "xtensa-elf") "no-ld.so")
276 ((string=? system "avr") "no-ld.so")
277 ((string=? system "propeller-elf") "no-ld.so")
278 ((string=? system "i686-mingw") "no-ld.so")
279 ((string=? system "vc4-elf") "no-ld.so")
281 (else (error "dynamic linker name not known for this system"
286 ;;; Bootstrap packages.
289 (define %bootstrap-base-urls
290 ;; This is where the initial binaries come from.
291 '("https://alpha.gnu.org/gnu/guix/bootstrap"
292 "http://alpha.gnu.org/gnu/guix/bootstrap"
293 "ftp://alpha.gnu.org/gnu/guix/bootstrap"
294 "http://www.fdn.fr/~lcourtes/software/guix/packages"
295 "http://flashner.co.il/guix/bootstrap"))
297 (define (bootstrap-guile-url-path system)
298 "Return the URI for FILE."
299 (string-append "/" system
302 "/20170217/guile-2.0.14.tar.xz")
304 "/20150101/guile-2.0.11.tar.xz")
306 "/20131110/guile-2.0.9.tar.xz"))))
308 (define (bootstrap-guile-hash system)
309 "Return the SHA256 hash of the Guile bootstrap tarball for SYSTEM."
312 (base32 "1w2p5zyrglzzniqgvyn1b55vprfzhgk8vzbzkkbdgl5248si0yq3"))
314 (base32 "0im800m30abgh7msh331pcbjvb4n02smz5cfzf1srv0kpx3csmxp"))
316 (base32 "0fzp93lvi0hn54acc0fpvhc7bvl0yc853k62l958cihk03q80ilr"))
318 (base32 "1mi3brl7l58aww34rawhvja84xc7l1b4hmwdmc36fp9q9mfx0lg5"))
320 (base32 "1giy2aprjmn5fp9c4s9r125fljw4wv6ixy5739i5bffw4jgr0f9r"))))
322 (define (bootstrap-guile-origin system)
323 "Return an <origin> object for the Guile tarball of SYSTEM."
326 (uri (map (cute string-append <> (bootstrap-guile-url-path system))
327 %bootstrap-base-urls))
328 (sha256 (bootstrap-guile-hash system))))
330 (define (download-bootstrap-guile store system)
331 "Return a derivation that downloads the bootstrap Guile tarball for SYSTEM."
332 (let* ((path (bootstrap-guile-url-path system))
333 (base (basename path))
334 (urls (map (cut string-append <> path) %bootstrap-base-urls)))
335 (run-with-store store
336 (url-fetch urls 'sha256 (bootstrap-guile-hash system)
339 (define* (raw-build store name inputs
340 #:key outputs system search-paths
342 (define (->store file)
343 (run-with-store store
344 (origin->derivation (bootstrap-executable file system)
347 (let* ((tar (->store "tar"))
349 (mkdir (->store "mkdir"))
350 (bash (->store "bash"))
351 (guile (download-bootstrap-guile store system))
352 ;; The following code, run by the bootstrap guile after it is
353 ;; unpacked, creates a wrapper for itself to set its load path.
354 ;; This replaces the previous non-portable method based on
355 ;; reading the /proc/self/exe symlink.
358 (use-modules (ice-9 match))
359 (match (command-line)
361 (let ((bin-dir (string-append out "/bin"))
362 (guile (string-append out "/bin/guile"))
363 (guile-real (string-append out "/bin/.guile-real"))
364 ;; We must avoid using a bare dollar sign in this code,
365 ;; because it would be interpreted by the shell.
366 (dollar (string (integer->char 36))))
367 (chmod bin-dir #o755)
368 (rename-file guile guile-real)
369 (call-with-output-file guile
373 export GUILE_SYSTEM_PATH=~a/share/guile/2.0
374 export GUILE_SYSTEM_COMPILED_PATH=~a/lib/guile/2.0/ccache
375 exec -a \"~a0\" ~a \"~a@\"\n"
376 bash out out dollar guile-real dollar)))
378 (chmod bin-dir #o555))))))
380 (add-text-to-store store
381 "build-bootstrap-guile.sh"
383 echo \"unpacking bootstrap Guile to '$out'...\"
386 ~a -dc < $GUILE_TARBALL | ~a xv
388 # Use the bootstrap guile to create its own wrapper to set the load path.
389 GUILE_SYSTEM_PATH=$out/share/guile/2.0 \
390 GUILE_SYSTEM_COMPILED_PATH=$out/lib/guile/2.0/ccache \
391 $out/bin/guile -c ~s $out ~a
394 $out/bin/guile --version~%"
395 (derivation->output-path mkdir)
396 (derivation->output-path xz)
397 (derivation->output-path tar)
398 (format #f "~s" make-guile-wrapper)
399 (derivation->output-path bash)))))
400 (derivation store name
401 (derivation->output-path bash) `(,builder)
403 #:inputs `((,bash) (,mkdir) (,tar) (,xz)
405 #:env-vars `(("GUILE_TARBALL"
406 . ,(derivation->output-path guile))))))
408 (define* (make-raw-bag name
409 #:key source inputs native-inputs outputs
414 (build-inputs inputs)
417 (define %bootstrap-guile
418 ;; The Guile used to run the build scripts of the initial derivations.
419 ;; It is just unpacked from a tarball containing a pre-built binary.
420 ;; This is typically built using %GUILE-BOOTSTRAP-TARBALL below.
422 ;; XXX: Would need libc's `libnss_files2.so' for proper `getaddrinfo'
423 ;; support (for /etc/services).
424 (let ((raw (build-system
426 (description "Raw build system with direct store access")
427 (lower make-raw-bag))))
429 (name "guile-bootstrap")
433 (synopsis "Bootstrap Guile")
434 (description "Pre-built Guile for bootstrapping purposes.")
438 (define %bootstrap-coreutils&co
439 (package-from-tarball "bootstrap-binaries"
443 (uri (map (cut string-append <> "/" system
446 "/20150101/static-binaries.tar.xz")
448 "/20170217/static-binaries.tar.xz")
450 "/20131110/static-binaries.tar.xz")))
451 %bootstrap-base-urls))
456 "0c533p9dhczzcsa1117gmfq3pc8w362g4mx84ik36srpr7cx2bg4"))
459 "0s5b3jb315n13m1k8095l0a5hfrsz8g0fv1b6riyc5hnxqyphlak"))
462 "0gf0fn2kbpxkjixkmx5f4z6hv6qpmgixl69zgg74dbsfdfj8jdv5"))
465 "18dfiq6c6xhsdpbidigw6480wh0vdgsxqq3xindq4lpdgqlccpfh"))
468 "072y4wyfsj1bs80r6vbybbafy8ya4vfy7qj25dklwk97m6g71753"))))))
469 "fgrep" ; the program to test
470 "Bootstrap binaries of Coreutils, Awk, etc."
472 '(let ((path (list (string-append (getcwd) "/bin"))))
474 (patch-shebang "bin/egrep" path)
475 (patch-shebang "bin/fgrep" path)
476 ;; Starting with grep@2.25 'egrep' and 'fgrep' are shell files
477 ;; that call 'grep'. If the bootstrap 'egrep' and 'fgrep'
478 ;; are not binaries then patch them to execute 'grep' via its
479 ;; absolute file name instead of searching for it in $PATH.
480 (if (not (elf-file? "bin/egrep"))
481 (substitute* '("bin/egrep" "bin/fgrep")
482 (("^exec grep") (string-append (getcwd) "/bin/grep"))))
483 (chmod "bin" #o555))))
485 (define-public %bootstrap-linux-libre-headers
486 (package-from-tarball
487 "linux-libre-headers-bootstrap"
491 (uri (map (cute string-append <>
492 "/i686-linux/20181020/"
493 "linux-libre-headers-stripped-4.14.67-i686-linux.tar.xz")
494 %bootstrap-base-urls))
497 "0sm2z9x4wk45bh6qfs94p0w1d6hsy6dqx9sw38qsqbvxwa1qzk8s"))))
498 #f ; no program to test
499 "Bootstrap linux-libre-headers"))
501 (define %bootstrap-binutils
502 (package-from-tarball "binutils-bootstrap"
506 (uri (map (cut string-append <> "/" system
509 "/20150101/binutils-2.25.tar.xz")
511 "/20170217/binutils-2.27.tar.xz")
513 "/20131110/binutils-2.23.2.tar.xz")))
514 %bootstrap-base-urls))
519 "1j5yivz7zkjqfsfmxzrrrffwyayjqyfxgpi89df0w4qziqs2dg20"))
522 "14jgwf9gscd7l2pnz610b1zia06dvcm2qyzvni31b8zpgmcai2v9"))
525 "1v7dj6bzn6m36f20gw31l99xaabq4xrhrx3gwqkhhig0mdlmr69q"))
528 "111s7ilfiby033rczc71797xrmaa3qlv179wdvsaq132pd51xv3n"))
531 "1x8kkhcxmfyzg1ddpz2pxs6fbdl6412r7x0nzbmi5n7mj8zw2gy7"))))))
532 "ld" ; the program to test
533 "Bootstrap binaries of the GNU Binutils"))
535 (define %bootstrap-glibc
538 (name "glibc-bootstrap")
541 (build-system trivial-build-system)
543 `(#:guile ,%bootstrap-guile
544 #:modules ((guix build utils))
547 (use-modules (guix build utils))
549 (let ((out (assoc-ref %outputs "out"))
550 (tar (assoc-ref %build-inputs "tar"))
551 (xz (assoc-ref %build-inputs "xz"))
552 (tarball (assoc-ref %build-inputs "tarball")))
555 (copy-file tarball "binaries.tar.xz")
556 (invoke xz "-d" "binaries.tar.xz")
557 (let ((builddir (getcwd)))
558 (with-directory-excursion out
560 (string-append builddir
564 ;; Patch libc.so so it refers to the right path.
565 (substitute* "lib/libc.so"
566 (("/[^ ]+/lib/(libc|ld)" _ prefix)
567 (string-append out "/lib/" prefix)))
571 `(("tar" ,(bootstrap-executable "tar" (%current-system)))
572 ("xz" ,(bootstrap-executable "xz" (%current-system)))
573 ("tarball" ,(bootstrap-origin
576 (uri (map (cut string-append <> "/" (%current-system)
577 (match (%current-system)
579 "/20150101/glibc-2.20.tar.xz")
581 "/20170217/glibc-2.25.tar.xz")
583 "/20131110/glibc-2.18.tar.xz")))
584 %bootstrap-base-urls))
586 (match (%current-system)
589 "0jlqrgavvnplj1b083s20jj9iddr4lzfvwybw5xrcis9spbfzk7v"))
592 "1hgrccw1zqdc7lvgivwa54d9l3zsim5pqm0dykxg0z522h6gr05w"))
595 "18cmgvpllqfpn6khsmivqib7ys8ymnq0hdzi3qp24prik0ykz8gn"))
598 "07nx3x8598i2924rjnlrncg6rm61c9bmcczbbcpbx0fb742nvv5c"))
601 "0k97a3whzx3apsi9n2cbsrr79ad6lh00klxph9hw4fqyp1abkdsg")))))))))
602 (synopsis "Bootstrap binaries and headers of the GNU C Library")
603 (description synopsis)
607 (define %bootstrap-gcc
608 ;; The initial GCC. Uses binaries from a tarball typically built by
609 ;; %GCC-BOOTSTRAP-TARBALL.
611 (name "gcc-bootstrap")
614 (build-system trivial-build-system)
616 `(#:guile ,%bootstrap-guile
617 #:modules ((guix build utils))
620 (use-modules (guix build utils)
623 (let ((out (assoc-ref %outputs "out"))
624 (tar (assoc-ref %build-inputs "tar"))
625 (xz (assoc-ref %build-inputs "xz"))
626 (bash (assoc-ref %build-inputs "bash"))
627 (libc (assoc-ref %build-inputs "libc"))
628 (tarball (assoc-ref %build-inputs "tarball")))
631 (copy-file tarball "binaries.tar.xz")
632 (invoke xz "-d" "binaries.tar.xz")
633 (let ((builddir (getcwd))
634 (bindir (string-append out "/bin")))
635 (with-directory-excursion out
637 (string-append builddir "/binaries.tar")))
639 (with-directory-excursion bindir
641 (rename-file "gcc" ".gcc-wrapped")
642 (call-with-output-file "gcc"
645 exec ~a/bin/.gcc-wrapped -B~a/lib \
646 -Wl,-rpath -Wl,~a/lib \
647 -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
650 ,(glibc-dynamic-linker))))
655 `(("tar" ,(bootstrap-executable "tar" (%current-system)))
656 ("xz" ,(bootstrap-executable "xz" (%current-system)))
657 ("bash" ,(bootstrap-executable "bash" (%current-system)))
658 ("libc" ,%bootstrap-glibc)
659 ("tarball" ,(bootstrap-origin
662 (uri (map (cut string-append <> "/" (%current-system)
663 (match (%current-system)
665 "/20150101/gcc-4.8.4.tar.xz")
667 "/20170217/gcc-5.4.0.tar.xz")
669 "/20131110/gcc-4.8.2.tar.xz")))
670 %bootstrap-base-urls))
672 (match (%current-system)
675 "17ga4m6195n4fnbzdkmik834znkhs53nkypp6557pl1ps7dgqbls"))
678 "150c1arrf2k8vfy6dpxh59vcgs4p1bgiz2av5m19dynpks7rjnyw"))
681 "0ghz825yzp43fxw53kd6afm8nkz16f7dxi9xi40bfwc8x3nbbr8v"))
684 "1ar3vdzyqbfm0z36kmvazvfswxhcihlacl2dzdjgiq25cqnq9ih1"))
687 "1m5miqkyng45l745n0sfafdpjkqv9225xf44jqkygwsipj2cv9ks")))))))))
689 (list (search-path-specification
691 (files '("include")))
692 (search-path-specification
693 (variable "LIBRARY_PATH")
694 (files '("lib" "lib64")))))
695 (synopsis "Bootstrap binaries of the GNU Compiler Collection")
696 (description synopsis)
700 (define %bootstrap-mescc-tools
701 ;; The initial MesCC tools. Uses binaries from a tarball typically built by
702 ;; %MESCC-TOOLS-BOOTSTRAP-TARBALL.
704 (name "bootstrap-mescc-tools")
707 (build-system trivial-build-system)
709 `(#:guile ,%bootstrap-guile
710 #:modules ((guix build utils))
713 (use-modules (guix build utils)
715 (let ((out (assoc-ref %outputs "out"))
716 (tar (assoc-ref %build-inputs "tar"))
717 (xz (assoc-ref %build-inputs "xz"))
718 (tarball (assoc-ref %build-inputs "tarball")))
721 (copy-file tarball "binaries.tar.xz")
722 (invoke xz "-d" "binaries.tar.xz")
723 (let ((builddir (getcwd))
724 (bindir (string-append out "/bin")))
725 (with-directory-excursion out
727 (string-append builddir "/binaries.tar"))))))))
729 `(("tar" ,(bootstrap-executable "tar" (%current-system)))
730 ("xz" ,(bootstrap-executable "xz" (%current-system)))
736 (cute string-append <>
737 "/i686-linux/20181020/"
738 "mescc-tools-static-0.5.2-0.bb062b0-i686-linux.tar.xz")
739 %bootstrap-base-urls))
742 "11lniw0vg61kmyhvnwkmcnkci9ym6hbmiksiqggd0hkipbq7hvlz")))))))
743 (synopsis "Bootstrap binaries of MesCC Tools")
744 (description synopsis)
746 (supported-systems '("i686-linux" "x86_64-linux"))
749 (define %bootstrap-mes
750 ;; The initial Mes. Uses binaries from a tarball typically built by
751 ;; %MES-BOOTSTRAP-TARBALL.
753 (name "bootstrap-mes")
756 (build-system trivial-build-system)
758 `(#:guile ,%bootstrap-guile
759 #:modules ((guix build utils))
762 (use-modules (guix build utils)
764 (let ((out (assoc-ref %outputs "out"))
765 (tar (assoc-ref %build-inputs "tar"))
766 (xz (assoc-ref %build-inputs "xz"))
767 (tarball (assoc-ref %build-inputs "tarball")))
770 (copy-file tarball "binaries.tar.xz")
771 (invoke xz "-d" "binaries.tar.xz")
772 (let ((builddir (getcwd))
773 (bindir (string-append out "/bin")))
774 (with-directory-excursion out
776 (string-append builddir "/binaries.tar"))))))))
778 `(("tar" ,(bootstrap-executable "tar" (%current-system)))
779 ("xz" ,(bootstrap-executable "xz" (%current-system)))
785 (cute string-append <>
786 "/i686-linux/20181020/"
787 "mes-minimal-stripped-0.19-i686-linux.tar.xz")
788 %bootstrap-base-urls))
791 "0k7kkl68a6xaadv47ij0nr9jm5ca1ffj38n7f2lg80y72wdkwr9h")))))))
792 (supported-systems '("i686-linux" "x86_64-linux"))
793 (synopsis "Bootstrap binaries of Mes")
794 (description synopsis)
798 (define (%bootstrap-inputs)
799 ;; The initial, pre-built inputs. From now on, we can start building our
801 `(,@(match (%current-system)
802 ((or "i686-linux" "x86_64-linux")
803 `(("linux-libre-headers" ,%bootstrap-linux-libre-headers)
804 ("bootstrap-mescc-tools" ,%bootstrap-mescc-tools)
805 ("mes" ,%bootstrap-mes)))
807 `(("libc" ,%bootstrap-glibc)
808 ("gcc" ,%bootstrap-gcc)
809 ("binutils" ,%bootstrap-binutils))))
810 ("coreutils&co" ,%bootstrap-coreutils&co)
812 ;; In gnu-build-system.scm, we rely on the availability of Bash.
813 ("bash" ,%bootstrap-coreutils&co)))
815 (define %bootstrap-inputs-for-tests
816 ;; These are bootstrap inputs that are cheap to produce (no compilation
817 ;; needed) and that are meant to be used for testing. (These are those we
818 ;; used before the Mes-based reduced bootstrap.)
819 `(("libc" ,%bootstrap-glibc)
820 ("gcc" ,%bootstrap-gcc)
821 ("binutils" ,%bootstrap-binutils)
822 ("coreutils&co" ,%bootstrap-coreutils&co)
823 ("bash" ,%bootstrap-coreutils&co)))
825 ;;; bootstrap.scm ends here