bootstrap: Switch to official bootstrap urls.
[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 %srfi-43))
55
56 ;;; Commentary:
57 ;;;
58 ;;; Pre-built packages that are used to bootstrap the
59 ;;; distribution--i.e., to build all the core packages from scratch.
60 ;;;
61 ;;; Code:
62
63
64 \f
65 ;;;
66 ;;; Helper procedures.
67 ;;;
68
69 (define (bootstrap-origin source)
70 "Return a variant of SOURCE, an <origin> instance, whose method uses
71 %BOOTSTRAP-GUILE to do its job."
72 (define (boot fetch)
73 (lambda* (url hash-algo hash
74 #:optional name #:key system)
75 (fetch url hash-algo hash name
76 #:guile %bootstrap-guile
77 #:system system)))
78
79 (define %bootstrap-patch-inputs
80 ;; Packages used when an <origin> has a non-empty 'patches' field.
81 `(("tar" ,%bootstrap-coreutils&co)
82 ("xz" ,%bootstrap-coreutils&co)
83 ("bzip2" ,%bootstrap-coreutils&co)
84 ("gzip" ,%bootstrap-coreutils&co)
85 ("patch" ,%bootstrap-coreutils&co)))
86
87 (let ((orig-method (origin-method source)))
88 (origin (inherit source)
89 (method (cond ((eq? orig-method url-fetch)
90 (boot url-fetch))
91 (else orig-method)))
92 (patch-guile %bootstrap-guile)
93 (patch-inputs %bootstrap-patch-inputs)
94
95 ;; Patches can be origins as well, so process them.
96 (patches (map (match-lambda
97 ((? origin? patch)
98 (bootstrap-origin patch))
99 (patch patch))
100 (origin-patches source))))))
101
102 (define* (package-from-tarball name source program-to-test description
103 #:key snippet)
104 "Return a package that correspond to the extraction of SOURCE.
105 PROGRAM-TO-TEST is #f or a string: the program to run after extraction of
106 SOURCE to check whether everything is alright. If SNIPPET is provided, it is
107 evaluated after extracting SOURCE. SNIPPET should return true if successful,
108 or false to signal an error."
109 (package
110 (name name)
111 (version "0")
112 (build-system trivial-build-system)
113 (arguments
114 `(#:guile ,%bootstrap-guile
115 #:modules ((guix build utils))
116 #:builder
117 (begin
118 (use-modules (guix build utils))
119
120 (let ((out (assoc-ref %outputs "out"))
121 (tar (assoc-ref %build-inputs "tar"))
122 (xz (assoc-ref %build-inputs "xz"))
123 (tarball (assoc-ref %build-inputs "tarball")))
124
125 (mkdir out)
126 (copy-file tarball "binaries.tar.xz")
127 (invoke xz "-d" "binaries.tar.xz")
128 (let ((builddir (getcwd)))
129 (with-directory-excursion out
130 (invoke tar "xvf"
131 (string-append builddir "/binaries.tar"))
132 ,@(if snippet (list snippet) '())
133 (or (not ,program-to-test)
134 (invoke (string-append "bin/" ,program-to-test)
135 "--version"))))))))
136 (inputs
137 `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
138 ("xz" ,(search-bootstrap-binary "xz" (%current-system)))
139 ("tarball" ,(bootstrap-origin (source (%current-system))))))
140 (source #f)
141 (synopsis description)
142 (description description)
143 (home-page #f)
144 (license gpl3+)))
145
146 (define package-with-bootstrap-guile
147 (mlambdaq (p)
148 "Return a variant of P such that all its origins are fetched with
149 %BOOTSTRAP-GUILE."
150 (define rewritten-input
151 (match-lambda
152 ((name (? origin? o))
153 `(,name ,(bootstrap-origin o)))
154 ((name (? package? p) sub-drvs ...)
155 `(,name ,(package-with-bootstrap-guile p) ,@sub-drvs))
156 (x x)))
157
158 (package (inherit p)
159 (source (match (package-source p)
160 ((? origin? o) (bootstrap-origin o))
161 (s s)))
162 (inputs (map rewritten-input
163 (package-inputs p)))
164 (native-inputs (map rewritten-input
165 (package-native-inputs p)))
166 (propagated-inputs (map rewritten-input
167 (package-propagated-inputs p)))
168 (replacement (and=> (package-replacement p)
169 package-with-bootstrap-guile)))))
170
171 (define* (glibc-dynamic-linker
172 #:optional (system (or (and=> (%current-target-system)
173 gnu-triplet->nix-system)
174 (%current-system))))
175 "Return the name of Glibc's dynamic linker for SYSTEM."
176 ;; See the 'SYSDEP_KNOWN_INTERPRETER_NAMES' cpp macro in libc.
177 (cond ((string=? system "x86_64-linux") "/lib/ld-linux-x86-64.so.2")
178 ((string=? system "i686-linux") "/lib/ld-linux.so.2")
179 ((string=? system "armhf-linux") "/lib/ld-linux-armhf.so.3")
180 ((string=? system "mips64el-linux") "/lib/ld.so.1")
181 ((string=? system "i586-gnu") "/lib/ld.so.1")
182 ((string=? system "i686-gnu") "/lib/ld.so.1")
183 ((string=? system "aarch64-linux") "/lib/ld-linux-aarch64.so.1")
184 ((string=? system "powerpc-linux") "/lib/ld.so.1")
185 ((string=? system "powerpc64le-linux") "/lib/ld64.so.2")
186 ((string=? system "alpha-linux") "/lib/ld-linux.so.2")
187 ((string=? system "s390x-linux") "/lib/ld64.so.1")
188
189 ;; XXX: This one is used bare-bones, without a libc, so add a case
190 ;; here just so we can keep going.
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 (license gpl3+)))
664
665 (define %bootstrap-mes
666 ;; The initial Mes. Uses binaries from a tarball typically built by
667 ;; %MES-BOOTSTRAP-TARBALL.
668 (package
669 (name "bootstrap-mes")
670 (version "0")
671 (source #f)
672 (build-system trivial-build-system)
673 (arguments
674 `(#:guile ,%bootstrap-guile
675 #:modules ((guix build utils))
676 #:builder
677 (begin
678 (use-modules (guix build utils)
679 (ice-9 popen))
680 (let ((out (assoc-ref %outputs "out"))
681 (tar (assoc-ref %build-inputs "tar"))
682 (xz (assoc-ref %build-inputs "xz"))
683 (tarball (assoc-ref %build-inputs "tarball")))
684
685 (mkdir out)
686 (copy-file tarball "binaries.tar.xz")
687 (invoke xz "-d" "binaries.tar.xz")
688 (let ((builddir (getcwd))
689 (bindir (string-append out "/bin")))
690 (with-directory-excursion out
691 (invoke tar "xvf"
692 (string-append builddir "/binaries.tar"))))))))
693 (inputs
694 `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
695 ("xz" ,(search-bootstrap-binary "xz" (%current-system)))
696 ("tarball"
697 ,(bootstrap-origin
698 (origin
699 (method url-fetch)
700 (uri (map
701 (cute string-append <>
702 "/i686-linux/20181020/"
703 "mes-minimal-stripped-0.18-0.08f04f5-i686-linux.tar.xz")
704 %bootstrap-base-urls))
705 (sha256
706 (match (%current-system)
707 ((or "i686-linux" "x86_64-linux")
708 (base32
709 "0qwpby91hp6afmg5ibdrrk3fw85zxdazfk7rhrdsihsfzqwmfhfx")))))))))
710 (synopsis "Bootstrap binaries of Mes")
711 (description synopsis)
712 (home-page #f)
713 (license gpl3+)))
714
715 (define %srfi-43
716 (origin
717 (method url-fetch)
718 (uri "http://git.savannah.gnu.org/cgit/guile.git/plain/module/srfi/srfi-43.scm?h=stable-2.0")
719 (file-name "srfi-43.scm")
720 (sha256
721 (base32
722 "0rnkppwdkxbzkgp9s9ccmby9f7p3ijxjlmvj0pzqxwmrmpy7jwmb"))))
723
724 (define (%bootstrap-inputs)
725 ;; The initial, pre-built inputs. From now on, we can start building our
726 ;; own packages.
727 `(,@(match (%current-system)
728 ((or "i686-linux" "x86_64-linux")
729 `(("linux-libre-headers" ,%bootstrap-linux-libre-headers)
730 ("bootstrap-mescc-tools" ,%bootstrap-mescc-tools)
731 ("mes" ,%bootstrap-mes)
732 ("srfi-43" ,%srfi-43 )))
733 (_
734 `(("libc" ,%bootstrap-glibc)
735 ("gcc" ,%bootstrap-gcc)
736 ("binutils" ,%bootstrap-binutils))))
737 ("coreutils&co" ,%bootstrap-coreutils&co)
738
739 ;; In gnu-build-system.scm, we rely on the availability of Bash.
740 ("bash" ,%bootstrap-coreutils&co)))
741
742 ;;; bootstrap.scm ends here