Merge branch 'staging' into core-updates
[jackhill/guix/guix.git] / gnu / packages / bootstrap.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 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>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
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.
13 ;;;
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.
18 ;;;
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/>.
21
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 (srfi srfi-1)
37 #:use-module (srfi srfi-26)
38 #:use-module (ice-9 match)
39 #:export (bootstrap-origin
40 package-with-bootstrap-guile
41 glibc-dynamic-linker
42
43 bootstrap-guile-origin
44
45 %bootstrap-guile
46 %bootstrap-coreutils&co
47 %bootstrap-linux-libre-headers
48 %bootstrap-binutils
49 %bootstrap-gcc
50 %bootstrap-glibc
51 %bootstrap-inputs
52 %bootstrap-mescc-tools
53 %bootstrap-mes))
54
55 ;;; Commentary:
56 ;;;
57 ;;; Pre-built packages that are used to bootstrap the
58 ;;; distribution--i.e., to build all the core packages from scratch.
59 ;;;
60 ;;; Code:
61
62
63 \f
64 ;;;
65 ;;; Helper procedures.
66 ;;;
67
68 (define (bootstrap-origin source)
69 "Return a variant of SOURCE, an <origin> instance, whose method uses
70 %BOOTSTRAP-GUILE to do its job."
71 (define (boot fetch)
72 (lambda* (url hash-algo hash
73 #:optional name #:key system)
74 (fetch url hash-algo hash name
75 #:guile %bootstrap-guile
76 #:system system)))
77
78 (define %bootstrap-patch-inputs
79 ;; Packages used when an <origin> has a non-empty 'patches' field.
80 `(("tar" ,%bootstrap-coreutils&co)
81 ("xz" ,%bootstrap-coreutils&co)
82 ("bzip2" ,%bootstrap-coreutils&co)
83 ("gzip" ,%bootstrap-coreutils&co)
84 ("patch" ,%bootstrap-coreutils&co)))
85
86 (let ((orig-method (origin-method source)))
87 (origin (inherit source)
88 (method (cond ((eq? orig-method url-fetch)
89 (boot url-fetch))
90 (else orig-method)))
91 (patch-guile %bootstrap-guile)
92 (patch-inputs %bootstrap-patch-inputs)
93
94 ;; Patches can be origins as well, so process them.
95 (patches (map (match-lambda
96 ((? origin? patch)
97 (bootstrap-origin patch))
98 (patch patch))
99 (origin-patches source))))))
100
101 (define* (package-from-tarball name source program-to-test description
102 #:key snippet)
103 "Return a package that correspond to the extraction of SOURCE.
104 PROGRAM-TO-TEST is #f or a string: the program to run after extraction of
105 SOURCE to check whether everything is alright. If SNIPPET is provided, it is
106 evaluated after extracting SOURCE. SNIPPET should return true if successful,
107 or false to signal an error."
108 (package
109 (name name)
110 (version "0")
111 (build-system trivial-build-system)
112 (arguments
113 `(#:guile ,%bootstrap-guile
114 #:modules ((guix build utils))
115 #:builder
116 (begin
117 (use-modules (guix build utils))
118
119 (let ((out (assoc-ref %outputs "out"))
120 (tar (assoc-ref %build-inputs "tar"))
121 (xz (assoc-ref %build-inputs "xz"))
122 (tarball (assoc-ref %build-inputs "tarball")))
123
124 (mkdir out)
125 (copy-file tarball "binaries.tar.xz")
126 (invoke xz "-d" "binaries.tar.xz")
127 (let ((builddir (getcwd)))
128 (with-directory-excursion out
129 (invoke tar "xvf"
130 (string-append builddir "/binaries.tar"))
131 ,@(if snippet (list snippet) '())
132 (or (not ,program-to-test)
133 (invoke (string-append "bin/" ,program-to-test)
134 "--version"))))))))
135 (inputs
136 `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
137 ("xz" ,(search-bootstrap-binary "xz" (%current-system)))
138 ("tarball" ,(bootstrap-origin (source (%current-system))))))
139 (source #f)
140 (synopsis description)
141 (description description)
142 (home-page #f)
143 (license gpl3+)))
144
145 (define package-with-bootstrap-guile
146 (mlambdaq (p)
147 "Return a variant of P such that all its origins are fetched with
148 %BOOTSTRAP-GUILE."
149 (define rewritten-input
150 (match-lambda
151 ((name (? origin? o))
152 `(,name ,(bootstrap-origin o)))
153 ((name (? package? p) sub-drvs ...)
154 `(,name ,(package-with-bootstrap-guile p) ,@sub-drvs))
155 (x x)))
156
157 (package (inherit p)
158 (source (match (package-source p)
159 ((? origin? o) (bootstrap-origin o))
160 (s s)))
161 (inputs (map rewritten-input
162 (package-inputs p)))
163 (native-inputs (map rewritten-input
164 (package-native-inputs p)))
165 (propagated-inputs (map rewritten-input
166 (package-propagated-inputs p)))
167 (replacement (and=> (package-replacement p)
168 package-with-bootstrap-guile)))))
169
170 (define* (glibc-dynamic-linker
171 #:optional (system (or (and=> (%current-target-system)
172 gnu-triplet->nix-system)
173 (%current-system))))
174 "Return the name of Glibc's dynamic linker for SYSTEM."
175 ;; See the 'SYSDEP_KNOWN_INTERPRETER_NAMES' cpp macro in libc.
176 (cond ((string=? system "x86_64-linux") "/lib/ld-linux-x86-64.so.2")
177 ((string=? system "i686-linux") "/lib/ld-linux.so.2")
178 ((string=? system "armhf-linux") "/lib/ld-linux-armhf.so.3")
179 ((string=? system "mips64el-linux") "/lib/ld.so.1")
180 ((string=? system "i586-gnu") "/lib/ld.so.1")
181 ((string=? system "i686-gnu") "/lib/ld.so.1")
182 ((string=? system "aarch64-linux") "/lib/ld-linux-aarch64.so.1")
183 ((string=? system "powerpc-linux") "/lib/ld.so.1")
184 ((string=? system "powerpc64le-linux") "/lib/ld64.so.2")
185 ((string=? system "alpha-linux") "/lib/ld-linux.so.2")
186 ((string=? system "s390x-linux") "/lib/ld64.so.1")
187
188 ;; XXX: This one is used bare-bones, without a libc, so add a case
189 ;; here just so we can keep going.
190 ((string=? system "arm-elf") "no-ld.so")
191 ((string=? system "arm-eabi") "no-ld.so")
192 ((string=? system "xtensa-elf") "no-ld.so")
193 ((string=? system "avr") "no-ld.so")
194 ((string=? system "propeller-elf") "no-ld.so")
195 ((string=? system "i686-mingw") "no-ld.so")
196 ((string=? system "vc4-elf") "no-ld.so")
197
198 (else (error "dynamic linker name not known for this system"
199 system))))
200
201 \f
202 ;;;
203 ;;; Bootstrap packages.
204 ;;;
205
206 (define %bootstrap-base-urls
207 ;; This is where the initial binaries come from.
208 '("https://alpha.gnu.org/gnu/guix/bootstrap"
209 "http://alpha.gnu.org/gnu/guix/bootstrap"
210 "ftp://alpha.gnu.org/gnu/guix/bootstrap"
211 "http://www.fdn.fr/~lcourtes/software/guix/packages"
212 "http://flashner.co.il/guix/bootstrap"))
213
214 (define (bootstrap-guile-url-path system)
215 "Return the URI for FILE."
216 (string-append "/" system
217 (match system
218 ("aarch64-linux"
219 "/20170217/guile-2.0.14.tar.xz")
220 ("armhf-linux"
221 "/20150101/guile-2.0.11.tar.xz")
222 (_
223 "/20131110/guile-2.0.9.tar.xz"))))
224
225 (define (bootstrap-guile-hash system)
226 "Return the SHA256 hash of the Guile bootstrap tarball for SYSTEM."
227 (match system
228 ("x86_64-linux"
229 (base32 "1w2p5zyrglzzniqgvyn1b55vprfzhgk8vzbzkkbdgl5248si0yq3"))
230 ("i686-linux"
231 (base32 "0im800m30abgh7msh331pcbjvb4n02smz5cfzf1srv0kpx3csmxp"))
232 ("mips64el-linux"
233 (base32 "0fzp93lvi0hn54acc0fpvhc7bvl0yc853k62l958cihk03q80ilr"))
234 ("armhf-linux"
235 (base32 "1mi3brl7l58aww34rawhvja84xc7l1b4hmwdmc36fp9q9mfx0lg5"))
236 ("aarch64-linux"
237 (base32 "1giy2aprjmn5fp9c4s9r125fljw4wv6ixy5739i5bffw4jgr0f9r"))))
238
239 (define (bootstrap-guile-origin system)
240 "Return an <origin> object for the Guile tarball of SYSTEM."
241 (origin
242 (method url-fetch)
243 (uri (map (cute string-append <> (bootstrap-guile-url-path system))
244 %bootstrap-base-urls))
245 (sha256 (bootstrap-guile-hash system))))
246
247 (define (download-bootstrap-guile store system)
248 "Return a derivation that downloads the bootstrap Guile tarball for SYSTEM."
249 (let* ((path (bootstrap-guile-url-path system))
250 (base (basename path))
251 (urls (map (cut string-append <> path) %bootstrap-base-urls)))
252 (run-with-store store
253 (url-fetch urls 'sha256 (bootstrap-guile-hash system)
254 #:system system))))
255
256 (define* (raw-build store name inputs
257 #:key outputs system search-paths
258 #:allow-other-keys)
259 (define (->store file)
260 (add-to-store store file #t "sha256"
261 (or (search-bootstrap-binary file
262 system)
263 (error "bootstrap binary not found"
264 file system))))
265
266 (let* ((tar (->store "tar"))
267 (xz (->store "xz"))
268 (mkdir (->store "mkdir"))
269 (bash (->store "bash"))
270 (guile (download-bootstrap-guile store system))
271 ;; The following code, run by the bootstrap guile after it is
272 ;; unpacked, creates a wrapper for itself to set its load path.
273 ;; This replaces the previous non-portable method based on
274 ;; reading the /proc/self/exe symlink.
275 (make-guile-wrapper
276 '(begin
277 (use-modules (ice-9 match))
278 (match (command-line)
279 ((_ out bash)
280 (let ((bin-dir (string-append out "/bin"))
281 (guile (string-append out "/bin/guile"))
282 (guile-real (string-append out "/bin/.guile-real"))
283 ;; We must avoid using a bare dollar sign in this code,
284 ;; because it would be interpreted by the shell.
285 (dollar (string (integer->char 36))))
286 (chmod bin-dir #o755)
287 (rename-file guile guile-real)
288 (call-with-output-file guile
289 (lambda (p)
290 (format p "\
291 #!~a
292 export GUILE_SYSTEM_PATH=~a/share/guile/2.0
293 export GUILE_SYSTEM_COMPILED_PATH=~a/lib/guile/2.0/ccache
294 exec -a \"~a0\" ~a \"~a@\"\n"
295 bash out out dollar guile-real dollar)))
296 (chmod guile #o555)
297 (chmod bin-dir #o555))))))
298 (builder
299 (add-text-to-store store
300 "build-bootstrap-guile.sh"
301 (format #f "
302 echo \"unpacking bootstrap Guile to '$out'...\"
303 ~a $out
304 cd $out
305 ~a -dc < $GUILE_TARBALL | ~a xv
306
307 # Use the bootstrap guile to create its own wrapper to set the load path.
308 GUILE_SYSTEM_PATH=$out/share/guile/2.0 \
309 GUILE_SYSTEM_COMPILED_PATH=$out/lib/guile/2.0/ccache \
310 $out/bin/guile -c ~s $out ~a
311
312 # Sanity check.
313 $out/bin/guile --version~%"
314 mkdir xz tar
315 (format #f "~s" make-guile-wrapper)
316 bash)
317 (list mkdir xz tar bash))))
318 (derivation store name
319 bash `(,builder)
320 #:system system
321 #:inputs `((,bash) (,builder) (,guile))
322 #:env-vars `(("GUILE_TARBALL"
323 . ,(derivation->output-path guile))))))
324
325 (define* (make-raw-bag name
326 #:key source inputs native-inputs outputs
327 system target)
328 (bag
329 (name name)
330 (system system)
331 (build-inputs inputs)
332 (build raw-build)))
333
334 (define %bootstrap-guile
335 ;; The Guile used to run the build scripts of the initial derivations.
336 ;; It is just unpacked from a tarball containing a pre-built binary.
337 ;; This is typically built using %GUILE-BOOTSTRAP-TARBALL below.
338 ;;
339 ;; XXX: Would need libc's `libnss_files2.so' for proper `getaddrinfo'
340 ;; support (for /etc/services).
341 (let ((raw (build-system
342 (name 'raw)
343 (description "Raw build system with direct store access")
344 (lower make-raw-bag))))
345 (package
346 (name "guile-bootstrap")
347 (version "2.0")
348 (source #f)
349 (build-system raw)
350 (synopsis "Bootstrap Guile")
351 (description "Pre-built Guile for bootstrapping purposes.")
352 (home-page #f)
353 (license lgpl3+))))
354
355 (define %bootstrap-coreutils&co
356 (package-from-tarball "bootstrap-binaries"
357 (lambda (system)
358 (origin
359 (method url-fetch)
360 (uri (map (cut string-append <> "/" system
361 (match system
362 ("armhf-linux"
363 "/20150101/static-binaries.tar.xz")
364 ("aarch64-linux"
365 "/20170217/static-binaries.tar.xz")
366 (_
367 "/20131110/static-binaries.tar.xz")))
368 %bootstrap-base-urls))
369 (sha256
370 (match system
371 ("x86_64-linux"
372 (base32
373 "0c533p9dhczzcsa1117gmfq3pc8w362g4mx84ik36srpr7cx2bg4"))
374 ("i686-linux"
375 (base32
376 "0s5b3jb315n13m1k8095l0a5hfrsz8g0fv1b6riyc5hnxqyphlak"))
377 ("armhf-linux"
378 (base32
379 "0gf0fn2kbpxkjixkmx5f4z6hv6qpmgixl69zgg74dbsfdfj8jdv5"))
380 ("aarch64-linux"
381 (base32
382 "18dfiq6c6xhsdpbidigw6480wh0vdgsxqq3xindq4lpdgqlccpfh"))
383 ("mips64el-linux"
384 (base32
385 "072y4wyfsj1bs80r6vbybbafy8ya4vfy7qj25dklwk97m6g71753"))))))
386 "fgrep" ; the program to test
387 "Bootstrap binaries of Coreutils, Awk, etc."
388 #:snippet
389 '(let ((path (list (string-append (getcwd) "/bin"))))
390 (chmod "bin" #o755)
391 (patch-shebang "bin/egrep" path)
392 (patch-shebang "bin/fgrep" path)
393 ;; Starting with grep@2.25 'egrep' and 'fgrep' are shell files
394 ;; that call 'grep'. If the bootstrap 'egrep' and 'fgrep'
395 ;; are not binaries then patch them to execute 'grep' via its
396 ;; absolute file name instead of searching for it in $PATH.
397 (if (not (elf-file? "bin/egrep"))
398 (substitute* '("bin/egrep" "bin/fgrep")
399 (("^exec grep") (string-append (getcwd) "/bin/grep"))))
400 (chmod "bin" #o555))))
401
402 (define-public %bootstrap-linux-libre-headers
403 (package-from-tarball
404 "linux-libre-headers-bootstrap"
405 (lambda (system)
406 (origin
407 (method url-fetch)
408 (uri (map (cute string-append <>
409 "/i686-linux/20181020/"
410 "linux-libre-headers-stripped-4.14.67-i686-linux.tar.xz")
411 %bootstrap-base-urls))
412 (sha256
413 (base32
414 "0sm2z9x4wk45bh6qfs94p0w1d6hsy6dqx9sw38qsqbvxwa1qzk8s"))))
415 #f ; no program to test
416 "Bootstrap linux-libre-headers"))
417
418 (define %bootstrap-binutils
419 (package-from-tarball "binutils-bootstrap"
420 (lambda (system)
421 (origin
422 (method url-fetch)
423 (uri (map (cut string-append <> "/" system
424 (match system
425 ("armhf-linux"
426 "/20150101/binutils-2.25.tar.xz")
427 ("aarch64-linux"
428 "/20170217/binutils-2.27.tar.xz")
429 (_
430 "/20131110/binutils-2.23.2.tar.xz")))
431 %bootstrap-base-urls))
432 (sha256
433 (match system
434 ("x86_64-linux"
435 (base32
436 "1j5yivz7zkjqfsfmxzrrrffwyayjqyfxgpi89df0w4qziqs2dg20"))
437 ("i686-linux"
438 (base32
439 "14jgwf9gscd7l2pnz610b1zia06dvcm2qyzvni31b8zpgmcai2v9"))
440 ("armhf-linux"
441 (base32
442 "1v7dj6bzn6m36f20gw31l99xaabq4xrhrx3gwqkhhig0mdlmr69q"))
443 ("aarch64-linux"
444 (base32
445 "111s7ilfiby033rczc71797xrmaa3qlv179wdvsaq132pd51xv3n"))
446 ("mips64el-linux"
447 (base32
448 "1x8kkhcxmfyzg1ddpz2pxs6fbdl6412r7x0nzbmi5n7mj8zw2gy7"))))))
449 "ld" ; the program to test
450 "Bootstrap binaries of the GNU Binutils"))
451
452 (define %bootstrap-glibc
453 ;; The initial libc.
454 (package
455 (name "glibc-bootstrap")
456 (version "0")
457 (source #f)
458 (build-system trivial-build-system)
459 (arguments
460 `(#:guile ,%bootstrap-guile
461 #:modules ((guix build utils))
462 #:builder
463 (begin
464 (use-modules (guix build utils))
465
466 (let ((out (assoc-ref %outputs "out"))
467 (tar (assoc-ref %build-inputs "tar"))
468 (xz (assoc-ref %build-inputs "xz"))
469 (tarball (assoc-ref %build-inputs "tarball")))
470
471 (mkdir out)
472 (copy-file tarball "binaries.tar.xz")
473 (invoke xz "-d" "binaries.tar.xz")
474 (let ((builddir (getcwd)))
475 (with-directory-excursion out
476 (invoke tar "xvf"
477 (string-append builddir
478 "/binaries.tar"))
479 (chmod "lib" #o755)
480
481 ;; Patch libc.so so it refers to the right path.
482 (substitute* "lib/libc.so"
483 (("/[^ ]+/lib/(libc|ld)" _ prefix)
484 (string-append out "/lib/" prefix)))
485
486 #t))))))
487 (inputs
488 `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
489 ("xz" ,(search-bootstrap-binary "xz" (%current-system)))
490 ("tarball" ,(bootstrap-origin
491 (origin
492 (method url-fetch)
493 (uri (map (cut string-append <> "/" (%current-system)
494 (match (%current-system)
495 ("armhf-linux"
496 "/20150101/glibc-2.20.tar.xz")
497 ("aarch64-linux"
498 "/20170217/glibc-2.25.tar.xz")
499 (_
500 "/20131110/glibc-2.18.tar.xz")))
501 %bootstrap-base-urls))
502 (sha256
503 (match (%current-system)
504 ("x86_64-linux"
505 (base32
506 "0jlqrgavvnplj1b083s20jj9iddr4lzfvwybw5xrcis9spbfzk7v"))
507 ("i686-linux"
508 (base32
509 "1hgrccw1zqdc7lvgivwa54d9l3zsim5pqm0dykxg0z522h6gr05w"))
510 ("armhf-linux"
511 (base32
512 "18cmgvpllqfpn6khsmivqib7ys8ymnq0hdzi3qp24prik0ykz8gn"))
513 ("aarch64-linux"
514 (base32
515 "07nx3x8598i2924rjnlrncg6rm61c9bmcczbbcpbx0fb742nvv5c"))
516 ("mips64el-linux"
517 (base32
518 "0k97a3whzx3apsi9n2cbsrr79ad6lh00klxph9hw4fqyp1abkdsg")))))))))
519 (synopsis "Bootstrap binaries and headers of the GNU C Library")
520 (description synopsis)
521 (home-page #f)
522 (license lgpl2.1+)))
523
524 (define %bootstrap-gcc
525 ;; The initial GCC. Uses binaries from a tarball typically built by
526 ;; %GCC-BOOTSTRAP-TARBALL.
527 (package
528 (name "gcc-bootstrap")
529 (version "0")
530 (source #f)
531 (build-system trivial-build-system)
532 (arguments
533 `(#:guile ,%bootstrap-guile
534 #:modules ((guix build utils))
535 #:builder
536 (begin
537 (use-modules (guix build utils)
538 (ice-9 popen))
539
540 (let ((out (assoc-ref %outputs "out"))
541 (tar (assoc-ref %build-inputs "tar"))
542 (xz (assoc-ref %build-inputs "xz"))
543 (bash (assoc-ref %build-inputs "bash"))
544 (libc (assoc-ref %build-inputs "libc"))
545 (tarball (assoc-ref %build-inputs "tarball")))
546
547 (mkdir out)
548 (copy-file tarball "binaries.tar.xz")
549 (invoke xz "-d" "binaries.tar.xz")
550 (let ((builddir (getcwd))
551 (bindir (string-append out "/bin")))
552 (with-directory-excursion out
553 (invoke tar "xvf"
554 (string-append builddir "/binaries.tar")))
555
556 (with-directory-excursion bindir
557 (chmod "." #o755)
558 (rename-file "gcc" ".gcc-wrapped")
559 (call-with-output-file "gcc"
560 (lambda (p)
561 (format p "#!~a
562 exec ~a/bin/.gcc-wrapped -B~a/lib \
563 -Wl,-rpath -Wl,~a/lib \
564 -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
565 bash
566 out libc libc libc
567 ,(glibc-dynamic-linker))))
568
569 (chmod "gcc" #o555)
570 #t))))))
571 (inputs
572 `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
573 ("xz" ,(search-bootstrap-binary "xz" (%current-system)))
574 ("bash" ,(search-bootstrap-binary "bash" (%current-system)))
575 ("libc" ,%bootstrap-glibc)
576 ("tarball" ,(bootstrap-origin
577 (origin
578 (method url-fetch)
579 (uri (map (cut string-append <> "/" (%current-system)
580 (match (%current-system)
581 ("armhf-linux"
582 "/20150101/gcc-4.8.4.tar.xz")
583 ("aarch64-linux"
584 "/20170217/gcc-5.4.0.tar.xz")
585 (_
586 "/20131110/gcc-4.8.2.tar.xz")))
587 %bootstrap-base-urls))
588 (sha256
589 (match (%current-system)
590 ("x86_64-linux"
591 (base32
592 "17ga4m6195n4fnbzdkmik834znkhs53nkypp6557pl1ps7dgqbls"))
593 ("i686-linux"
594 (base32
595 "150c1arrf2k8vfy6dpxh59vcgs4p1bgiz2av5m19dynpks7rjnyw"))
596 ("armhf-linux"
597 (base32
598 "0ghz825yzp43fxw53kd6afm8nkz16f7dxi9xi40bfwc8x3nbbr8v"))
599 ("aarch64-linux"
600 (base32
601 "1ar3vdzyqbfm0z36kmvazvfswxhcihlacl2dzdjgiq25cqnq9ih1"))
602 ("mips64el-linux"
603 (base32
604 "1m5miqkyng45l745n0sfafdpjkqv9225xf44jqkygwsipj2cv9ks")))))))))
605 (native-search-paths
606 (list (search-path-specification
607 (variable "CPATH")
608 (files '("include")))
609 (search-path-specification
610 (variable "LIBRARY_PATH")
611 (files '("lib" "lib64")))))
612 (synopsis "Bootstrap binaries of the GNU Compiler Collection")
613 (description synopsis)
614 (home-page #f)
615 (license gpl3+)))
616
617 (define %bootstrap-mescc-tools
618 ;; The initial MesCC tools. Uses binaries from a tarball typically built by
619 ;; %MESCC-TOOLS-BOOTSTRAP-TARBALL.
620 (package
621 (name "bootstrap-mescc-tools")
622 (version "0.5.2")
623 (source #f)
624 (build-system trivial-build-system)
625 (arguments
626 `(#:guile ,%bootstrap-guile
627 #:modules ((guix build utils))
628 #:builder
629 (begin
630 (use-modules (guix build utils)
631 (ice-9 popen))
632 (let ((out (assoc-ref %outputs "out"))
633 (tar (assoc-ref %build-inputs "tar"))
634 (xz (assoc-ref %build-inputs "xz"))
635 (tarball (assoc-ref %build-inputs "tarball")))
636
637 (mkdir out)
638 (copy-file tarball "binaries.tar.xz")
639 (invoke xz "-d" "binaries.tar.xz")
640 (let ((builddir (getcwd))
641 (bindir (string-append out "/bin")))
642 (with-directory-excursion out
643 (invoke tar "xvf"
644 (string-append builddir "/binaries.tar"))))))))
645 (inputs
646 `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
647 ("xz" ,(search-bootstrap-binary "xz" (%current-system)))
648 ("tarball"
649 ,(bootstrap-origin
650 (origin
651 (method url-fetch)
652 (uri (map
653 (cute string-append <>
654 "/i686-linux/20181020/"
655 "mescc-tools-static-0.5.2-0.bb062b0-i686-linux.tar.xz")
656 %bootstrap-base-urls))
657 (sha256
658 (base32
659 "11lniw0vg61kmyhvnwkmcnkci9ym6hbmiksiqggd0hkipbq7hvlz")))))))
660 (synopsis "Bootstrap binaries of MesCC Tools")
661 (description synopsis)
662 (home-page #f)
663 (supported-systems '("i686-linux" "x86_64-linux"))
664 (license gpl3+)))
665
666 (define %bootstrap-mes
667 ;; The initial Mes. Uses binaries from a tarball typically built by
668 ;; %MES-BOOTSTRAP-TARBALL.
669 (package
670 (name "bootstrap-mes")
671 (version "0")
672 (source #f)
673 (build-system trivial-build-system)
674 (arguments
675 `(#:guile ,%bootstrap-guile
676 #:modules ((guix build utils))
677 #:builder
678 (begin
679 (use-modules (guix build utils)
680 (ice-9 popen))
681 (let ((out (assoc-ref %outputs "out"))
682 (tar (assoc-ref %build-inputs "tar"))
683 (xz (assoc-ref %build-inputs "xz"))
684 (tarball (assoc-ref %build-inputs "tarball")))
685
686 (mkdir out)
687 (copy-file tarball "binaries.tar.xz")
688 (invoke xz "-d" "binaries.tar.xz")
689 (let ((builddir (getcwd))
690 (bindir (string-append out "/bin")))
691 (with-directory-excursion out
692 (invoke tar "xvf"
693 (string-append builddir "/binaries.tar"))))))))
694 (inputs
695 `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
696 ("xz" ,(search-bootstrap-binary "xz" (%current-system)))
697 ("tarball"
698 ,(bootstrap-origin
699 (origin
700 (method url-fetch)
701 (uri (map
702 (cute string-append <>
703 "/i686-linux/20181020/"
704 "mes-minimal-stripped-0.19-i686-linux.tar.xz")
705 %bootstrap-base-urls))
706 (sha256
707 (base32
708 "0k7kkl68a6xaadv47ij0nr9jm5ca1ffj38n7f2lg80y72wdkwr9h")))))))
709 (supported-systems '("i686-linux" "x86_64-linux"))
710 (synopsis "Bootstrap binaries of Mes")
711 (description synopsis)
712 (home-page #f)
713 (license gpl3+)))
714
715 (define (%bootstrap-inputs)
716 ;; The initial, pre-built inputs. From now on, we can start building our
717 ;; own packages.
718 `(,@(match (%current-system)
719 ((or "i686-linux" "x86_64-linux")
720 `(("linux-libre-headers" ,%bootstrap-linux-libre-headers)
721 ("bootstrap-mescc-tools" ,%bootstrap-mescc-tools)
722 ("mes" ,%bootstrap-mes)))
723 (_
724 `(("libc" ,%bootstrap-glibc)
725 ("gcc" ,%bootstrap-gcc)
726 ("binutils" ,%bootstrap-binutils))))
727 ("coreutils&co" ,%bootstrap-coreutils&co)
728
729 ;; In gnu-build-system.scm, we rely on the availability of Bash.
730 ("bash" ,%bootstrap-coreutils&co)))
731
732 ;;; bootstrap.scm ends here