build-system/gnu: 'package-with-explicit-inputs' uses 'package-mapping'.
[jackhill/guix/guix.git] / gnu / packages / commencement.scm
CommitLineData
bdb36958 1;;; GNU Guix --- Functional package management for GNU
b644008c 2;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
bdb36958
LC
3;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
4;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
13f7f2fd 5;;; Copyright © 2014, 2015, 2017 Mark H Weaver <mhw@netris.org>
5fe2c549 6;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
53bfec7b 7;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
a2b2070b 8;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
01e8263f 9;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
bdb36958
LC
10;;;
11;;; This file is part of GNU Guix.
12;;;
13;;; GNU Guix is free software; you can redistribute it and/or modify it
14;;; under the terms of the GNU General Public License as published by
15;;; the Free Software Foundation; either version 3 of the License, or (at
16;;; your option) any later version.
17;;;
18;;; GNU Guix is distributed in the hope that it will be useful, but
19;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;;; GNU General Public License for more details.
22;;;
23;;; You should have received a copy of the GNU General Public License
24;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26(define-module (gnu packages commencement)
27 #:use-module ((guix licenses)
28 #:select (gpl3+ lgpl2.0+ public-domain))
b2fd8f63 29 #:use-module (gnu packages)
bdb36958
LC
30 #:use-module (gnu packages bootstrap)
31 #:use-module (gnu packages base)
32 #:use-module (gnu packages bash)
0b652851 33 #:use-module (gnu packages c)
bdb36958 34 #:use-module (gnu packages gcc)
2d5d63d7 35 #:use-module (gnu packages m4)
c00a9fbf 36 #:use-module (gnu packages file)
bdb36958 37 #:use-module (gnu packages gawk)
2d5d63d7 38 #:use-module (gnu packages bison)
d75acc29 39 #:use-module (gnu packages flex)
bdb36958 40 #:use-module (gnu packages guile)
6162b95d 41 #:use-module (gnu packages gettext)
bdb36958
LC
42 #:use-module (gnu packages multiprecision)
43 #:use-module (gnu packages compression)
0b652851 44 #:use-module (gnu packages mes)
bdb36958 45 #:use-module (gnu packages perl)
5f3f7039 46 #:use-module (gnu packages python)
bdb36958 47 #:use-module (gnu packages linux)
d75acc29 48 #:use-module (gnu packages hurd)
bdb36958
LC
49 #:use-module (gnu packages texinfo)
50 #:use-module (gnu packages pkg-config)
5f3f7039 51 #:use-module (gnu packages xml)
bdb36958
LC
52 #:use-module (guix packages)
53 #:use-module (guix download)
54 #:use-module (guix build-system gnu)
55 #:use-module (guix build-system trivial)
8102cf0b 56 #:use-module (guix memoization)
bdb36958
LC
57 #:use-module (guix utils)
58 #:use-module (srfi srfi-1)
59 #:use-module (srfi srfi-26)
60 #:use-module (ice-9 vlist)
d75acc29 61 #:use-module (ice-9 match)
6869b663
CD
62 #:use-module (ice-9 regex)
63 #:export (make-gcc-toolchain))
bdb36958
LC
64
65;;; Commentary:
66;;;
67;;; This is the commencement, this is where things start. Before the
68;;; commencement, of course, there's the 'bootstrap' module, which provides us
69;;; with the initial binaries. This module uses those bootstrap binaries to
70;;; actually build up the whole tool chain that make up the implicit inputs of
71;;; 'gnu-build-system'.
72;;;
73;;; To avoid circular dependencies, this module should not be imported
74;;; directly from anywhere.
75;;;
a1df45e9
CM
76;;; Below, we frequently use "inherit" to create modified packages. The
77;;; reason why we use "inherit" instead of "package/inherit" is because we do
78;;; not want these commencement packages to inherit grafts. By definition,
79;;; these packages are not depended on at run time by any of the packages we
80;;; use. Thus it does not make sense to inherit grafts. Furthermore, those
81;;; grafts would often lead to extra overhead for users who would end up
82;;; downloading those "-boot0" packages just to build package replacements
83;;; that are in fact not going to be used.
84;;;
bdb36958
LC
85;;; Code:
86
0b652851 87(define mes-boot
9a45a24f
LC
88 (package
89 (inherit mes)
90 (name "mes-boot")
91 (version "0.19")
92 (source (origin
93 (method url-fetch)
94 (uri (string-append "mirror://gnu/mes/"
95 "mes-" version ".tar.gz"))
96 (sha256
97 (base32
98 "15h4yhaywdc0djpjlin2jz1kzahpqxfki0r0aav1qm9nxxmnp1l0"))))
99 (inputs '())
100 (propagated-inputs '())
101 (native-inputs
102 `(("mescc-tools" ,%bootstrap-mescc-tools)
103 ("nyacc-source" ,(bootstrap-origin
104 (package-source nyacc-0.86)))
0b652851 105
9a45a24f
LC
106 ("coreutils" , %bootstrap-coreutils&co)
107 ("bootstrap-mes" ,%bootstrap-mes)))
108 (arguments
109 `(#:implicit-inputs? #f
110 #:guile ,%bootstrap-guile
111 #:strip-binaries? #f ; binutil's strip b0rkes MesCC/M1/hex2 binaries
112 #:phases
113 (modify-phases %standard-phases
114 (add-after 'unpack 'unpack-seeds
115 (lambda _
116 (let ((nyacc-source (assoc-ref %build-inputs "nyacc-source"))
117 (bootstrap-mes (assoc-ref %build-inputs "bootstrap-mes")))
118 (with-directory-excursion ".."
119 (mkdir-p "nyacc-source")
120 (invoke "tar" "--strip=1" "-C" "nyacc-source" "-xvf" nyacc-source)
121 (symlink (string-append bootstrap-mes "/share/mes/lib") "mes-seed"))
122 #t)))
123 (replace 'configure
124 (lambda* (#:key outputs #:allow-other-keys)
125 (let ((out (assoc-ref %outputs "out")))
126 (setenv "GUILE" "mes")
127 (setenv "GUILE_EFFECTIVE_VERSION" "2.2")
128 (setenv "GUILE_LOAD_PATH" "nyacc")
129 (symlink (string-append "../nyacc-source/module") "nyacc")
130 (invoke "bash" "configure.sh"
131 (string-append "--prefix=" out)))))
132 (replace 'build
133 (lambda _
134 (let ((mes (assoc-ref %build-inputs "bootstrap-mes")))
135 (setenv "MES_PREFIX" (string-append mes "/share/mes"))
136 (setenv "MES_ARENA" "100000000")
137 (setenv "MES_MAX_ARENA" "100000000")
138 (setenv "MES_STACK" "10000000")
139 (invoke "sh" "bootstrap.sh"))))
140 (replace 'check
141 (lambda _
142 (setenv "DIFF" "sh scripts/diff.scm")
143 ;; fail fast tests
144 ;; (invoke "sh" "-x" "build-aux/test.sh" "scaffold/tests/t")
145 ;; (invoke "sh" "-x" "build-aux/test.sh" "scaffold/tests/63-struct-cell")
146 (invoke "sh" "check.sh")))
147 (replace 'install
148 (lambda _
149 (invoke "sh" "install.sh"))))))
150 (native-search-paths
151 ;; Use the language-specific variables rather than 'CPATH' because they
152 ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'.
153 ;; The intent is to allow headers that are in the search path to be
154 ;; treated as "system headers" (headers exempt from warnings) just like
155 ;; the typical /usr/include headers on an FHS system.
156 (list (search-path-specification
157 (variable "C_INCLUDE_PATH")
158 (files '("share/mes/include")))
159 (search-path-specification
160 (variable "LIBRARY_PATH")
161 (files '("share/mes/lib")))))))
0b652851
JN
162
163(define tcc-boot0
164 ;; Pristine tcc cannot be built by MesCC, we are keeping a delta of 11
165 ;; patches. In a very early and rough form they were presented to the
166 ;; TinyCC developers, who at the time showed no interest in supporting the
167 ;; bootstrappable effort; we will try again later. These patches have been
168 ;; ported to 0.9.27, alas the resulting tcc is buggy. Once MesCC is more
169 ;; mature, this package should use the 0.9.27 sources (or later).
170 (let ((version "0.9.26")
b02dc758
JN
171 (revision "6")
172 (commit "c004e9a34fb026bb44d211ab98bb768e79900eef"))
9a45a24f
LC
173 (package
174 (inherit tcc)
175 (name "tcc-boot0")
176 (version (string-append version "-" revision "." (string-take commit 7)))
177 (source (origin
178 (method url-fetch)
179 (uri (string-append "https://gitlab.com/janneke/tinycc"
180 "/-/archive/" commit
181 "/tinycc-" commit ".tar.gz"))
182 (sha256
183 (base32
184 "1hmzn1pq0x22ppd80hyrn5qzqq94mxd0ychzj6vrr2vnj2frjv5b"))))
185 (build-system gnu-build-system)
186 (supported-systems '("i686-linux" "x86_64-linux"))
187 (inputs '())
188 (propagated-inputs '())
189 (native-inputs
190 `(("mes" ,mes-boot)
191 ("mescc-tools" ,%bootstrap-mescc-tools)
192 ("nyacc-source" ,(bootstrap-origin
193 (package-source nyacc-0.86)))
0b652851 194
9a45a24f
LC
195 ("coreutils" , %bootstrap-coreutils&co)
196 ("bootstrap-mes" ,%bootstrap-mes)))
197 (arguments
198 `(#:implicit-inputs? #f
199 #:guile ,%bootstrap-guile
200 #:strip-binaries? #f ; binutil's strip b0rkes MesCC/M1/hex2 binaries
201 #:phases
202 (modify-phases %standard-phases
203 (add-after 'unpack 'unpack-seeds
204 (lambda* (#:key outputs #:allow-other-keys)
205 (let* ((coreutils (assoc-ref %build-inputs "coreutils"))
206 (nyacc-source (assoc-ref %build-inputs "nyacc-source"))
207 (bootstrap-mes (assoc-ref %build-inputs "bootstrap-mes")))
208 (setenv "PATH" (string-append
209 coreutils "/bin"))
210 (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
211 (with-directory-excursion ".."
212 (mkdir-p "nyacc-source")
213 (invoke "tar" "--strip=1" "-C" "nyacc-source"
214 "-xvf" nyacc-source)
215 (symlink (string-append bootstrap-mes "/share/mes/lib") "mes-seed"))
216 #t)))
217 (replace 'configure
218 (lambda* (#:key outputs #:allow-other-keys)
219 (let* ((out (assoc-ref %outputs "out"))
220 (dir (with-directory-excursion ".." (getcwd)))
221 (coreutils (assoc-ref %build-inputs "coreutils"))
222 (mes (assoc-ref %build-inputs "mes"))
223 (mescc-tools (assoc-ref %build-inputs "mescc-tools"))
224 (libc (assoc-ref %build-inputs "libc"))
225 (interpreter (if libc
226 ;; also for x86_64-linux, we are still on i686-linux
227 (string-append libc ,(glibc-dynamic-linker "i686-linux"))
228 (string-append mes "/lib/mes-loader"))))
229 (setenv "PATH" (string-append
230 coreutils "/bin"
231 ":" mes "/bin"
232 ":" mescc-tools "/bin"))
233 (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
0b652851 234
9a45a24f
LC
235 (setenv "PREFIX" out)
236 (symlink (string-append mes "/share/mes") "mes")
237 (symlink (string-append "../nyacc-source/module") "nyacc")
238 (setenv "MES_PREFIX" "mes")
239 (setenv "MES_ARENA" "100000000")
240 (setenv "MES_MAX_ARENA" "100000000")
241 (setenv "MES_STACK" "10000000")
242 (setenv "MES" "mes")
243 (setenv "GUILE_LOAD_PATH" "nyacc")
244 (invoke "sh" "configure"
245 "--prefix=$PREFIX"
246 (string-append "--elfinterp=" interpreter)
247 "--crtprefix=."
248 "--tccdir=."))))
249 (replace 'build
250 (lambda _
251 (substitute* "bootstrap.sh"
252 (("^ cmp") "# cmp"))
253 (invoke "sh" "bootstrap.sh")))
254 (replace 'check
255 (lambda _
256 (setenv "DIFF" "diff.scm")
257 (setenv "OBJDUMP" "true")
258 ;; fail fast tests
259 ;; (invoke "sh" "test.sh" "mes/scaffold/tests/30-strlen")
260 ;; (invoke "sh" "-x" "test.sh" "mes/scaffold/tinycc/00_assignment")
261 (setenv "TCC" "./tcc")
262 (invoke "sh" "check.sh")))
263 (replace 'install
264 (lambda _
265 (invoke "sh" "install.sh"))))))
266 (native-search-paths
267 ;; Use the language-specific variables rather than 'CPATH' because they
268 ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'.
269 ;; The intent is to allow headers that are in the search path to be
270 ;; treated as "system headers" (headers exempt from warnings) just like
271 ;; the typical /usr/include headers on an FHS system.
272 (list (search-path-specification
273 (variable "C_INCLUDE_PATH")
274 (files '("include")))
275 (search-path-specification
276 (variable "LIBRARY_PATH")
277 (files '("lib"))))))))
0b652851
JN
278
279(define tcc-boot
9a45a24f
LC
280 (package
281 (inherit tcc-boot0)
282 (name "tcc-boot")
283 (version "0.9.27")
284 (source (bootstrap-origin
285 (origin
0b652851 286 (inherit (package-source tcc))
9a45a24f
LC
287 (patches (search-patches "tcc-boot-0.9.27.patch")))))
288 (build-system gnu-build-system)
289 (inputs '())
290 (propagated-inputs '())
291 (native-inputs
292 `(("mes" ,mes-boot)
293 ("tcc" ,tcc-boot0)
0b652851 294
9a45a24f
LC
295 ("coreutils" , %bootstrap-coreutils&co)))
296 (arguments
297 `(#:implicit-inputs? #f
298 #:guile ,%bootstrap-guile
299
300 ;; Binutils' 'strip' b0rkes MesCC/M1/hex2 binaries, tcc-boot also comes
301 ;; with MesCC/M1/hex2-built binaries.
302 #:strip-binaries? #f
303
304 #:phases
305 (modify-phases %standard-phases
306 (replace 'configure
307 (lambda* (#:key outputs #:allow-other-keys)
308 (let* ((out (assoc-ref %outputs "out"))
309 (coreutils (assoc-ref %build-inputs "coreutils"))
310 (mes (assoc-ref %build-inputs "mes"))
311 (tcc (assoc-ref %build-inputs "tcc"))
312 (libc (assoc-ref %build-inputs "libc"))
313 (interpreter (if libc
314 ;; also for x86_64-linux, we are still on i686-linux
315 (string-append libc ,(glibc-dynamic-linker "i686-linux"))
316 (string-append mes "/lib/mes-loader"))))
317 ;; unpack
318 (setenv "PATH" (string-append
319 coreutils "/bin"
320 ":" tcc "/bin"))
321 (format (current-error-port) "PATH=~s\n" (getenv "PATH"))
322 (invoke "sh" "configure"
323 (string-append "--cc=tcc")
324 (string-append "--cpu=i386")
325 (string-append "--prefix=" out)
326 (string-append "--elfinterp=" interpreter)
327 (string-append "--crtprefix=" tcc "/lib")
328 (string-append "--sysincludepaths=" tcc "/include")
329 (string-append "--libpaths=" tcc "/lib")))))
330 (replace 'build
331 (lambda* (#:key outputs #:allow-other-keys)
332 (let* ((out (assoc-ref %outputs "out"))
333 (mes (assoc-ref %build-inputs "mes"))
334 (tcc (assoc-ref %build-inputs "tcc"))
335 (libc (assoc-ref %build-inputs "libc"))
336 (interpreter (if libc
337 ;; also for x86_64-linux, we are still on i686-linux
338 (string-append libc ,(glibc-dynamic-linker "i686-linux"))
339 (string-append mes "/lib/mes-loader"))))
340 (invoke "tcc"
341 "-vvv"
342 "-D" "BOOTSTRAP=1"
343 "-D" "ONE_SOURCE=1"
344 "-D" "TCC_TARGET_I386=1"
345 "-D" "CONFIG_TCC_STATIC=1"
346 "-D" "CONFIG_USE_LIBGCC=1"
347 "-D" (string-append "CONFIG_TCCDIR=\"" out "/lib/tcc\"")
348 "-D" (string-append "CONFIG_TCC_CRTPREFIX=\"" out "/lib:{B}/lib:.\"")
349 "-D" (string-append "CONFIG_TCC_CRTPREFIX=\"" out
350 "/lib:{B}/lib:.\"")
351 "-D" (string-append "CONFIG_TCC_ELFINTERP=\"" interpreter "\"")
352 "-D" (string-append "CONFIG_TCC_LIBPATHS=\"" tcc "/lib:{B}/lib:.\"")
353 "-D" (string-append "CONFIG_TCC_SYSINCLUDEPATHS=\"" tcc "/include" ":/include:{B}/include\"")
354 "-D" (string-append "TCC_LIBGCC=\"" tcc "/lib/libc.a\"")
355 "-o" "tcc"
356 "tcc.c"))))
357 (replace 'check
358 (lambda _
359 ;; FIXME: add sensible check target (without depending on make)
360 ;; ./check.sh ?
361 (= 1 (status:exit-val (system* "./tcc" "--help")))))
362 (replace 'install
363 (lambda* (#:key outputs #:allow-other-keys)
364 (let ((out (assoc-ref %outputs "out"))
365 (tcc (assoc-ref %build-inputs "tcc")))
366 (mkdir-p (string-append out "/bin"))
367 (copy-file "tcc" (string-append out "/bin/tcc"))
368 (mkdir-p (string-append out "/lib/tcc"))
369 (copy-recursively (string-append tcc "/include")
370 (string-append out "/include"))
371 (copy-recursively (string-append tcc "/lib")
372 (string-append out "/lib"))
373 (invoke "tcc" "-D" "TCC_TARGET_I386=1" "-c" "-o" "libtcc1.o" "lib/libtcc1.c")
374 (invoke "tcc" "-ar" "rc" "libtcc1.a" "libtcc1.o")
375 (copy-file "libtcc1.a" (string-append out "/lib/libtcc1.a"))
376 (delete-file (string-append out "/lib/tcc/libtcc1.a"))
377 (copy-file "libtcc1.a" (string-append out "/lib/tcc/libtcc1.a"))
378 #t))))))))
0b652851
JN
379
380(define make-mesboot0
9a45a24f
LC
381 (package
382 (inherit gnu-make)
383 (name "make-mesboot0")
384 (version "3.80")
385 (source (origin
386 (method url-fetch)
387 (uri (string-append "mirror://gnu/make/make-"
388 version ".tar.gz"))
389 (sha256
390 (base32
391 "1pb7fb7fqf9wz9najm85qdma1xhxzf1rhj5gwrlzdsz2zm0hpcv4"))))
392 (supported-systems '("i686-linux" "x86_64-linux"))
393 (inputs '())
394 (propagated-inputs '())
395 (native-inputs `(("tcc" ,tcc-boot)
0b652851 396
9a45a24f
LC
397 ("bash" ,%bootstrap-coreutils&co)
398 ("coreutils" ,%bootstrap-coreutils&co)))
399 (arguments
400 `(#:implicit-inputs? #f
401 #:tests? #f ; check depends on perl
402 #:guile ,%bootstrap-guile
403 #:configure-flags `("CC=tcc -DO_RDONLY=0"
404 "LD=tcc"
405 "--disable-nls")
406 #:phases
407 (modify-phases %standard-phases
408 (add-after 'configure 'configure-fixup
409 (lambda _
410 (substitute* "build.sh"
411 (("^REMOTE=.*") "REMOTE=stub\n")
412 (("^extras=.*") "extras=getloadavg.c\n"))
413 (substitute* "make.h"
414 (("^extern long int lseek.*" all) (string-append "// " all)))
415 #t))
416 (delete 'patch-generated-file-shebangs) ; no perl
417 (replace 'build
418 (lambda _
419 (invoke "sh" "./build.sh")))
420 (replace 'install
421 (lambda* (#:key outputs #:allow-other-keys)
422 (let* ((out (assoc-ref outputs "out"))
423 (bin (string-append out "/bin")))
424 (install-file "make" bin)
425 #t))))))))
0b652851
JN
426
427(define diffutils-mesboot
9a45a24f
LC
428 (package
429 (inherit diffutils)
430 (name "diffutils-mesboot")
431 (version "2.7")
432 (source (origin
433 (method url-fetch)
434 (uri (string-append "mirror://gnu/diffutils/diffutils-"
435 version ".tar.gz"))
436 (sha256
437 (base32
438 "1mirn5i825bn5w7rh6mgn0r8aj9xqanav95dwcl1b8sn82f4iwnm"))))
439 (supported-systems '("i686-linux" "x86_64-linux"))
440 (inputs '())
441 (propagated-inputs '())
442 (native-inputs `(("mes" ,mes-boot)
443 ("tcc" ,tcc-boot)
0b652851 444
9a45a24f
LC
445 ("bash" ,%bootstrap-coreutils&co)
446 ("coreutils" ,%bootstrap-coreutils&co)
447 ("make" ,make-mesboot0)))
448 (arguments
449 `(#:implicit-inputs? #f
450 #:guile ,%bootstrap-guile
451 #:parallel-build? #f
452 #:tests? #f ; check is naive, also checks non-built PROGRAMS
453 #:strip-binaries? #f ; no strip yet
454 #:phases
455 (modify-phases %standard-phases
456 ;; diffutils-2.7 needs more traditional configure
457 (replace 'configure
458 (lambda* (#:key outputs #:allow-other-keys)
459 (let ((out (assoc-ref outputs "out"))
460 (bash (assoc-ref %build-inputs "bash")))
461 (setenv "CONFIG_SHELL" (string-append bash "/bin/sh"))
462 (setenv "CC" "tcc")
463 (setenv "LD" "tcc")
464 (invoke "./configure" (string-append "--prefix=" out)))))
465 (add-before 'configure 'remove-diff3-sdiff
466 (lambda* (#:key outputs #:allow-other-keys)
467 (substitute* "Makefile.in"
468 (("PROGRAMS = .*" all) "PROGRAMS = cmp diff"))
469 #t)))))))
0b652851
JN
470
471(define binutils-mesboot0
9a45a24f
LC
472 (package
473 (inherit binutils)
474 (name "binutils-mesboot0")
475 (version "2.20.1a")
476 (source (bootstrap-origin
477 (origin
0b652851
JN
478 (method url-fetch)
479 (uri (string-append "mirror://gnu/binutils/binutils-"
480 version ".tar.bz2"))
481 (patches (search-patches "binutils-boot-2.20.1a.patch"))
482 (sha256
483 (base32
9a45a24f
LC
484 "0r7dr0brfpchh5ic0z9r4yxqn4ybzmlh25sbp30cacqk8nb7rlvi")))))
485 (inputs '())
486 (propagated-inputs '())
487 (native-inputs `(("tcc" ,tcc-boot)
0b652851 488
9a45a24f
LC
489 ("bash" ,%bootstrap-coreutils&co)
490 ("coreutils" ,%bootstrap-coreutils&co)
491 ("diffutils" ,diffutils-mesboot)
492 ("make" ,make-mesboot0)))
493 (supported-systems '("i686-linux" "x86_64-linux"))
494 (arguments
495 `(#:implicit-inputs? #f
496 #:guile ,%bootstrap-guile
497 #:tests? #f ; runtest: command not found
498 #:parallel-build? #f
499 #:strip-binaries? #f ; no strip yet
500 #:configure-flags
501 (let ((cppflags (string-append " -D __GLIBC_MINOR__=6"
502 " -D MES_BOOTSTRAP=1"))
503 (bash (assoc-ref %build-inputs "bash")))
504 `(,(string-append "CONFIG_SHELL=" bash "/bin/sh")
505 ,(string-append "CPPFLAGS=" cppflags)
506 "AR=tcc -ar"
507 "CXX=false"
508 "RANLIB=true"
509 ,(string-append "CC=tcc" cppflags)
510 "--disable-nls"
511 "--disable-shared"
512 "--disable-werror"
513 "--build=i686-unknown-linux-gnu"
514 "--host=i686-unknown-linux-gnu"
515 "--with-sysroot=/"))))))
0b652851
JN
516
517(define gcc-core-mesboot
518 ;; Gcc-2.95.3 is the most recent GCC that is supported by what the Mes C
519 ;; Library v0.16 offers. Gcc-3.x (and 4.x) place higher demands on a C
520 ;; library, such as dir.h/struct DIR/readdir, locales, signals... Also,
521 ;; with gcc-2.95.3, binutils-boot-2.20.1a and glibc-2.2.5 we found a GNU
522 ;; toolchain triplet "that works".
9a45a24f
LC
523 (package
524 (inherit gcc)
525 (name "gcc-core-mesboot")
526 (version "2.95.3")
527 (source (bootstrap-origin
528 (origin
0b652851
JN
529 (method url-fetch)
530 (uri (string-append "mirror://gnu/gcc/gcc-2.95.3/gcc-core-"
531 version
532 ".tar.gz"))
533 (patches (search-patches "gcc-boot-2.95.3.patch"))
534 (sha256
535 (base32
9a45a24f
LC
536 "1xvfy4pqhrd5v2cv8lzf63iqg92k09g6z9n2ah6ndd4h17k1x0an")))))
537 (supported-systems '("i686-linux" "x86_64-linux"))
538 (inputs '())
539 (propagated-inputs '())
540 (native-inputs `(("binutils" ,binutils-mesboot0)
541 ("tcc" ,tcc-boot)
0b652851 542
9a45a24f
LC
543 ("bash" ,%bootstrap-coreutils&co)
544 ("coreutils" ,%bootstrap-coreutils&co)
545 ("diffutils" ,diffutils-mesboot)
546 ("make" ,make-mesboot0)))
547 (outputs '("out"))
548 (arguments
549 `(#:implicit-inputs? #f
550 #:guile ,%bootstrap-guile
551 #:tests? #f
552 #:parallel-build? #f
553 #:strip-binaries? #f
554 #:configure-flags
555 (let ((out (assoc-ref %outputs "out")))
556 `("--enable-static"
557 "--disable-shared"
558 "--disable-werror"
559 "--build=i686-unknown-linux-gnu"
560 "--host=i686-unknown-linux-gnu"
561 ,(string-append "--prefix=" out)))
562 #:make-flags (list
563 "CC=tcc -static -D __GLIBC_MINOR__=6"
564 "OLDCC=tcc -static -D __GLIBC_MINOR__=6"
565 "CC_FOR_BUILD=tcc -static -D __GLIBC_MINOR__=6"
566 "AR=ar"
567 "RANLIB=ranlib"
568 (string-append "LIBGCC2_INCLUDES=-I "
569 (assoc-ref %build-inputs "tcc")
570 "/include")
571 "LANGUAGES=c"
572 (string-append "BOOT_LDFLAGS="
573 " -B" (assoc-ref %build-inputs "tcc")
574 "/lib/"))
575 #:modules ((guix build gnu-build-system)
576 (guix build utils)
577 (srfi srfi-1))
578 #:phases
579 (modify-phases %standard-phases
580 ;; gcc-2.95.3 needs more traditional configure
581 (add-before 'configure 'setenv
582 (lambda* (#:key outputs #:allow-other-keys)
583 (let ((out (assoc-ref outputs "out"))
584 (bash (assoc-ref %build-inputs "bash"))
585 (tcc (assoc-ref %build-inputs "tcc"))
586 (cppflags " -D __GLIBC_MINOR__=6"))
587 (setenv "CONFIG_SHELL" (string-append bash "/bin/sh"))
588 (setenv "CPPFLAGS" cppflags)
589 (setenv "CC" (string-append "tcc" cppflags))
590 (setenv "CC_FOR_BUILD" (string-append "tcc" cppflags))
591 (setenv "CPP" (string-append "tcc -E" cppflags))
592 (with-output-to-file "config.cache"
593 (lambda _
594 (display "
0b652851 595ac_cv_c_float_format='IEEE (little-endian)'
2b5e412b 596")))
9a45a24f
LC
597 #t)))
598 (replace 'configure
599 (lambda* (#:key configure-flags #:allow-other-keys)
600 (format (current-error-port)
601 "running ./configure ~a\n" (string-join configure-flags))
602 (apply invoke "./configure" configure-flags)))
603 (add-after 'configure 'remove-info
604 (lambda _
605 ;; no info at this stage
606 (delete-file-recursively "texinfo")
607 (invoke "touch" "gcc/cpp.info" "gcc/gcc.info")))
608 (add-after 'install 'install2
609 (lambda* (#:key outputs #:allow-other-keys)
610 (let* ((tcc (assoc-ref %build-inputs "tcc"))
611 (tcc-lib (string-append tcc "/lib/x86-mes-gcc"))
612 (out (assoc-ref outputs "out"))
613 (gcc-dir (string-append
614 out "/lib/gcc-lib/i686-unknown-linux-gnu/2.95.3")))
615 (mkdir-p "tmp")
616 (zero? (system (string-append "set -x; cd tmp && ar x ../gcc/libgcc2.a")))
617 (zero? (system (string-append "set -x; cd tmp && ar r " gcc-dir "/libgcc.a *.o")))
618 (copy-file "gcc/libgcc2.a" (string-append out "/lib/libgcc2.a"))
619 (copy-file (string-append tcc "/lib/libtcc1.a")
620 (string-append out "/lib/libtcc1.a"))
621 (invoke "ar" "r" (string-append gcc-dir "/libc.a")
622 (string-append tcc-lib "/libc+gnu.o")
623 (string-append tcc-lib "/libtcc1.o"))
624 (invoke "ar" "r" (string-append out "/lib/libc.a")
625 (string-append tcc-lib "/libc+gnu.o")
626 (string-append tcc-lib "/libtcc1.o"))
627 (invoke "ls" "-ltrF" gcc-dir)
628 (copy-recursively (string-append tcc "/include")
629 (string-append out "/include"))
630 #t))))))
631 (native-search-paths
632 ;; Use the language-specific variables rather than 'CPATH' because they
633 ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'.
634 ;; The intent is to allow headers that are in the search path to be
635 ;; treated as "system headers" (headers exempt from warnings) just like
636 ;; the typical /usr/include headers on an FHS system.
637 (list (search-path-specification
638 (variable "C_INCLUDE_PATH")
639 (files '("include" "/lib/gcc-lib/i686-unknown-linux-gnu/2.95.3/include")))
640 (search-path-specification
641 (variable "LIBRARY_PATH")
642 (files '("lib")))))))
0b652851
JN
643
644(define mesboot-headers
9a45a24f
LC
645 (package
646 (inherit mes-boot)
647 (name "mesboot-headers")
648 (supported-systems '("i686-linux" "x86_64-linux"))
649 (inputs '())
650 (propagated-inputs '())
651 (native-inputs `(("coreutils" ,%bootstrap-coreutils&co)
652 ("headers" ,%bootstrap-linux-libre-headers)))
653 (arguments
654 `(#:implicit-inputs? #f
655 #:guile ,%bootstrap-guile
656 #:tests? #f
657 #:strip-binaries? #f
658 #:phases
659 (modify-phases %standard-phases
660 (delete 'configure)
661 (delete 'build)
662 (replace 'install
663 (lambda* (#:key outputs #:allow-other-keys)
664 (let* ((out (assoc-ref outputs "out"))
665 (include (string-append out "/include"))
666 (headers (assoc-ref %build-inputs "headers" )))
667 (mkdir-p include)
668 (copy-recursively "include" out)
669 (copy-recursively headers out)
670 #t))))))
671 (native-search-paths
672 ;; Use the language-specific variables rather than 'CPATH' because they
673 ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'.
674 ;; The intent is to allow headers that are in the search path to be
675 ;; treated as "system headers" (headers exempt from warnings) just like
676 ;; the typical /usr/include headers on an FHS system.
677 (list (search-path-specification
678 (variable "C_INCLUDE_PATH")
679 (files '("include")))))))
0b652851
JN
680
681(define glibc-mesboot0
682 ;; GNU C Library 2.2.5 is the most recent glibc that we managed to build
683 ;; using gcc-2.95.3. Newer versions (2.3.x, 2.6, 2.1x) seem to need a newer
684 ;; gcc.
9a45a24f
LC
685 (package
686 (inherit glibc)
687 (name "glibc-mesboot0")
688 (version "2.2.5")
689 (source (bootstrap-origin
690 (origin
0b652851
JN
691 (method url-fetch)
692 (uri (string-append "mirror://gnu/glibc/glibc-"
693 version
694 ".tar.gz"))
695 (patches (search-patches "glibc-boot-2.2.5.patch"))
696 (sha256
697 (base32
9a45a24f
LC
698 "1vl48i16gx6h68whjyhgnn1s57vqq32f9ygfa2fls7pdkbsqvp2q")))))
699 (supported-systems '("i686-linux" "x86_64-linux"))
700 (inputs '())
701 (propagated-inputs '())
702 (native-inputs `(("binutils" ,binutils-mesboot0)
703 ("gcc" ,gcc-core-mesboot)
0b652851 704
9a45a24f
LC
705 ("bash" ,%bootstrap-coreutils&co)
706 ("coreutils" ,%bootstrap-coreutils&co)
707 ("diffutils" ,diffutils-mesboot)
708 ("headers" ,mesboot-headers)
709 ("make" ,make-mesboot0)))
710 (outputs '("out"))
711 (arguments
712 `(#:implicit-inputs? #f
713 #:guile ,%bootstrap-guile
714 #:tests? #f
715 #:strip-binaries? #f
716 #:parallel-build? #f ; gcc-2.95.3 ICEs on massively parallel builds
717 #:make-flags (list (string-append
718 "SHELL="
719 (assoc-ref %build-inputs "bash")
720 "/bin/sh"))
721 #:configure-flags
722 (let ((out (assoc-ref %outputs "out"))
723 (headers (assoc-ref %build-inputs "headers")))
724 (list
725 "--disable-shared"
726 "--enable-static"
727 "--disable-sanity-checks"
728 "--build=i686-unknown-linux-gnu"
729 "--host=i686-unknown-linux-gnu"
730 (string-append "--with-headers=" headers "/include")
731 "--enable-static-nss"
732 "--without-__thread"
733 "--without-cvs"
734 "--without-gd"
735 "--without-tls"
736 (string-append "--prefix=" out)))
737 #:phases
738 (modify-phases %standard-phases
739 (add-before 'configure 'setenv
740 (lambda* (#:key outputs #:allow-other-keys)
741 (let* ((out (assoc-ref outputs "out"))
742 (bash (assoc-ref %build-inputs "bash"))
743 (gcc (assoc-ref %build-inputs "gcc"))
744 (headers (assoc-ref %build-inputs "headers"))
745 (cppflags (string-append
746 ;;" -D __STDC__=1"
747 " -D MES_BOOTSTRAP=1"
748 " -D BOOTSTRAP_GLIBC=1"))
749 (cflags (string-append " -L " (getcwd))))
750 (setenv "CONFIG_SHELL" (string-append bash "/bin/sh"))
751 (setenv "SHELL" (getenv "CONFIG_SHELL"))
752 (setenv "CPP" (string-append gcc "/bin/gcc -E " cppflags))
753 (setenv "CC" (string-append gcc "/bin/gcc " cppflags cflags))
754 #t)))
755 ;; glibc-2.2.5 needs a more classic invocation of configure
756 ;; configure: warning: CONFIG_SHELL=/gnu/store/…-bash-minimal-4.4.12/bin/bash: invalid host type
757 (replace 'configure
758 (lambda* (#:key configure-flags #:allow-other-keys)
759 (format (current-error-port)
760 "running ./configure ~a\n" (string-join configure-flags))
761 (apply invoke "./configure" configure-flags))))))
762 (native-search-paths
763 ;; Use the language-specific variables rather than 'CPATH' because they
764 ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'.
765 ;; The intent is to allow headers that are in the search path to be
766 ;; treated as "system headers" (headers exempt from warnings) just like
767 ;; the typical /usr/include headers on an FHS system.
768 (list (search-path-specification
769 (variable "C_INCLUDE_PATH")
770 (files '("include")))
771 (search-path-specification
772 (variable "CPLUS_INCLUDE_PATH")
773 (files '("include")))
774 (search-path-specification
775 (variable "LIBRARY_PATH")
776 (files '("lib")))))))
0b652851
JN
777
778(define gcc-mesboot0
9a45a24f
LC
779 (package
780 (inherit gcc-core-mesboot)
781 (name "gcc-mesboot0")
782 (native-inputs `(("binutils" ,binutils-mesboot0)
783 ("gcc" ,gcc-core-mesboot)
784 ("libc" ,glibc-mesboot0)
0b652851 785
9a45a24f
LC
786 ("bash" ,%bootstrap-coreutils&co)
787 ("coreutils" ,%bootstrap-coreutils&co)
788 ("diffutils" ,diffutils-mesboot)
789 ("kernel-headers" ,%bootstrap-linux-libre-headers)
790 ("make" ,make-mesboot0)))
791 (arguments
792 (substitute-keyword-arguments (package-arguments gcc-core-mesboot)
793 ((#:phases phases)
794 `(modify-phases ,phases
795 (replace 'setenv
796 (lambda* (#:key outputs #:allow-other-keys)
797 (let ((out (assoc-ref outputs "out"))
798 (bash (assoc-ref %build-inputs "bash"))
799 (gcc (assoc-ref %build-inputs "gcc"))
800 (glibc (assoc-ref %build-inputs "libc"))
801 (kernel-headers (assoc-ref %build-inputs "kernel-headers")))
802 (setenv "CONFIG_SHELL" (string-append bash "/bin/sh"))
803 (format (current-error-port) "C_INCLUDE_PATH=~a\n" (getenv "C_INCLUDE_PATH"))
804 (setenv "C_INCLUDE_PATH" (string-append
805 gcc "/lib/gcc-lib/i686-unknown-linux-gnu/2.95.3/include"
806 ":" kernel-headers "/include"
807 ":" glibc "/include"))
808 (format (current-error-port) "C_INCLUDE_PATH=~a\n" (getenv "C_INCLUDE_PATH"))
809 (format (current-error-port) "LIBRARY_PATH=~a\n" (getenv "LIBRARY_PATH"))
810 ;; FIXME: add glibc dirs to paths manually
811 (setenv "LIBRARY_PATH" (string-join
812 (list (string-append glibc "/lib")
813 (getenv "LIBRARY_PATH"))
814 ":"))
815 (format (current-error-port) "LIBRARY_PATH=~a\n" (getenv "LIBRARY_PATH"))
816 (with-output-to-file "config.cache"
817 (lambda _
818 (display "
0b652851
JN
819ac_cv_c_float_format='IEEE (little-endian)'
820")))
9a45a24f
LC
821 #t)))
822 (replace 'install2
823 (lambda* (#:key outputs #:allow-other-keys)
824 (let* ((out (assoc-ref outputs "out"))
825 (gcc-dir (string-append
826 out "/lib/gcc-lib/i686-unknown-linux-gnu/2.95.3")))
827 (mkdir-p "tmp")
828 (zero? (system (string-append "set -x; cd tmp && ar x ../gcc/libgcc2.a")))
829 (zero? (system (string-append "set -x; cd tmp && ar r " gcc-dir "/libgcc.a *.o")))
830 (copy-file "gcc/libgcc2.a" (string-append out "/lib/libgcc2.a"))
831 #t)))))
832 ((#:configure-flags configure-flags)
833 `(let ((out (assoc-ref %outputs "out")))
834 `("--disable-shared"
835 "--disable-werror"
836 "--build=i686-unknown-linux-gnu"
837 "--host=i686-unknown-linux-gnu"
838 ,(string-append "--prefix=" out))))
839 ((#:make-flags make-flags)
840 `(let ((gcc (assoc-ref %build-inputs "gcc")))
841 `("RANLIB=true"
842 ,(string-append "LIBGCC2_INCLUDES=-I " gcc "/include")
843 "LANGUAGES=c")))))))
0b652851
JN
844
845(define binutils-mesboot
9a45a24f
LC
846 (package
847 (inherit binutils-mesboot0)
848 (name "binutils-mesboot")
849 (native-inputs `(("binutils" ,binutils-mesboot0)
850 ("libc" ,glibc-mesboot0)
851 ("gcc" ,gcc-mesboot0)
0b652851 852
9a45a24f
LC
853 ("bash" ,%bootstrap-coreutils&co)
854 ("coreutils" ,%bootstrap-coreutils&co)
855 ("diffutils" ,diffutils-mesboot)
856 ("kernel-headers" ,%bootstrap-linux-libre-headers)
857 ("make" ,make-mesboot0)))
858 (arguments
859 (substitute-keyword-arguments (package-arguments binutils-mesboot0)
860 ((#:configure-flags configure-flags)
861 '(list "--disable-nls"
862 "--disable-shared"
863 "--disable-werror"
864 "--build=i686-unknown-linux-gnu"
865 "--host=i686-unknown-linux-gnu"
866 "--with-sysroot=/"))))))
0b652851
JN
867
868(define make-mesboot
9a45a24f
LC
869 (package
870 (inherit make-mesboot0)
871 (name "make-mesboot")
872 (version "3.82")
873 (source (origin
874 (method url-fetch)
875 (uri (string-append "mirror://gnu/make/make-"
876 version ".tar.gz"))
877 (sha256
878 (base32
879 "1rs2f9hmvy3q6zkl15jnlmnpgffm0bhw5ax0h5c7q604wqrip69x"))))
880 (native-inputs `(("binutils" ,binutils-mesboot0)
881 ("libc" ,glibc-mesboot0)
882 ("gcc" ,gcc-mesboot0)
883 ("make" ,make-mesboot0)
0b652851 884
9a45a24f
LC
885 ("bash" ,%bootstrap-coreutils&co)
886 ("coreutils" ,%bootstrap-coreutils&co)
887 ("kernel-headers" ,%bootstrap-linux-libre-headers)))
888 (arguments
889 (substitute-keyword-arguments (package-arguments make-mesboot0)
890 ((#:configure-flags configure-flags)
891 `(let ((out (assoc-ref %outputs "out")))
892 `(,(string-append "--prefix=" out))))
893 ((#:phases phases)
894 `(modify-phases ,phases
895 (delete 'configure-fixup)
896 (add-before 'configure 'setenv
897 (lambda _
898 (setenv "LIBS" "-lc -lnss_files -lnss_dns -lresolv")
899 #t))))))))
0b652851
JN
900
901(define gmp-boot
902 (package
903 (inherit gmp)
904 (version "4.3.2")
905 (source (origin
906 (method url-fetch)
907 (uri (string-append "mirror://gnu/gmp/gmp-" version
908 ".tar.gz"))
909 (sha256 (base32
910 "15rwq54fi3s11izas6g985y9jklm3xprfsmym3v1g6xr84bavqvv"))))))
911
912(define mpfr-boot
913 (package
914 (inherit mpfr)
915 (version "2.4.2")
916 (source (origin
917 (method url-fetch)
918 (uri (string-append "mirror://gnu/mpfr/mpfr-" version
919 ".tar.gz"))
920 (sha256 (base32
921 "0dxn4904dra50xa22hi047lj8kkpr41d6vb9sd4grca880c7wv94"))))))
922
923(define mpc-boot
924 (package
925 (inherit mpc)
926 (version "1.0.3")
927 (source (origin
928 (method url-fetch)
929 (uri (string-append
930 "mirror://gnu/mpc/mpc-" version ".tar.gz"))
931 (sha256
932 (base32
933 "1hzci2zrrd7v3g1jk35qindq05hbl0bhjcyyisq9z209xb3fqzb1"))))))
934
935(define gcc-mesboot1
9a45a24f
LC
936 (package
937 (inherit gcc-mesboot0)
938 (name "gcc-mesboot1")
939 (version "4.7.4")
940 (source (bootstrap-origin
941 (origin (inherit (package-source gcc-4.7))
942 (patches (search-patches "gcc-boot-4.7.4.patch")))))
943 (inputs `(("gmp-source" ,(package-source gmp-boot))
944 ("mpfr-source" ,(package-source mpfr-boot))
945 ("mpc-source" ,(package-source mpc-boot))))
946 (native-inputs `(("binutils" ,binutils-mesboot)
947 ("gcc" ,gcc-mesboot0)
948 ("libc" ,glibc-mesboot0)
0b652851 949
9a45a24f
LC
950 ("bash" ,%bootstrap-coreutils&co)
951 ("coreutils" ,%bootstrap-coreutils&co)
952 ("diffutils" ,diffutils-mesboot)
953 ("kernel-headers" ,%bootstrap-linux-libre-headers)
954 ("make" ,make-mesboot)))
955 (arguments
956 (substitute-keyword-arguments (package-arguments gcc-core-mesboot)
957 ((#:make-flags make-flags)
958 `(let* ((libc (assoc-ref %build-inputs "libc"))
959 (ldflags (string-append
960 "-B" libc "/lib "
961 "-Wl,-dynamic-linker "
962 "-Wl," libc
963 ,(glibc-dynamic-linker "i686-linux"))))
964 (list (string-append "LDFLAGS=" ldflags)
965 (string-append "LDFLAGS_FOR_TARGET=" ldflags))))
966 ((#:phases phases)
967 `(modify-phases ,phases
968 ;; c&p from commencement.scm:gcc-boot0
969 (add-after 'unpack 'unpack-gmp&co
970 (lambda* (#:key inputs #:allow-other-keys)
971 (let ((gmp (assoc-ref %build-inputs "gmp-source"))
972 (mpfr (assoc-ref %build-inputs "mpfr-source"))
973 (mpc (assoc-ref %build-inputs "mpc-source")))
0b652851 974
9a45a24f
LC
975 ;; To reduce the set of pre-built bootstrap inputs, build
976 ;; GMP & co. from GCC.
977 (for-each (lambda (source)
978 (or (invoke "tar" "xvf" source)
979 (error "failed to unpack tarball"
980 source)))
981 (list gmp mpfr mpc))
0b652851 982
9a45a24f
LC
983 ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
984 ,@(map (lambda (lib)
985 ;; Drop trailing letters, as gmp-6.0.0a unpacks
986 ;; into gmp-6.0.0.
987 `(symlink ,(string-trim-right
988 (package-full-name lib "-")
989 char-set:letter)
990 ,(package-name lib)))
991 (list gmp-boot mpfr-boot mpc-boot))
992 #t)))
993 (delete 'remove-info)
994 (replace 'setenv
995 (lambda* (#:key outputs #:allow-other-keys)
996 (let* ((out (assoc-ref outputs "out"))
997 (binutils (assoc-ref %build-inputs "binutils"))
998 (bash (assoc-ref %build-inputs "bash"))
999 (gcc (assoc-ref %build-inputs "gcc"))
1000 (glibc (assoc-ref %build-inputs "libc"))
1001 (kernel-headers (assoc-ref %build-inputs "kernel-headers")))
1002 (setenv "CONFIG_SHELL" (string-append bash "/bin/sh"))
1003 (setenv "C_INCLUDE_PATH" (string-append
1004 gcc "/lib/gcc-lib/i686-unknown-linux-gnu/2.95.3/include"
1005 ":" kernel-headers "/include"
1006 ":" glibc "/include"
1007 ":" (getcwd) "/mpfr/src"))
1008 (setenv "LIBRARY_PATH" (string-append glibc "/lib"
1009 ":" gcc "/lib"))
1010 (format (current-error-port) "C_INCLUDE_PATH=~a\n" (getenv "C_INCLUDE_PATH"))
1011 (format (current-error-port) "LIBRARY_PATH=~a\n" (getenv "LIBRARY_PATH"))
1012 #t)))
1013 (delete 'install2)))
1014 ((#:configure-flags configure-flags)
1015 `(let ((out (assoc-ref %outputs "out"))
1016 (glibc (assoc-ref %build-inputs "libc")))
1017 (list (string-append "--prefix=" out)
1018 "--build=i686-unknown-linux-gnu"
1019 "--host=i686-unknown-linux-gnu"
0b652851 1020
9a45a24f
LC
1021 (string-append "--with-native-system-header-dir=" glibc "/include")
1022 (string-append "--with-build-sysroot=" glibc "/include")
0b652851 1023
9a45a24f
LC
1024 "--disable-bootstrap"
1025 "--disable-decimal-float"
1026 "--disable-libatomic"
1027 "--disable-libcilkrts"
1028 "--disable-libgomp"
1029 "--disable-libitm"
1030 "--disable-libmudflap"
1031 "--disable-libquadmath"
1032 "--disable-libsanitizer"
1033 "--disable-libssp"
1034 "--disable-libvtv"
1035 "--disable-lto"
1036 "--disable-lto-plugin"
1037 "--disable-multilib"
1038 "--disable-plugin"
1039 "--disable-threads"
1040 "--enable-languages=c,c++"
0b652851 1041
9a45a24f
LC
1042 "--enable-static"
1043 ;; libstdc++.so: error: depends on 'libgcc_s.so.1', which cannot be found in RUNPATH ()
1044 "--disable-shared"
1045 "--enable-threads=single"
0b652851 1046
9a45a24f
LC
1047 ;; No pre-compiled libstdc++ headers, to save space.
1048 "--disable-libstdcxx-pch"
0b652851 1049
9a45a24f
LC
1050 ;; for libcpp ...
1051 "--disable-build-with-cxx")))))))
0b652851
JN
1052
1053(define gcc-mesboot1-wrapper
1054 ;; We need this so gcc-mesboot1 can be used to create shared binaries that
1055 ;; have the correct interpreter, otherwise configuring gcc-mesboot using
1056 ;; --enable-shared will fail.
9a45a24f
LC
1057 (package
1058 (inherit gcc-mesboot1)
1059 (name "gcc-mesboot1-wrapper")
1060 (source #f)
1061 (inputs '())
1062 (native-inputs `(("bash" ,%bootstrap-coreutils&co)
1063 ("libc" ,glibc-mesboot)
1064 ("gcc" ,gcc-mesboot1)))
1065 (arguments
1066 `(#:implicit-inputs? #f
1067 #:guile ,%bootstrap-guile
1068 #:phases
1069 (modify-phases %standard-phases
1070 (delete 'unpack)
1071 (delete 'configure)
1072 (delete 'install)
1073 (replace 'build
1074 (lambda* (#:key outputs #:allow-other-keys)
1075 (let* ((out (assoc-ref outputs "out"))
1076 (bash (assoc-ref %build-inputs "bash"))
1077 (libc (assoc-ref %build-inputs "libc"))
1078 (gcc (assoc-ref %build-inputs "gcc"))
1079 (bin (string-append out "/bin")))
1080 (mkdir-p bin)
1081 (for-each
1082 (lambda (program)
1083 (let ((wrapper (string-append bin "/" program)))
1084 (with-output-to-file wrapper
1085 (lambda _
1086 (display (string-append "#! " bash "/bin/bash
0b652851
JN
1087exec " gcc "/bin/" program
1088" -Wl,--dynamic-linker"
eb443459
JN
1089;; also for x86_64-linux, we are still on i686-linux
1090" -Wl," libc ,(glibc-dynamic-linker "i686-linux")
0b652851
JN
1091" -Wl,--rpath"
1092" -Wl," libc "/lib"
1093" \"$@\"
1094"))
9a45a24f
LC
1095 (chmod wrapper #o555)))))
1096 '(
1097 "gcc"
1098 "g++"
1099 "i686-unknown-linux-gnu-gcc"
1100 "i686-unknown-linux-gnu-g++"
1101 ))
1102 #t)))
1103 (replace 'check
1104 (lambda* (#:key outputs #:allow-other-keys)
1105 (let* ((out (assoc-ref outputs "out"))
1106 (bin (string-append out "/bin"))
1107 (program (string-append bin "/gcc")))
1108 (invoke program "--help")))))))))
0b652851
JN
1109
1110(define glibc-headers-mesboot
9a45a24f
LC
1111 (package
1112 (inherit glibc-mesboot0)
1113 (name "glibc-headers-mesboot")
1114 (version "2.16.0")
1115 (source (bootstrap-origin
1116 (origin
0b652851
JN
1117 (method url-fetch)
1118 (uri (string-append "mirror://gnu/glibc/glibc-"
1119 version
1120 ".tar.gz"))
1121 (patches (search-patches "glibc-boot-2.16.0.patch"
1122 "glibc-bootstrap-system-2.16.0.patch"))
1123 (sha256
1124 (base32
9a45a24f
LC
1125 "0vlz4x6cgz7h54qq4528q526qlhnsjzbsvgc4iizn76cb0bfanx7")))))
1126 (native-inputs `(("binutils" ,binutils-mesboot)
1127 ("libc" ,glibc-mesboot0)
1128 ("gcc" ,gcc-mesboot1)
1129 ("headers" ,mesboot-headers)
0b652851 1130
9a45a24f
LC
1131 ("bash" ,%bootstrap-coreutils&co)
1132 ("coreutils" ,%bootstrap-coreutils&co)
1133 ("diffutils" ,diffutils-mesboot)
1134 ("kernel-headers" ,%bootstrap-linux-libre-headers)
1135 ("make" ,make-mesboot)))
0b652851 1136
9a45a24f
LC
1137 (arguments
1138 (substitute-keyword-arguments (package-arguments glibc-mesboot0)
1139 ((#:configure-flags configure-flags)
1140 `(let ((out (assoc-ref %outputs "out"))
1141 (headers (assoc-ref %build-inputs "headers")))
1142 (list
1143 (string-append "--prefix=" out)
1144 "--disable-obsolete-rpc"
1145 "--host=i686-unknown-linux-gnu"
1146 (string-append "--with-headers=" headers "/include")
1147 "--enable-static-nss"
1148 "--with-pthread"
1149 "--without-cvs"
1150 "--without-gd"
1151 "--enable-add-ons=nptl")))
1152 ((#:make-flags make-flags)
1153 `(let ((bash (assoc-ref %build-inputs "bash")))
1154 (list (string-append "SHELL=" bash "/bin/sh")
1155 "install-bootstrap-headers=yes" "install-headers")))
1156 ((#:phases phases)
1157 `(modify-phases ,phases
1158 (replace 'setenv
1159 (lambda* (#:key outputs #:allow-other-keys)
1160 (let* ((out (assoc-ref outputs "out"))
1161 (headers (assoc-ref %build-inputs "headers"))
1162 (bash (assoc-ref %build-inputs "bash"))
1163 (coreutils (assoc-ref %build-inputs "coreutils"))
1164 (libc (assoc-ref %build-inputs "libc"))
1165 (gcc (assoc-ref %build-inputs "gcc"))
1166 (cppflags (string-append
1167 " -I " (getcwd) "/nptl/sysdeps/pthread/bits"
1168 " -D BOOTSTRAP_GLIBC=1"))
1169 (cflags (string-append " -L " (getcwd)
1170 " -L " libc "/lib")))
1171 (setenv "libc_cv_friendly_stddef" "yes")
1172 (setenv "CONFIG_SHELL" (string-append bash "/bin/sh"))
1173 (setenv "SHELL" (getenv "CONFIG_SHELL"))
1174 (format (current-error-port) "CONFIG_SHELL=~s\n" (getenv "CONFIG_SHELL"))
0b652851 1175
9a45a24f
LC
1176 (setenv "CPP" (string-append gcc "/bin/gcc -E " cppflags))
1177 (setenv "CC" (string-append gcc "/bin/gcc " cppflags cflags))
0b652851 1178
9a45a24f
LC
1179 ;; avoid -fstack-protector
1180 (setenv "libc_cv_ssp" "false")
1181 (substitute* "configure"
1182 (("/bin/pwd") (string-append coreutils "/bin/pwd")))
1183 (setenv "C_INCLUDE_PATH" (string-append libc "/include"
1184 headers "/include"))
1185 (setenv "LIBRARY_PATH" (string-append libc "/lib"))
1186 #t)))
1187 (replace 'install
1188 (lambda* (#:key outputs make-flags #:allow-other-keys)
1189 (let ((kernel-headers (assoc-ref %build-inputs "kernel-headers"))
1190 (out (assoc-ref outputs "out")))
1191 (apply invoke "make" make-flags)
1192 (copy-recursively kernel-headers out)
1193 #t)))
1194 (replace 'configure
1195 (lambda* (#:key configure-flags #:allow-other-keys)
1196 (format (current-error-port) "running ../configure ~a\n" (string-join configure-flags))
1197 (mkdir-p "build")
1198 (chdir "build")
1199 (apply invoke "../configure" configure-flags)))
1200 (add-after 'configure 'remove-sunrpc
1201 (lambda _
1202 (invoke "make" (string-append (getcwd) "/sysd-sorted" )
1203 (string-append "SHELL=" (getenv "CONFIG_SHELL")))
1204 (substitute* "sysd-sorted"
1205 ((" sunrpc") " ")
1206 ((" nis") " "))
1207 ;; 'rpcgen' needs native libc headers to be built.
1208 (substitute* "../Makefile"
1209 (("^SHELL := /bin/sh") (string-append "SHELL := " (getenv "CONFIG_SHELL"))))
1210 (substitute* "../Makeconfig"
1211 (("^SHELL := /bin/sh") (string-append "SHELL := " (getenv "CONFIG_SHELL"))))
1212 (substitute* "../elf/Makefile"
1213 (("^SHELL := /bin/sh") (string-append "SHELL := " (getenv "CONFIG_SHELL"))))))))))))
0b652851
JN
1214
1215(define glibc-mesboot
9a45a24f
LC
1216 (package
1217 (inherit glibc-headers-mesboot)
1218 (name "glibc-mesboot")
1219 (native-inputs `(("binutils" ,binutils-mesboot)
1220 ("libc" ,glibc-mesboot0)
1221 ("headers" ,glibc-headers-mesboot)
1222 ("gcc" ,gcc-mesboot1)
0b652851 1223
9a45a24f
LC
1224 ("bash" ,%bootstrap-coreutils&co)
1225 ("coreutils" ,%bootstrap-coreutils&co)
1226 ("diffutils" ,diffutils-mesboot)
1227 ("kernel-headers" ,%bootstrap-linux-libre-headers)
1228 ("make" ,make-mesboot)))
0b652851 1229
9a45a24f
LC
1230 (arguments
1231 `(#:validate-runpath? #f ; fails when using --enable-shared
1232 ,@(substitute-keyword-arguments (package-arguments glibc-headers-mesboot)
1233 ((#:make-flags make-flags)
1234 `(let ((bash (assoc-ref %build-inputs "bash")))
1235 (list (string-append "SHELL=" bash "/bin/sh"))))
1236 ((#:phases phases)
1237 `(modify-phases ,phases
1238 (replace 'install
1239 (lambda* (#:key outputs make-flags #:allow-other-keys)
1240 (let* ((kernel-headers (assoc-ref %build-inputs "kernel-headers"))
1241 (out (assoc-ref outputs "out"))
1242 (install-flags (cons "install" make-flags)))
1243 (apply invoke "make" install-flags)
1244 (copy-recursively kernel-headers out)
1245 #t))))))))
1246 (native-search-paths ;; FIXME: move to glibc-mesboot0
1247 ;; Use the language-specific variables rather than 'CPATH' because they
1248 ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'.
1249 ;; The intent is to allow headers that are in the search path to be
1250 ;; treated as "system headers" (headers exempt from warnings) just like
1251 ;; the typical /usr/include headers on an FHS system.
1252 (list (search-path-specification
1253 (variable "C_INCLUDE_PATH")
1254 (files '("include")))
1255 (search-path-specification
1256 (variable "CPLUS_INCLUDE_PATH")
1257 (files '("include")))
1258 (search-path-specification
1259 (variable "LIBRARY_PATH")
1260 (files '("lib")))))))
0b652851
JN
1261
1262(define gcc-mesboot
9a45a24f
LC
1263 (package
1264 (inherit gcc-mesboot1)
1265 (name "gcc-mesboot")
1266 (version "4.9.4")
1267 (source (bootstrap-origin (package-source gcc-4.9)))
1268 (native-inputs `(("binutils" ,binutils-mesboot)
1269 ("gcc-wrapper" ,gcc-mesboot1-wrapper)
1270 ("gcc" ,gcc-mesboot1)
1271 ("libc" ,glibc-mesboot)
0b652851 1272
9a45a24f
LC
1273 ("bash" ,%bootstrap-coreutils&co)
1274 ("coreutils" ,%bootstrap-coreutils&co)
1275 ("diffutils" ,diffutils-mesboot)
1276 ("kernel-headers" ,%bootstrap-linux-libre-headers)
1277 ("make" ,make-mesboot)))
1278 (arguments
1279 `(#:validate-runpath? #f
1280 ,@(substitute-keyword-arguments (package-arguments gcc-mesboot1)
1281 ((#:configure-flags configure-flags)
1282 `(let ((out (assoc-ref %outputs "out"))
1283 (glibc (assoc-ref %build-inputs "libc")))
1284 (list (string-append "--prefix=" out)
1285 "--build=i686-unknown-linux-gnu"
1286 "--host=i686-unknown-linux-gnu"
0b652851 1287
9a45a24f 1288 "--with-host-libstdcxx=-lsupc++"
0b652851 1289
9a45a24f
LC
1290 (string-append "--with-native-system-header-dir=" glibc "/include")
1291 (string-append "--with-build-sysroot=" glibc "/include")
0b652851 1292
9a45a24f
LC
1293 "--disable-bootstrap"
1294 "--disable-decimal-float"
1295 "--disable-libatomic"
1296 "--disable-libcilkrts"
1297 "--disable-libgomp"
1298 "--disable-libitm"
1299 "--disable-libmudflap"
1300 "--disable-libquadmath"
1301 "--disable-libsanitizer"
1302 "--disable-libssp"
1303 "--disable-libvtv"
1304 "--disable-lto"
1305 "--disable-lto-plugin"
1306 "--disable-multilib"
1307 "--disable-plugin"
1308 "--disable-threads"
1309 "--enable-languages=c,c++"
0b652851 1310
9a45a24f
LC
1311 "--enable-static"
1312 "--enable-shared"
1313 "--enable-threads=single"
0b652851 1314
9a45a24f
LC
1315 ;; No pre-compiled libstdc++ headers, to save space.
1316 "--disable-libstdcxx-pch"
0b652851 1317
9a45a24f
LC
1318 ;; for libcpp ...
1319 "--disable-build-with-cxx")))
1320 ((#:phases phases)
1321 `(modify-phases ,phases
1322 (replace 'setenv
1323 (lambda* (#:key outputs #:allow-other-keys)
1324 (let* ((out (assoc-ref outputs "out"))
1325 (binutils (assoc-ref %build-inputs "binutils"))
1326 (bash (assoc-ref %build-inputs "bash"))
1327 (gcc (assoc-ref %build-inputs "gcc"))
1328 (glibc (assoc-ref %build-inputs "libc"))
1329 (kernel-headers (assoc-ref %build-inputs "kernel-headers")))
1330 (setenv "CONFIG_SHELL" (string-append bash "/bin/sh"))
1331 (setenv "C_INCLUDE_PATH" (string-append
1332 gcc "/lib/gcc-lib/i686-unknown-linux-gnu/4.7.4/include"
1333 ":" kernel-headers "/include"
1334 ":" glibc "/include"
1335 ":" (getcwd) "/mpfr/src"))
1336 (setenv "CPLUS_INCLUDE_PATH" (string-append
1337 gcc "/lib/gcc-lib/i686-unknown-linux-gnu/4.7.4/include"
1338 ":" kernel-headers "/include"
1339 ":" glibc "/include"
1340 ":" (getcwd) "/mpfr/src"))
1341 (setenv "LIBRARY_PATH" (string-append glibc "/lib"
1342 ":" gcc "/lib"))
1343 (format (current-error-port) "C_INCLUDE_PATH=~a\n" (getenv "C_INCLUDE_PATH"))
1344 (format (current-error-port) "CPLUS_INCLUDE_PATH=~a\n" (getenv "CPLUS_INCLUDE_PATH"))
1345 (format (current-error-port) "LIBRARY_PATH=~a\n" (getenv "LIBRARY_PATH"))
1346 #t))))))))))
0b652851
JN
1347
1348(define gcc-mesboot-wrapper
1349 ;; We need this so gcc-mesboot can be used to create shared binaries that
1350 ;; have the correct interpreter and runpath to libc.
9a45a24f
LC
1351 (package
1352 (inherit gcc-mesboot1-wrapper)
1353 (name "gcc-mesboot-wrapper")
1354 (version (package-version gcc-mesboot))
1355 (source #f)
1356 (inputs '())
1357 (native-inputs `(("bash" ,%bootstrap-coreutils&co)
1358 ("libc" ,glibc-mesboot)
1359 ("gcc" ,gcc-mesboot)))))
0b652851
JN
1360
1361(define m4-mesboot
9a45a24f
LC
1362 (package
1363 (inherit m4)
1364 (name "m4-mesboot")
1365 (version "1.4")
1366 (source (origin
1367 (method url-fetch)
1368 (uri (string-append "mirror://gnu/m4/m4-"
1369 version ".tar.gz"))
1370 (sha256
1371 (base32
1372 "1f9bxj176kf3pvs350w2dfs8jgwhminywri5pyn01b11yc4yhsjw"))))
1373 (supported-systems '("i686-linux" "x86_64-linux"))
1374 (native-inputs `(("mes" ,mes-boot)
1375 ("tcc" ,tcc-boot)))
1376 (arguments
1377 `(#:phases
1378 (modify-phases %standard-phases
1379 (replace 'configure
1380 (lambda* (#:key outputs #:allow-other-keys)
1381 (let ((out (assoc-ref outputs "out")))
1382 (setenv "CONFIG_SHELL" (string-append
1383 (assoc-ref %build-inputs "bash")
1384 "/bin/sh"))
1385 (setenv "CC" "tcc -static")
1386 (setenv "CPP" "tcc -E")
1387 (invoke "./configure" (string-append "--prefix=" out))))))))))
0b652851 1388
c3629044 1389(define (%bootstrap-inputs+toolchain)
0b652851
JN
1390 ;; The traditional bootstrap-inputs. For the i686-linux Reduced Binary Seed
1391 ;; the actual reduced set with bootstrapped toolchain.
1380be3c
LC
1392 (match (%current-system)
1393 ((or "i686-linux" "x86_64-linux")
1394 `(("libc" ,glibc-mesboot)
1395 ("binutils" ,binutils-mesboot)
1396 ("gcc-wrapper" ,gcc-mesboot-wrapper)
1397 ("gcc" ,gcc-mesboot)
1398 ,@(fold alist-delete (%bootstrap-inputs)
1399 '("bootstrap-mescc-tools" "mes"))))
1400 (_
1401 (%bootstrap-inputs))))
c3629044 1402
bdb36958 1403(define gnu-make-boot0
9a45a24f
LC
1404 (package
1405 (inherit gnu-make)
1406 (source (bootstrap-origin (package-source gnu-make)))
1407 (name "make-boot0")
1408 (arguments
1409 `(#:guile ,%bootstrap-guile
1410 #:implicit-inputs? #f
1411 #:tests? #f ; cannot run "make check"
1412 ,@(substitute-keyword-arguments (package-arguments gnu-make)
1413 ((#:phases phases)
1414 `(modify-phases ,phases
1415 (replace 'build
1416 (lambda _
1417 (invoke "./build.sh")))
1418 (replace 'install
1419 (lambda* (#:key outputs #:allow-other-keys)
1420 (let* ((out (assoc-ref outputs "out"))
1421 (bin (string-append out "/bin")))
1422 (install-file "make" bin)
1423 #t))))))))
1424 (native-inputs '()) ; no need for 'pkg-config'
1425 (inputs (%bootstrap-inputs+toolchain))))
bdb36958
LC
1426
1427(define diffutils-boot0
99b73d0f
LC
1428 (package
1429 (inherit diffutils)
1430 (name "diffutils-boot0")
1431 (native-inputs `())
1432 (inputs
1433 `(("make" ,gnu-make-boot0)
1434 ,@(%bootstrap-inputs+toolchain)))
1435 (arguments
1436 `(#:tests? #f ; the test suite needs diffutils
1437 #:guile ,%bootstrap-guile
1438 #:implicit-inputs? #f
1439 ,@(package-arguments diffutils)))))
bdb36958
LC
1440
1441(define findutils-boot0
99b73d0f
LC
1442 (package
1443 (inherit findutils)
1444 (name "findutils-boot0")
1445 (source (bootstrap-origin (package-source findutils)))
1446 (inputs
1447 `(("make" ,gnu-make-boot0)
1448 ("diffutils" ,diffutils-boot0) ; for tests
1449 ,@(%bootstrap-inputs+toolchain)))
1450 (arguments
1451 `(#:implicit-inputs? #f
1452 #:guile ,%bootstrap-guile
1453 ,@(package-arguments findutils)))))
bdb36958 1454
c00a9fbf 1455(define file-boot0
99b73d0f
LC
1456 (package
1457 (inherit file)
1458 (source (bootstrap-origin (package-source file)))
1459 (name "file-boot0")
1460 (inputs
1461 `(("make" ,gnu-make-boot0)
1462 ,@(%bootstrap-inputs+toolchain)))
1463 (arguments
1464 `(#:implicit-inputs? #f
1465 #:guile ,%bootstrap-guile
1466 #:strip-binaries? #f
1467 #:validate-runpath? #f))))
c00a9fbf 1468
a2b2070b 1469(define (%boot0-inputs)
bdb36958
LC
1470 `(("make" ,gnu-make-boot0)
1471 ("diffutils" ,diffutils-boot0)
1472 ("findutils" ,findutils-boot0)
c00a9fbf 1473 ("file" ,file-boot0)
c3629044 1474 ,@(%bootstrap-inputs+toolchain)))
bdb36958 1475
bdb36958
LC
1476(define* (boot-triplet #:optional (system (%current-system)))
1477 ;; Return the triplet used to create the cross toolchain needed in the
1478 ;; first bootstrapping stage.
1479 (nix-system->gnu-triplet system "guix"))
1480
1481;; Following Linux From Scratch, build a cross-toolchain in stage 0. That
1482;; toolchain actually targets the same OS and arch, but it has the advantage
c3629044
JN
1483;; of being independent of the libc and tools in
1484;; (%BOOTSTRAP-INPUTS+TOOLCHAIN), since GCC-BOOT0 (below) is built without any
1485;; reference to the target libc.
bdb36958
LC
1486
1487(define binutils-boot0
99b73d0f
LC
1488 (package
1489 (inherit binutils)
1490 (source (bootstrap-origin (package-source binutils)))
1491 (name "binutils-cross-boot0")
1492 (arguments
1493 `(#:guile ,%bootstrap-guile
1494 #:implicit-inputs? #f
1495
1496 #:modules ((guix build gnu-build-system)
1497 (guix build utils)
1498 (ice-9 ftw)) ; for 'scandir'
1499 #:phases (modify-phases %standard-phases
1500 (add-after 'install 'add-symlinks
1501 (lambda* (#:key outputs #:allow-other-keys)
1502 ;; The cross-gcc invokes 'as', 'ld', etc, without the
1503 ;; triplet prefix, so add symlinks.
1504 (let ((out (assoc-ref outputs "out"))
1505 (triplet-prefix (string-append ,(boot-triplet) "-")))
1506 (define (has-triplet-prefix? name)
1507 (string-prefix? triplet-prefix name))
1508 (define (remove-triplet-prefix name)
1509 (substring name (string-length triplet-prefix)))
1510 (with-directory-excursion (string-append out "/bin")
1511 (for-each (lambda (name)
1512 (symlink name (remove-triplet-prefix name)))
1513 (scandir "." has-triplet-prefix?)))
1514 #t))))
1515
1516 ,@(substitute-keyword-arguments (package-arguments binutils)
1517 ((#:configure-flags cf)
1518 `(cons ,(string-append "--target=" (boot-triplet))
1519 ,cf)))))
1520 (inputs (%boot0-inputs))))
bdb36958 1521
b810a850
LC
1522(define libstdc++-boot0
1523 ;; GCC's libcc1 is always built as a shared library (the top-level
1524 ;; 'Makefile.def' forcefully adds --enable-shared) and thus needs to refer
1525 ;; to libstdc++.so. We cannot build libstdc++-5.3 because it relies on
809b0a90 1526 ;; C++14 features missing in some of our bootstrap compilers.
99b73d0f 1527 (let ((lib (make-libstdc++ gcc-4.9)))
b810a850
LC
1528 (package
1529 (inherit lib)
99b73d0f 1530 (source (bootstrap-origin (package-source lib)))
b810a850
LC
1531 (name "libstdc++-boot0")
1532 (arguments
1533 `(#:guile ,%bootstrap-guile
1534 #:implicit-inputs? #f
1535
1536 ;; XXX: libstdc++.so NEEDs ld.so for some reason.
1537 #:validate-runpath? #f
1538
d536c39e 1539 ,@(match (%current-system)
eb443459 1540 ((or "i686-linux" "x86_64-linux")
d536c39e
JN
1541 (substitute-keyword-arguments (package-arguments lib)
1542 ((#:phases phases)
1543 `(modify-phases ,phases
a6facf94
MB
1544 (add-after 'unpack 'workaround-wrapper-bug
1545 ;; XXX: The crude gcc-cross-wrapper causes "g++ -v" to
1546 ;; fail, which in turn confuses the configure script.
1547 (lambda _
1548 (substitute* "libstdc++-v3/configure"
1549 (("g\\+\\+ -v") "true"))
1550 #t))))))
d536c39e 1551 (_ (package-arguments lib)))))
a2b2070b 1552 (inputs (%boot0-inputs))
b810a850
LC
1553 (native-inputs '()))))
1554
bdb36958 1555(define gcc-boot0
99b73d0f
LC
1556 (package
1557 (inherit gcc)
1558 (name "gcc-cross-boot0")
1559 (source (bootstrap-origin (package-source gcc)))
1560 (arguments
1561 `(#:guile ,%bootstrap-guile
1562 #:implicit-inputs? #f
1563 #:modules ((guix build gnu-build-system)
1564 (guix build utils)
1565 (ice-9 regex)
1566 (srfi srfi-1)
1567 (srfi srfi-26))
1568 ,@(substitute-keyword-arguments (package-arguments gcc)
1569 ((#:configure-flags flags)
1570 `(append (list ,(string-append "--target=" (boot-triplet))
1571
1572 ;; No libc yet.
1573 "--without-headers"
1574
1575 ;; Disable features not needed at this stage.
1576 "--disable-shared"
1577 "--enable-languages=c,c++"
1578
1579 ;; libstdc++ cannot be built at this stage
1580 ;; ("Link tests are not allowed after
1581 ;; GCC_NO_EXECUTABLES.").
1582 "--disable-libstdc++-v3"
1583
1584 "--disable-threads"
1585 "--disable-libmudflap"
1586 "--disable-libatomic"
1587 "--disable-libsanitizer"
1588 "--disable-libitm"
1589 "--disable-libgomp"
1590 "--disable-libmpx"
1591 "--disable-libcilkrts"
1592 "--disable-libvtv"
1593 "--disable-libssp"
1594 "--disable-libquadmath"
1595 "--disable-decimal-float")
1596 (remove (cut string-match
1597 "--(with-system-zlib|enable-languages.*)" <>)
1598 ,flags)))
1599 ((#:make-flags flags)
1600 `(let* ((libc (assoc-ref %build-inputs "libc"))
1601 (libc-native (or (assoc-ref %build-inputs "libc-native")
1602 libc)))
1603 `(,(string-append "LDFLAGS="
1604 "-Wl,-rpath=" libc-native "/lib "
1605 "-Wl,-dynamic-linker "
1606 "-Wl," libc-native ,(glibc-dynamic-linker
1607 (match (%current-system)
1608 ("x86_64-linux" "i686-linux")
1609 (_ (%current-system))))))))
1610 ((#:phases phases)
1611 `(modify-phases ,phases
1612 (add-after 'unpack 'unpack-gmp&co
1613 (lambda* (#:key inputs #:allow-other-keys)
1614 (let ((gmp (assoc-ref %build-inputs "gmp-source"))
1615 (mpfr (assoc-ref %build-inputs "mpfr-source"))
1616 (mpc (assoc-ref %build-inputs "mpc-source")))
1617
1618 ;; To reduce the set of pre-built bootstrap inputs, build
1619 ;; GMP & co. from GCC.
1620 (for-each (lambda (source)
1621 (invoke "tar" "xvf" source))
1622 (list gmp mpfr mpc))
1623
1624 ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
1625 ,@(map (lambda (lib)
1626 ;; Drop trailing letters, as gmp-6.0.0a unpacks
1627 ;; into gmp-6.0.0.
1628 `(symlink ,(string-trim-right
1629 (package-full-name lib "-")
1630 char-set:letter)
1631 ,(package-name lib)))
1632 (list gmp-6.0 mpfr mpc))
1633 #t)))
1634 ,(match (%current-system)
1635 ((or "i686-linux" "x86_64-linux")
1636 '(add-before 'configure 'fix-libcc1
77e02d94
MB
1637 (lambda* (#:key inputs #:allow-other-keys)
1638 ;; libcc1.so NEEDs libgcc_s.so, so provide one here
1639 ;; to placate the 'validate-runpath' phase.
1640 (substitute* "libcc1/Makefile.in"
1641 (("la_LDFLAGS =")
1642 (string-append "la_LDFLAGS = -Wl,-rpath="
1643 (assoc-ref inputs "gcc") "/lib")))
1644 ;; XXX: "g++ -v" is broken (see also libstdc++ above).
1645 (substitute* "libcc1/configure"
1646 (("g\\+\\+ -v") "true"))
1647 #t)))
99b73d0f
LC
1648 (_ '(add-before 'configure 'return-true
1649 (lambda _ #t))))
1650 (add-after 'install 'symlink-libgcc_eh
1651 (lambda* (#:key outputs #:allow-other-keys)
1652 (let ((out (assoc-ref outputs "lib")))
1653 ;; Glibc wants to link against libgcc_eh, so provide
1654 ;; it.
1655 (with-directory-excursion
1656 (string-append out "/lib/gcc/"
1657 ,(boot-triplet)
1658 "/" ,(package-version gcc))
1659 (symlink "libgcc.a" "libgcc_eh.a"))
1660 #t))))))))
bdb36958 1661
99b73d0f
LC
1662 (inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp-6.0)))
1663 ("mpfr-source" ,(bootstrap-origin (package-source mpfr)))
1664 ("mpc-source" ,(bootstrap-origin (package-source mpc)))
1665 ("binutils-cross" ,binutils-boot0)
bdb36958 1666
99b73d0f
LC
1667 ;; The libstdc++ that libcc1 links against.
1668 ("libstdc++" ,libstdc++-boot0)
b810a850 1669
99b73d0f
LC
1670 ;; Call it differently so that the builder can check whether
1671 ;; the "libc" input is #f.
1672 ("libc-native" ,@(assoc-ref (%boot0-inputs) "libc"))
1673 ,@(alist-delete "libc" (%boot0-inputs))))
9dee9e8f 1674
99b73d0f
LC
1675 ;; No need for the native-inputs to build the documentation at this stage.
1676 (native-inputs `())))
bdb36958
LC
1677
1678(define perl-boot0
99b73d0f
LC
1679 (package
1680 (inherit perl)
1681 (name "perl-boot0")
1682 (source (bootstrap-origin (package-source perl)))
1683 (inputs (%boot0-inputs))
1684 (arguments
1685 `(#:implicit-inputs? #f
1686 #:guile ,%bootstrap-guile
1687 #:validate-runpath? #f
1688
1689 ;; At the very least, this must not depend on GCC & co.
1690 #:disallowed-references ,(list %bootstrap-binutils)
1691
1692 ,@(substitute-keyword-arguments (package-arguments perl)
1693 ((#:phases phases)
1694 `(modify-phases ,phases
1695 ;; Pthread support is missing in the bootstrap compiler
1696 ;; (broken spec file), so disable it.
1697 (add-before 'configure 'disable-pthreads
1698 (lambda _
1699 (substitute* "Configure"
1700 (("^libswanted=(.*)pthread" _ before)
1701 (string-append "libswanted=" before)))
1702 #t))))
1703 ;; Do not configure with '-Dusethreads' since pthread
1704 ;; support is missing.
1705 ((#:configure-flags configure-flags)
1706 `(delete "-Dusethreads" ,configure-flags)))))))
bdb36958 1707
32f4a073 1708(define m4-boot0
99b73d0f
LC
1709 (package
1710 (inherit m4)
1711 (name "m4-boot0")
1712 (source (bootstrap-origin (package-source m4)))
1713 (inputs (%boot0-inputs))
1714 (arguments
1715 `(#:guile ,%bootstrap-guile
1716 #:implicit-inputs? #f
1717 ,@(package-arguments m4)))))
1718
1719(define m4-boot0*
1720 (package
1721 ;; TODO: On the next rebuild cycle, use M4-BOOT0 as is.
1722 (inherit m4-boot0)
1723 (name "m4")))
32f4a073 1724
d75acc29
MR
1725(define bison-boot0
1726 ;; This Bison is needed to build MiG so we need it early in the process.
12908554 1727 ;; Recent versions of Linux-Libre headers also depend on this.
99b73d0f
LC
1728 (package
1729 (inherit bison)
1730 ;; TODO: On the next build cycle, do:
1731 ;;(name "bison-boot0")
1732 (propagated-inputs `(("m4" ,m4-boot0*)))
1733 (native-inputs `(("perl" ,perl-boot0)))
1734 (inputs (%boot0-inputs)) ;remove Flex...
1735 (arguments
1736 `(#:tests? #f ;... and thus disable tests
1737 #:implicit-inputs? #f
1738 #:guile ,%bootstrap-guile
1739
1740 ;; XXX: These flags should be unconditional, but for now
1741 ;; we just add them on x86 to avoid a full rebuild.
1742 ;; TODO: On the next core-updates, use
1743 ;; 'substitute-keyword-arguments' to inherit them from
1744 ;; BISON.
1745 ,@(if (member (%current-system)
1746 '("x86_64-linux" "i686-linux"))
1747 '(#:parallel-build? #f
1748 #:parallel-tests? #f)
1749 '())
1750
1751 ;; Zero timestamps in liby.a; this must be done
1752 ;; explicitly here because the bootstrap Binutils don't
1753 ;; do that (default is "cru".)
1754 #:make-flags `("ARFLAGS=crD"
1755 ,,(match (%current-system)
1756 ;; ranlib: '-D': No such file
1757 ((or "i686-linux" "x86_64-linux")
1758 "RANLIB=ranlib")
1759 (_
1760 "RANLIB=ranlib -D"))
1761 "V=1")))))
d75acc29
MR
1762
1763(define flex-boot0
12908554 1764 ;; This Flex is needed to build MiG as well as Linux-Libre headers.
99b73d0f
LC
1765 (package
1766 (inherit flex)
1767 (native-inputs `(("bison" ,bison-boot0)))
1768 (propagated-inputs
1769 ;; XXX: Here we use an 'm4-boot0' package that's not eq? so that it
1770 ;; appears twice in '%build-inputs', like when we were using
1771 ;; 'package-with-explicit-inputs'.
1772 ;; TODO: Remove this hack on the next rebuild cycle.
1773 `(("m4" ,(package (inherit m4-boot0*)))))
1774 (inputs (%boot0-inputs))
1775 (arguments
1776 `(#:implicit-inputs? #f
1777 #:guile ,%bootstrap-guile
1778 #:tests? #f))))
d75acc29 1779
8102cf0b
LC
1780(define linux-libre-headers-boot0
1781 (mlambda ()
1782 "Return Linux-Libre header files for the bootstrap environment."
1783 ;; Note: this is wrapped in a thunk to nicely handle circular dependencies
1784 ;; between (gnu packages linux) and this module. Additionally, memoize
1785 ;; the result to play well with further memoization and code that relies
1786 ;; on pointer identity; see <https://bugs.gnu.org/30155>.
99b73d0f
LC
1787 (package
1788 (inherit linux-libre-headers)
1789 (arguments
1790 `(#:guile ,%bootstrap-guile
1791 #:implicit-inputs? #f
1792 ,@(package-arguments linux-libre-headers)))
1793 (native-inputs
1794 `(("perl" ,perl-boot0)
1795
1796 ;; Flex and Bison are required since version 4.16.
1797 ("flex" ,flex-boot0)
1798 ("bison" ,bison-boot0)
1799 ,@(%boot0-inputs))))))
bdb36958 1800
d75acc29
MR
1801(define gnumach-headers-boot0
1802 (package-with-bootstrap-guile
1803 (package-with-explicit-inputs gnumach-headers
a2b2070b 1804 (%boot0-inputs)
d75acc29
MR
1805 (current-source-location)
1806 #:guile %bootstrap-guile)))
1807
1808(define mig-boot0
1809 (let* ((mig (package (inherit mig)
1810 (native-inputs `(("bison" ,bison-boot0)
1811 ("flex" ,flex-boot0)))
1812 (inputs `(("flex" ,flex-boot0)))
1813 (arguments
1814 `(#:configure-flags
1815 `(,(string-append "LDFLAGS=-Wl,-rpath="
1816 (assoc-ref %build-inputs "flex") "/lib/")))))))
1817 (package-with-bootstrap-guile
a2b2070b 1818 (package-with-explicit-inputs mig (%boot0-inputs)
d75acc29
MR
1819 (current-source-location)
1820 #:guile %bootstrap-guile))))
1821
1822(define hurd-headers-boot0
1823 (let ((hurd-headers (package (inherit hurd-headers)
1824 (native-inputs `(("mig" ,mig-boot0)))
1825 (inputs '()))))
1826 (package-with-bootstrap-guile
a2b2070b 1827 (package-with-explicit-inputs hurd-headers (%boot0-inputs)
d75acc29
MR
1828 (current-source-location)
1829 #:guile %bootstrap-guile))))
1830
1831(define hurd-minimal-boot0
1832 (let ((hurd-minimal (package (inherit hurd-minimal)
1833 (native-inputs `(("mig" ,mig-boot0)))
1834 (inputs '()))))
1835 (package-with-bootstrap-guile
a2b2070b 1836 (package-with-explicit-inputs hurd-minimal (%boot0-inputs)
d75acc29
MR
1837 (current-source-location)
1838 #:guile %bootstrap-guile))))
1839
8102cf0b
LC
1840(define hurd-core-headers-boot0
1841 (mlambda ()
1842 "Return the Hurd and Mach headers as well as initial Hurd libraries for
d75acc29 1843the bootstrap environment."
8102cf0b
LC
1844 (package-with-bootstrap-guile
1845 (package (inherit hurd-core-headers)
1846 (arguments `(#:guile ,%bootstrap-guile
1847 ,@(package-arguments hurd-core-headers)))
1848 (inputs
1849 `(("gnumach-headers" ,gnumach-headers-boot0)
1850 ("hurd-headers" ,hurd-headers-boot0)
1851 ("hurd-minimal" ,hurd-minimal-boot0)
a2b2070b 1852 ,@(%boot0-inputs)))))))
d75acc29
MR
1853
1854(define* (kernel-headers-boot0 #:optional (system (%current-system)))
1855 (match system
1856 ("i586-gnu" (hurd-core-headers-boot0))
1857 (_ (linux-libre-headers-boot0))))
1858
bdb36958
LC
1859(define texinfo-boot0
1860 ;; Texinfo used to build libc's manual.
1861 ;; We build without ncurses because it fails to build at this stage, and
1862 ;; because we don't need the stand-alone Info reader.
a2b2070b 1863 ;; Also, use (%BOOT0-INPUTS) to avoid building Perl once more.
99b73d0f
LC
1864 (package
1865 (inherit texinfo)
1866 (native-inputs '())
1867 (inputs `(,@(%boot0-inputs)
1868 ("perl" ,perl-boot0)))
1869 (arguments
1870 `(#:implicit-inputs? #f
1871 #:guile ,%bootstrap-guile
1872
1873 ;; Some of Texinfo 6.1's tests would fail with "Couldn't set UTF-8
1874 ;; character type in locale" but we don't have a UTF-8 locale at this
1875 ;; stage, so skip them.
1876 #:tests? #f))))
bdb36958 1877
5f3f7039
MB
1878(define expat-sans-tests
1879 (package
1880 (inherit expat)
99b73d0f 1881 (inputs (%boot0-inputs))
5f3f7039
MB
1882 (arguments
1883 ;; XXX: Linking 'runtestscpp' fails with things like:
1884 ;;
1885 ;; ld: Dwarf Error: found dwarf version '3789', this reader only handles version 2 and 3 information.
1886 ;;
1887 ;; Skip tests altogether.
99b73d0f
LC
1888 `(#:implicit-inputs? #f
1889 #:guile ,%bootstrap-guile
1890
1891 ,@(substitute-keyword-arguments (package-arguments expat)
1892 ((#:configure-flags flags ''())
1893 ;; Since we're not passing the right -Wl,-rpath flags, build the
1894 ;; static library to avoid RUNPATH validation failure.
1895 `(cons "--disable-shared" ,flags))
1896 ((#:tests? _ #f) #f))))))
5f3f7039
MB
1897
1898(define python-boot0
99b73d0f
LC
1899 (package
1900 (inherit python-minimal)
1901 ;; We cannot use Python 3.7 and later here, because they require
1902 ;; pthreads, which is missing on non-x86 platforms at this stage.
1903 ;; Python 3.6 technically supports being built without threading
1904 ;; support, but requires additional patches.
1905 (version "3.5.7")
1906 (source (bootstrap-origin
1907 (origin
1908 (inherit (package-source python))
1909 (uri (string-append "https://www.python.org/ftp/python/"
1910 version "/Python-" version ".tar.xz"))
1911 (patches '())
1912 (sha256
1913 (base32
1914 "1p67pnp2ca5przx2s45r8m55dcn6f5hsm0l4s1zp7mglkf4r4n18")))))
1915 (inputs
1916 `(,@(%boot0-inputs)
1917 ("expat" ,expat-sans-tests))) ;remove OpenSSL, zlib, etc.
1918 (native-inputs '()) ;and pkg-config
1919 (arguments
1920 `(#:implicit-inputs? #f
1921 #:guile ,%bootstrap-guile
1922
1923 ,@(substitute-keyword-arguments (package-arguments python-minimal)
1924 ;; Disable features that cannot be built at this stage.
1925 ((#:configure-flags _ ''())
1926 `(list "--without-ensurepip"
1927 "--without-threads"))
1928 ;; Clear #:make-flags, such that changes to the regular
1929 ;; Python package won't interfere with this one.
1930 ((#:make-flags _ ''()) ''())
1931 ((#:phases phases)
1932 `(modify-phases ,phases
1933 (add-before 'configure 'disable-modules
1934 (lambda _
1935 (substitute* "setup.py"
1936 ;; Disable ctypes, since it requires libffi.
1937 (("extensions\\.append\\(ctypes\\)") "")
1938 ;; Prevent the 'ossaudiodev' extension from being
1939 ;; built, since it requires Linux headers.
1940 (("'linux', ") ""))
1941 #t))
1942 (delete 'set-TZDIR)))
1943 ((#:tests? _ #f) #f))))))
5f3f7039 1944
dab669e0
LC
1945(define ld-wrapper-boot0
1946 (mlambda ()
1947 ;; We need this so binaries on Hurd will have libmachuser and libhurduser
1948 ;; in their RUNPATH, otherwise validate-runpath will fail.
1949 (make-ld-wrapper "ld-wrapper-boot0"
1950 #:target boot-triplet
1951 #:binutils binutils-boot0
1952 #:guile %bootstrap-guile
1953 #:bash (car (assoc-ref (%boot0-inputs) "bash"))
1954 #:guile-for-build %bootstrap-guile)))
d75acc29 1955
a2b2070b 1956(define (%boot1-inputs)
bdb36958
LC
1957 ;; 2nd stage inputs.
1958 `(("gcc" ,gcc-boot0)
f50b013f 1959 ("ld-wrapper-cross" ,(ld-wrapper-boot0))
bdb36958 1960 ("binutils-cross" ,binutils-boot0)
a2b2070b 1961 ,@(alist-delete "binutils" (%boot0-inputs))))
bdb36958
LC
1962
1963(define glibc-final-with-bootstrap-bash
1964 ;; The final libc, "cross-built". If everything went well, the resulting
1965 ;; store path has no dependencies. Actually, the really-final libc is
1966 ;; built just below; the only difference is that this one uses the
1967 ;; bootstrap Bash.
99b73d0f
LC
1968 (package
1969 (inherit glibc)
1970 (name "glibc-intermediate")
1971 (source (bootstrap-origin (package-source glibc)))
1972 (arguments
1973 `(#:guile ,%bootstrap-guile
1974 #:implicit-inputs? #f
1975
1976 ,@(substitute-keyword-arguments (package-arguments glibc)
1977 ((#:configure-flags flags)
1978 `(append (list ,(string-append "--host=" (boot-triplet))
1979 ,(string-append "--build="
1980 (nix-system->gnu-triplet)))
1981 ,flags))
1982 ((#:phases phases)
1983 `(modify-phases ,phases
1984 (add-before 'configure 'pre-configure
1985 (lambda* (#:key inputs #:allow-other-keys)
1986 ;; Don't clobber CPATH with the bootstrap libc.
1987 (setenv "NATIVE_CPATH" (getenv "CPATH"))
1988 (unsetenv "CPATH")
1989
1990 ;; Tell 'libpthread' where to find 'libihash' on Hurd systems.
1991 ,@(if (hurd-triplet? (%current-system))
1992 `((substitute* "libpthread/Makefile"
1993 (("LDLIBS-pthread.so =.*")
1994 (string-append "LDLIBS-pthread.so = "
1995 (assoc-ref %build-inputs "kernel-headers")
1996 "/lib/libihash.a\n"))))
1997 '())
1998
1999 ;; 'rpcgen' needs native libc headers to be built.
2000 (substitute* "sunrpc/Makefile"
2001 (("sunrpc-CPPFLAGS =.*" all)
2002 (string-append "CPATH = $(NATIVE_CPATH)\n"
2003 "export CPATH\n"
2004 all "\n")))
2005 #t)))))))
2006 (propagated-inputs `(("kernel-headers" ,(kernel-headers-boot0))))
2007 (native-inputs
2008 `(("bison" ,bison-boot0)
2009 ("texinfo" ,texinfo-boot0)
2010 ("perl" ,perl-boot0)
2011 ("python" ,python-boot0)))
2012 (inputs
2013 `( ;; The boot inputs. That includes the bootstrap libc. We don't want
2014 ;; it in $CPATH, hence the 'pre-configure' phase above.
2015 ,@(%boot1-inputs)
2016
2017 ;; A native MiG is needed to build Glibc on Hurd.
2018 ,@(if (hurd-triplet? (%current-system))
2019 `(("mig" ,mig-boot0))
2020 '())
2021
2022 ;; A native GCC is needed to build `cross-rpcgen'.
2023 ("native-gcc" ,@(assoc-ref (%boot0-inputs) "gcc"))
2024
2025 ;; Here, we use the bootstrap Bash, which is not satisfactory
2026 ;; because we don't want to depend on bootstrap tools.
2027 ("static-bash" ,@(assoc-ref (%boot0-inputs) "bash"))))))
bdb36958
LC
2028
2029(define (cross-gcc-wrapper gcc binutils glibc bash)
2030 "Return a wrapper for the pseudo-cross toolchain GCC/BINUTILS/GLIBC
2031that makes it available under the native tool names."
c92f1c0a 2032 (package (inherit gcc)
bdb36958
LC
2033 (name (string-append (package-name gcc) "-wrapped"))
2034 (source #f)
2035 (build-system trivial-build-system)
2036 (outputs '("out"))
2037 (arguments
2038 `(#:guile ,%bootstrap-guile
2039 #:modules ((guix build utils))
2040 #:builder (begin
2041 (use-modules (guix build utils))
2042
2043 (let* ((binutils (assoc-ref %build-inputs "binutils"))
2044 (gcc (assoc-ref %build-inputs "gcc"))
2045 (libc (assoc-ref %build-inputs "libc"))
2046 (bash (assoc-ref %build-inputs "bash"))
2047 (out (assoc-ref %outputs "out"))
2048 (bindir (string-append out "/bin"))
2049 (triplet ,(boot-triplet)))
2050 (define (wrap-program program)
2051 ;; GCC-BOOT0 is a libc-less cross-compiler, so it
2052 ;; needs to be told where to find the crt files and
2053 ;; the dynamic linker.
2054 (call-with-output-file program
2055 (lambda (p)
2056 (format p "#!~a/bin/bash
2057exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
2058 bash
2059 gcc triplet program
2060 libc libc
2061 ,(glibc-dynamic-linker))))
2062
2063 (chmod program #o555))
2064
2065 (mkdir-p bindir)
2066 (with-directory-excursion bindir
2067 (for-each (lambda (tool)
2068 (symlink (string-append binutils "/bin/"
2069 triplet "-" tool)
2070 tool))
2071 '("ar" "ranlib"))
e3cfef22
MW
2072 (for-each wrap-program '("gcc" "g++")))
2073
2074 #t))))
bdb36958
LC
2075 (native-inputs
2076 `(("binutils" ,binutils)
2077 ("gcc" ,gcc)
2078 ("libc" ,glibc)
2079 ("bash" ,bash)))
2080 (inputs '())))
2081
eb443459
JN
2082(define (gcc-boot0-intermediate-wrapped)
2083 ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
2084 ;; non-cross names.
2085 (cross-gcc-wrapper gcc-boot0 binutils-boot0
2086 glibc-final-with-bootstrap-bash
2087 (car (assoc-ref (%boot1-inputs) "bash"))))
2088
bdb36958 2089(define static-bash-for-glibc
90d891fc 2090 ;; A statically-linked Bash to be used by GLIBC-FINAL in system(3) & co.
99b73d0f
LC
2091 (package
2092 (inherit static-bash)
2093 (source (bootstrap-origin (package-source static-bash)))
2094 (inputs `(("gcc" ,(gcc-boot0-intermediate-wrapped))
2095 ("libc" ,glibc-final-with-bootstrap-bash)
2096 ("libc:static" ,glibc-final-with-bootstrap-bash "static")
2097 ,@(fold alist-delete (%boot1-inputs)
2098 '("gcc" "libc"))))
2099 (arguments
2100 `(#:implicit-inputs? #f
2101 #:guile ,%bootstrap-guile
2102
2103 ,@(substitute-keyword-arguments (package-arguments static-bash)
2104 ((#:configure-flags flags '())
2105 ;; Add a '-L' flag so that the pseudo-cross-ld of
2106 ;; BINUTILS-BOOT0 can find libc.a.
2107 `(append ,flags
2108 (list (string-append "LDFLAGS=-static -L"
2109 (assoc-ref %build-inputs
2110 "libc:static")
2111 "/lib")))))))))
bdb36958 2112
6162b95d
LC
2113(define gettext-boot0
2114 ;; A minimal gettext used during bootstrap.
99b73d0f
LC
2115 (package
2116 (inherit gettext-minimal)
2117 (name "gettext-boot0")
2118 ;; Newer versions of GNU gettext depends on libxml2 and ncurses. To
2119 ;; simplify the dependency chain, we stick to this version here.
2120 (version "0.19.8.1")
2121 (source (origin
2122 (method url-fetch)
2123 (uri (string-append "mirror://gnu/gettext/gettext-"
2124 version ".tar.gz"))
2125 (sha256
2126 (base32
2127 "0hsw28f9q9xaggjlsdp2qmbp2rbd1mp0njzan2ld9kiqwkq2m57z"))))
2128 (inputs (%boot1-inputs)) ;zero dependencies
2129 (arguments
2130 `(#:implicit-inputs? #f
2131 #:guile ,%bootstrap-guile
2132 #:tests? #f
2133 #:phases (modify-phases %standard-phases
2134 ;; Build only the tools.
2135 (add-after 'unpack 'chdir
2136 (lambda _
2137 (chdir "gettext-tools")
2138 #t))
2139
2140 ;; Some test programs require pthreads, which we don't have.
2141 (add-before 'configure 'no-test-programs
2142 (lambda _
2143 (substitute* "tests/Makefile.in"
2144 (("^PROGRAMS =.*$")
2145 "PROGRAMS =\n"))
2146 #t)))))))
6162b95d 2147
89223417 2148(define glibc-final
bdb36958 2149 ;; The final glibc, which embeds the statically-linked Bash built above.
7c788ed2 2150 ;; Use 'package/inherit' so we get the 'replacement' of 'glibc', if any.
99b73d0f
LC
2151 (package/inherit
2152 glibc
2153 (name "glibc")
2154 (source (bootstrap-origin (package-source glibc)))
2155 (inputs `(("static-bash" ,static-bash-for-glibc)
2156 ,@(alist-delete
2157 "static-bash"
2158 (package-inputs glibc-final-with-bootstrap-bash))))
2159
2160 ;; This time we need 'msgfmt' to install all the libc.mo files.
2161 (native-inputs `(,@(package-native-inputs glibc-final-with-bootstrap-bash)
2162 ("gettext" ,gettext-boot0)))
2163
2164 (propagated-inputs
2165 (package-propagated-inputs glibc-final-with-bootstrap-bash))
2166
2167 ;; The final libc only refers to itself, but the 'debug' output contains
2168 ;; references to GCC-BOOT0 and to the Linux headers. XXX: Would be great
2169 ;; if 'allowed-references' were per-output.
2170 (arguments
2171 `(#:allowed-references
2172 ,(cons* `(,gcc-boot0 "lib") (kernel-headers-boot0)
2173 static-bash-for-glibc
2174 (package-outputs glibc-final-with-bootstrap-bash))
2175
2176 ,@(package-arguments glibc-final-with-bootstrap-bash)))))
bdb36958 2177
f50b013f 2178(define (gcc-boot0-wrapped)
bdb36958
LC
2179 ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
2180 ;; non-cross names.
2181 (cross-gcc-wrapper gcc-boot0 binutils-boot0 glibc-final
a2b2070b 2182 (car (assoc-ref (%boot1-inputs) "bash"))))
bdb36958 2183
a2b2070b 2184(define (%boot2-inputs)
bdb36958
LC
2185 ;; 3rd stage inputs.
2186 `(("libc" ,glibc-final)
6dff905e 2187 ("libc:static" ,glibc-final "static")
f50b013f 2188 ("gcc" ,(gcc-boot0-wrapped))
4ae7dc7b 2189 ,@(fold alist-delete (%boot1-inputs) '("libc" "gcc" "linux-libre-headers"))))
bdb36958
LC
2190
2191(define binutils-final
99b73d0f
LC
2192 (package
2193 (inherit binutils)
2194 (source (bootstrap-origin (package-source binutils)))
2195 (arguments
2196 `(#:guile ,%bootstrap-guile
2197 #:implicit-inputs? #f
2198 #:allowed-references ("out" ,glibc-final)
2199 ,@(package-arguments binutils)))
2200 (inputs (%boot2-inputs))))
bdb36958
LC
2201
2202(define libstdc++
2203 ;; Intermediate libstdc++ that will allow us to build the final GCC
2204 ;; (remember that GCC-BOOT0 cannot build libstdc++.)
99b73d0f 2205 (let ((lib (make-libstdc++ gcc)))
86d02fa8
EF
2206 (package
2207 (inherit lib)
99b73d0f 2208 (source (bootstrap-origin (package-source lib)))
86d02fa8
EF
2209 (arguments
2210 `(#:guile ,%bootstrap-guile
2211 #:implicit-inputs? #f
2212 #:allowed-references ("out")
2213
2214 ;; XXX: libstdc++.so NEEDs ld.so for some reason.
2215 #:validate-runpath? #f
2216
2217 ;; All of the package arguments from 'make-libstdc++
2218 ;; except for the configure-flags.
2219 ,@(package-arguments lib)
2220 #:configure-flags `("--disable-shared"
01e8263f 2221 "--disable-libstdcxx-dual-abi"
86d02fa8
EF
2222 "--disable-libstdcxx-threads"
2223 "--disable-libstdcxx-pch"
2224 ,(string-append "--with-gxx-include-dir="
2225 (assoc-ref %outputs "out")
2226 "/include"))))
2227 (outputs '("out"))
a2b2070b 2228 (inputs (%boot2-inputs))
86d02fa8 2229 (synopsis "GNU C++ standard library (intermediate)"))))
bdb36958 2230
98bd851e
LC
2231(define zlib-final
2232 ;; Zlib used by GCC-FINAL.
99b73d0f
LC
2233 (package
2234 (inherit zlib)
2235 (arguments
2236 `(#:guile ,%bootstrap-guile
2237 #:implicit-inputs? #f
2238 #:allowed-references ("out" ,glibc-final)
2239 ,@(package-arguments zlib)))
2240 (inputs (%boot2-inputs))))
98bd851e 2241
dab669e0
LC
2242(define ld-wrapper-boot3
2243 (mlambda ()
2244 ;; A linker wrapper that uses the bootstrap Guile.
2245 (make-ld-wrapper "ld-wrapper-boot3"
2246 #:binutils binutils-final
2247 #:guile %bootstrap-guile
2248 #:bash (car (assoc-ref (%boot2-inputs) "bash"))
2249 #:guile-for-build %bootstrap-guile)))
98bd851e 2250
89223417 2251(define gcc-final
bdb36958
LC
2252 ;; The final GCC.
2253 (package (inherit gcc-boot0)
2254 (name "gcc")
ab999c25
LC
2255
2256 ;; XXX: Currently #:allowed-references applies to all the outputs but the
2257 ;; "debug" output contains disallowed references, notably
2258 ;; linux-libre-headers. Disable the debugging output to work around that.
2259 (outputs (delete "debug" (package-outputs gcc-boot0)))
2260
bdb36958
LC
2261 (arguments
2262 `(#:guile ,%bootstrap-guile
2263 #:implicit-inputs? #f
2264
98bd851e 2265 #:allowed-references ("out" "lib" ,zlib-final
90d891fc 2266 ,glibc-final ,static-bash-for-glibc)
bdb36958 2267
d485ebba
LC
2268 ;; Things like libasan.so and libstdc++.so NEED ld.so for some
2269 ;; reason, but it is not in their RUNPATH. This is a false
2270 ;; positive, so turn it off.
2271 #:validate-runpath? #f
2272
eb443459 2273 ,@(substitute-keyword-arguments (package-arguments gcc)
bdb36958 2274 ((#:make-flags flags)
52cfd8cb 2275 ;; Since $LIBRARY_PATH is not honored, add the relevant flags.
98bd851e
LC
2276 `(let ((zlib (assoc-ref %build-inputs "zlib")))
2277 (map (lambda (flag)
2278 (if (string-prefix? "LDFLAGS=" flag)
2279 (string-append flag " -L"
2280 (assoc-ref %build-inputs "libstdc++")
2281 "/lib -L" zlib "/lib -Wl,-rpath="
2282 zlib "/lib")
2283 flag))
2284 ,flags)))
eb443459
JN
2285 ;; Build again GMP & co. within GCC's build process, because it's hard
2286 ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
2287 ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
bdb36958 2288 ((#:phases phases)
eb443459
JN
2289 `(modify-phases ,phases
2290 (add-after 'unpack 'unpack-gmp&co
2291 (lambda* (#:key inputs #:allow-other-keys)
2292 (let ((gmp (assoc-ref %build-inputs "gmp-source"))
2293 (mpfr (assoc-ref %build-inputs "mpfr-source"))
2294 (mpc (assoc-ref %build-inputs "mpc-source")))
2295
2296 ;; To reduce the set of pre-built bootstrap inputs, build
2297 ;; GMP & co. from GCC.
2298 (for-each (lambda (source)
2299 (invoke "tar" "xvf" source))
2300 (list gmp mpfr mpc))
2301
2302 ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
2303 ,@(map (lambda (lib)
2304 ;; Drop trailing letters, as gmp-6.0.0a unpacks
2305 ;; into gmp-6.0.0.
2306 `(symlink ,(string-trim-right
2307 (package-full-name lib "-")
2308 char-set:letter)
2309 ,(package-name lib)))
2310 (list gmp-6.0 mpfr mpc))
01e8263f
MB
2311 #t)))
2312 (add-before 'configure 'treat-glibc-as-system-header
2313 (lambda* (#:key inputs #:allow-other-keys)
2314 (let ((libc (assoc-ref inputs "libc")))
2315 ;; Make sure Glibc is treated as a "system header" so
2316 ;; #include_next does the right thing.
2317 (for-each (lambda (var)
2318 (setenv var (string-append libc "/include")))
2319 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"))
eb443459 2320 #t))))))))
bdb36958 2321
90d891fc
LC
2322 ;; This time we want Texinfo, so we get the manual. Add
2323 ;; STATIC-BASH-FOR-GLIBC so that it's used in the final shebangs of
2324 ;; scripts such as 'mkheaders' and 'fixinc.sh' (XXX: who cares about these
2325 ;; scripts?).
bdb36958 2326 (native-inputs `(("texinfo" ,texinfo-boot0)
19d27131 2327 ("perl" ,perl-boot0) ;for manpages
90d891fc 2328 ("static-bash" ,static-bash-for-glibc)
bdb36958
LC
2329 ,@(package-native-inputs gcc-boot0)))
2330
8309c389 2331 (inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp-6.0)))
bdb36958
LC
2332 ("mpfr-source" ,(package-source mpfr))
2333 ("mpc-source" ,(package-source mpc))
f50b013f 2334 ("ld-wrapper" ,(ld-wrapper-boot3))
bdb36958
LC
2335 ("binutils" ,binutils-final)
2336 ("libstdc++" ,libstdc++)
98bd851e 2337 ("zlib" ,zlib-final)
a2b2070b 2338 ,@(%boot2-inputs)))))
bdb36958 2339
a2b2070b 2340(define (%boot3-inputs)
bdb36958
LC
2341 ;; 4th stage inputs.
2342 `(("gcc" ,gcc-final)
f50b013f 2343 ("ld-wrapper" ,(ld-wrapper-boot3))
a2b2070b 2344 ,@(alist-delete "gcc" (%boot2-inputs))))
bdb36958
LC
2345
2346(define bash-final
2347 ;; Link with `-static-libgcc' to make sure we don't retain a reference
704243e0
LC
2348 ;; to the bootstrap GCC. Use "bash-minimal" to avoid an extra dependency
2349 ;; on Readline and ncurses.
99b73d0f
LC
2350 (let ((bash (static-libgcc-package bash-minimal)))
2351 (package
2352 (inherit bash)
2353 (source (bootstrap-origin (package-source bash)))
2354 (inputs (%boot3-inputs))
2355 (arguments
2356 `(#:implicit-inputs? #f
2357 #:guile ,%bootstrap-guile
2358
2359 #:disallowed-references ,(assoc-ref (%boot3-inputs) "coreutils&co")
2360
2361 ,@(package-arguments bash))))))
bdb36958 2362
a2b2070b 2363(define (%boot4-inputs)
bdb36958
LC
2364 ;; Now use the final Bash.
2365 `(("bash" ,bash-final)
a2b2070b 2366 ,@(alist-delete "bash" (%boot3-inputs))))
bdb36958
LC
2367
2368(define-public guile-final
386b71d1
LC
2369 ;; This package must be public because other modules refer to it. However,
2370 ;; mark it as hidden so that 'fold-packages' ignores it.
bdb36958 2371 (package-with-bootstrap-guile
34d624ce 2372 (package-with-explicit-inputs (hidden-package guile-2.2/fixed)
f50b013f 2373 %boot4-inputs
bdb36958
LC
2374 (current-source-location)
2375 #:guile %bootstrap-guile)))
2376
89223417 2377(define glibc-utf8-locales-final
87c8b92f
LC
2378 ;; Now that we have GUILE-FINAL, build the UTF-8 locales. They are needed
2379 ;; by the build processes afterwards so their 'scm_to_locale_string' works
2380 ;; with the full range of Unicode codepoints (remember
2381 ;; 'scm_to_locale_string' is called every time a string is passed to a C
2382 ;; function.)
2383 (package
2384 (inherit glibc-utf8-locales)
58a75996
MO
2385 (native-inputs
2386 `(("glibc" ,glibc-final)
2387 ("gzip"
2388 ,(package-with-explicit-inputs gzip %boot4-inputs
2389 (current-source-location)
2390 #:guile %bootstrap-guile))))))
87c8b92f 2391
28cbc587
LC
2392(define-public ld-wrapper
2393 ;; The final 'ld' wrapper, which uses the final Guile and Binutils.
78dea6f1
LC
2394 (make-ld-wrapper "ld-wrapper"
2395 #:binutils binutils-final
2396 #:guile guile-final
2397 #:bash bash-final))
28cbc587 2398
a2b2070b 2399(define (%boot5-inputs)
b6ac5451
LC
2400 ;; Now with UTF-8 locales. Remember that the bootstrap binaries were built
2401 ;; with an older libc, which cannot load the new locale format. See
28cbc587 2402 ;; <https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00737.html>.
b6ac5451 2403 `(("locales" ,glibc-utf8-locales-final)
a2b2070b 2404 ,@(%boot4-inputs)))
87c8b92f 2405
bdb36958
LC
2406(define gnu-make-final
2407 ;; The final GNU Make, which uses the final Guile.
099dbc4f
LC
2408 (package-with-explicit-inputs (package-with-bootstrap-guile gnu-make)
2409 (lambda _
2410 `(("guile" ,guile-final)
2411 ,@(%boot5-inputs)))
2412 (current-source-location)))
bdb36958 2413
bdb36958
LC
2414(define coreutils-final
2415 ;; The final Coreutils. Treat them specially because some packages, such as
2416 ;; Findutils, keep a reference to the Coreutils they were built with.
099dbc4f
LC
2417 (package-with-explicit-inputs (package-with-bootstrap-guile coreutils)
2418 %boot5-inputs
2419 (current-source-location)
bdb36958 2420
099dbc4f
LC
2421 ;; Use the final Guile, linked against the
2422 ;; final libc with working iconv, so that
2423 ;; 'substitute*' works well when touching
2424 ;; test files in Gettext.
2425 #:guile guile-final))
bdb36958
LC
2426
2427(define grep-final
2428 ;; The final grep. Gzip holds a reference to it (via zgrep), so it must be
2429 ;; built before gzip.
099dbc4f
LC
2430 (let ((grep (package-with-explicit-inputs
2431 (package-with-bootstrap-guile grep)
2432 %boot5-inputs
2433 (current-source-location)
2434 #:guile guile-final)))
78ca500a
LC
2435 (package/inherit grep
2436 (inputs (alist-delete "pcre" (package-inputs grep)))
2437 (native-inputs `(("perl" ,perl-boot0))))))
bdb36958 2438
a2b2070b 2439(define (%boot6-inputs)
bdb36958
LC
2440 ;; Now use the final Coreutils.
2441 `(("coreutils" ,coreutils-final)
2442 ("grep" ,grep-final)
a2b2070b 2443 ,@(%boot5-inputs)))
b0fd2bd3 2444
301a4249
LC
2445(define sed-final
2446 ;; The final sed.
099dbc4f
LC
2447 (let ((sed (package-with-explicit-inputs (package-with-bootstrap-guile sed)
2448 %boot6-inputs
2449 (current-source-location)
2450 #:guile guile-final)))
301a4249
LC
2451 (package/inherit sed (native-inputs `(("perl" ,perl-boot0))))))
2452
bdb36958
LC
2453(define-public %final-inputs
2454 ;; Final derivations used as implicit inputs by 'gnu-build-system'. We
2455 ;; still use 'package-with-bootstrap-guile' so that the bootstrap tools are
2456 ;; used for origins that have patches, thereby avoiding circular
2457 ;; dependencies.
099dbc4f
LC
2458 (let ((finalize (compose (cut package-with-explicit-inputs <> %boot6-inputs
2459 (current-source-location))
2460 package-with-bootstrap-guile)))
bdb36958 2461 `(,@(map (match-lambda
099dbc4f
LC
2462 ((name package)
2463 (list name (finalize package))))
bdb36958 2464 `(("tar" ,tar)
87c8b92f 2465 ("gzip" ,gzip)
bdb36958
LC
2466 ("bzip2" ,bzip2)
2467 ("xz" ,xz)
c00a9fbf 2468 ("file" ,file)
bdb36958
LC
2469 ("diffutils" ,diffutils)
2470 ("patch" ,patch)
bdb36958
LC
2471 ("findutils" ,findutils)
2472 ("gawk" ,gawk)))
301a4249 2473 ("sed" ,sed-final)
bdb36958
LC
2474 ("grep" ,grep-final)
2475 ("coreutils" ,coreutils-final)
2476 ("make" ,gnu-make-final)
2477 ("bash" ,bash-final)
2478 ("ld-wrapper" ,ld-wrapper)
2479 ("binutils" ,binutils-final)
2480 ("gcc" ,gcc-final)
b0fd2bd3 2481 ("libc" ,glibc-final)
6dff905e 2482 ("libc:static" ,glibc-final "static")
b0fd2bd3 2483 ("locales" ,glibc-utf8-locales-final))))
bdb36958
LC
2484
2485(define-public canonical-package
2486 (let ((name->package (fold (lambda (input result)
2487 (match input
6dff905e 2488 ((_ package . outputs)
bdb36958
LC
2489 (vhash-cons (package-full-name package)
2490 package result))))
2491 vlist-null
2492 `(("guile" ,guile-final)
2493 ,@%final-inputs))))
2494 (lambda (package)
2495 "Return the 'canonical' variant of PACKAGE---i.e., if PACKAGE is one of
2496the implicit inputs of 'gnu-build-system', return that one, otherwise return
2497PACKAGE.
2498
34d624ce 2499The goal is to avoid duplication in cases like GUILE-FINAL vs. GUILE-2.2,
bdb36958
LC
2500COREUTILS-FINAL vs. COREUTILS, etc."
2501 ;; XXX: This doesn't handle dependencies of the final inputs, such as
2502 ;; libunistring, GMP, etc.
2503 (match (vhash-assoc (package-full-name package) name->package)
2504 ((_ . canon)
2505 ;; In general we want CANON, except if we're cross-compiling: CANON
2506 ;; uses explicit inputs, so it is "anchored" in the bootstrapped
2507 ;; process, with dependencies on things that cannot be
2508 ;; cross-compiled.
2509 (if (%current-target-system)
2510 package
2511 canon))
2512 (_ package)))))
2513
2514\f
2515;;;
2516;;; GCC toolchain.
2517;;;
2518
6869b663
CD
2519;; Using the following procedure, a gcc toolchain targeting glibc-2.27 can be
2520;; instantiated like this:
2521;;
2522;; (define-public gcc-glibc-2.27-toolchain
2523;; (make-gcc-toolchain gcc glibc-2.27))
2524
2525(define* (make-gcc-toolchain gcc
2526 #:optional
2527 (libc #f))
2528 "Return a complete toolchain for GCC. If LIBC is specified, target that libc."
2529 (let ((gcc (if libc (make-gcc-libc gcc libc) gcc))
2530 (libc (if libc libc glibc-final)))
2531 (package
2532 (name (string-append (package-name gcc) "-toolchain"))
2533 (version (package-version gcc))
2534 (source #f)
2535 (build-system trivial-build-system)
2536 (arguments
2537 '(#:modules ((guix build union))
2538 #:builder (begin
2539 (use-modules (ice-9 match)
2540 (srfi srfi-26)
2541 (guix build union))
2542
2543 (let ((out (assoc-ref %outputs "out")))
2544
2545 (match %build-inputs
2546 (((names . directories) ...)
2547 (union-build out directories)))
2548
2549 (union-build (assoc-ref %outputs "debug")
2550 (list (assoc-ref %build-inputs
2551 "libc-debug")))
2552 (union-build (assoc-ref %outputs "static")
2553 (list (assoc-ref %build-inputs
2554 "libc-static")))
2555 #t))))
2556
2557 (native-search-paths (package-native-search-paths gcc))
2558 (search-paths (package-search-paths gcc))
2559
2560 (license (package-license gcc))
2561 (synopsis "Complete GCC tool chain for C/C++ development")
2562 (description
2563 "This package provides a complete GCC tool chain for C/C++ development to
2564be installed in user profiles. This includes GCC, as well as libc (headers
2565an d binaries, plus debugging symbols in the @code{debug} output), and Binutils.")
2566 (home-page "https://gcc.gnu.org/")
2567 (outputs '("out" "debug" "static"))
2568
2569 ;; The main raison d'être of this "meta-package" is (1) to conveniently
2570 ;; install everything that we need, and (2) to make sure ld-wrapper comes
2571 ;; before Binutils' ld in the user's profile.
2572 (inputs `(("gcc" ,gcc)
2573 ("ld-wrapper" ,(car (assoc-ref %final-inputs "ld-wrapper")))
2574 ("binutils" ,binutils-final)
2575 ("libc" ,libc)
2576 ("libc-debug" ,libc "debug")
2577 ("libc-static" ,libc "static"))))))
bdb36958 2578
01e8263f
MB
2579(define-public gcc-toolchain
2580 (make-gcc-toolchain gcc-final))
2581
bdb36958 2582(define-public gcc-toolchain-4.8
b887ede1 2583 (make-gcc-toolchain gcc-4.8))
bdb36958
LC
2584
2585(define-public gcc-toolchain-4.9
b887ede1
LC
2586 (make-gcc-toolchain gcc-4.9))
2587
629f4d2e 2588(define-public gcc-toolchain-5
01e8263f 2589 (make-gcc-toolchain gcc-5))
60e2d5fe 2590
e760ec41 2591(define-public gcc-toolchain-6
b887ede1 2592 (make-gcc-toolchain gcc-6))
e760ec41 2593
d7ecab74 2594(define-public gcc-toolchain-7
01e8263f 2595 gcc-toolchain)
d7ecab74 2596
5ae27f57
LC
2597(define-public gcc-toolchain-8
2598 (make-gcc-toolchain gcc-8))
2599
bdfc3276
CD
2600(define-public gcc-toolchain-9
2601 (make-gcc-toolchain gcc-9))
2602
bdb36958 2603;;; commencement.scm ends here