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