derivations: Use a regular hash table for the module cache.
[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
efa8fdda
LC
1801(define with-boot0
1802 (package-with-explicit-inputs %boot0-inputs
1803 %bootstrap-guile))
1804
d75acc29 1805(define gnumach-headers-boot0
efa8fdda 1806 (with-boot0 (package-with-bootstrap-guile gnumach-headers)))
d75acc29
MR
1807
1808(define mig-boot0
efa8fdda
LC
1809 (let* ((mig (package
1810 (inherit (package-with-bootstrap-guile mig))
d75acc29
MR
1811 (native-inputs `(("bison" ,bison-boot0)
1812 ("flex" ,flex-boot0)))
1813 (inputs `(("flex" ,flex-boot0)))
1814 (arguments
1815 `(#:configure-flags
1816 `(,(string-append "LDFLAGS=-Wl,-rpath="
1817 (assoc-ref %build-inputs "flex") "/lib/")))))))
efa8fdda 1818 (with-boot0 mig)))
d75acc29
MR
1819
1820(define hurd-headers-boot0
1821 (let ((hurd-headers (package (inherit hurd-headers)
1822 (native-inputs `(("mig" ,mig-boot0)))
1823 (inputs '()))))
efa8fdda 1824 (with-boot0 (package-with-bootstrap-guile hurd-headers))))
d75acc29
MR
1825
1826(define hurd-minimal-boot0
1827 (let ((hurd-minimal (package (inherit hurd-minimal)
1828 (native-inputs `(("mig" ,mig-boot0)))
1829 (inputs '()))))
efa8fdda 1830 (with-boot0 (package-with-bootstrap-guile hurd-minimal))))
d75acc29 1831
8102cf0b
LC
1832(define hurd-core-headers-boot0
1833 (mlambda ()
1834 "Return the Hurd and Mach headers as well as initial Hurd libraries for
d75acc29 1835the bootstrap environment."
efa8fdda
LC
1836 (package (inherit (package-with-bootstrap-guile hurd-core-headers))
1837 (arguments `(#:guile ,%bootstrap-guile
1838 ,@(package-arguments hurd-core-headers)))
1839 (inputs
1840 `(("gnumach-headers" ,gnumach-headers-boot0)
1841 ("hurd-headers" ,hurd-headers-boot0)
1842 ("hurd-minimal" ,hurd-minimal-boot0)
1843 ,@(%boot0-inputs))))))
d75acc29
MR
1844
1845(define* (kernel-headers-boot0 #:optional (system (%current-system)))
1846 (match system
1847 ("i586-gnu" (hurd-core-headers-boot0))
1848 (_ (linux-libre-headers-boot0))))
1849
bdb36958
LC
1850(define texinfo-boot0
1851 ;; Texinfo used to build libc's manual.
1852 ;; We build without ncurses because it fails to build at this stage, and
1853 ;; because we don't need the stand-alone Info reader.
a2b2070b 1854 ;; Also, use (%BOOT0-INPUTS) to avoid building Perl once more.
99b73d0f
LC
1855 (package
1856 (inherit texinfo)
1857 (native-inputs '())
1858 (inputs `(,@(%boot0-inputs)
1859 ("perl" ,perl-boot0)))
1860 (arguments
1861 `(#:implicit-inputs? #f
1862 #:guile ,%bootstrap-guile
1863
1864 ;; Some of Texinfo 6.1's tests would fail with "Couldn't set UTF-8
1865 ;; character type in locale" but we don't have a UTF-8 locale at this
1866 ;; stage, so skip them.
1867 #:tests? #f))))
bdb36958 1868
5f3f7039
MB
1869(define expat-sans-tests
1870 (package
1871 (inherit expat)
99b73d0f 1872 (inputs (%boot0-inputs))
5f3f7039
MB
1873 (arguments
1874 ;; XXX: Linking 'runtestscpp' fails with things like:
1875 ;;
1876 ;; ld: Dwarf Error: found dwarf version '3789', this reader only handles version 2 and 3 information.
1877 ;;
1878 ;; Skip tests altogether.
99b73d0f
LC
1879 `(#:implicit-inputs? #f
1880 #:guile ,%bootstrap-guile
1881
1882 ,@(substitute-keyword-arguments (package-arguments expat)
1883 ((#:configure-flags flags ''())
1884 ;; Since we're not passing the right -Wl,-rpath flags, build the
1885 ;; static library to avoid RUNPATH validation failure.
1886 `(cons "--disable-shared" ,flags))
1887 ((#:tests? _ #f) #f))))))
5f3f7039
MB
1888
1889(define python-boot0
99b73d0f
LC
1890 (package
1891 (inherit python-minimal)
1892 ;; We cannot use Python 3.7 and later here, because they require
1893 ;; pthreads, which is missing on non-x86 platforms at this stage.
1894 ;; Python 3.6 technically supports being built without threading
1895 ;; support, but requires additional patches.
1896 (version "3.5.7")
1897 (source (bootstrap-origin
1898 (origin
1899 (inherit (package-source python))
1900 (uri (string-append "https://www.python.org/ftp/python/"
1901 version "/Python-" version ".tar.xz"))
1902 (patches '())
1903 (sha256
1904 (base32
1905 "1p67pnp2ca5przx2s45r8m55dcn6f5hsm0l4s1zp7mglkf4r4n18")))))
1906 (inputs
1907 `(,@(%boot0-inputs)
1908 ("expat" ,expat-sans-tests))) ;remove OpenSSL, zlib, etc.
1909 (native-inputs '()) ;and pkg-config
1910 (arguments
1911 `(#:implicit-inputs? #f
1912 #:guile ,%bootstrap-guile
1913
1914 ,@(substitute-keyword-arguments (package-arguments python-minimal)
1915 ;; Disable features that cannot be built at this stage.
1916 ((#:configure-flags _ ''())
1917 `(list "--without-ensurepip"
1918 "--without-threads"))
1919 ;; Clear #:make-flags, such that changes to the regular
1920 ;; Python package won't interfere with this one.
1921 ((#:make-flags _ ''()) ''())
1922 ((#:phases phases)
1923 `(modify-phases ,phases
1924 (add-before 'configure 'disable-modules
1925 (lambda _
1926 (substitute* "setup.py"
1927 ;; Disable ctypes, since it requires libffi.
1928 (("extensions\\.append\\(ctypes\\)") "")
1929 ;; Prevent the 'ossaudiodev' extension from being
1930 ;; built, since it requires Linux headers.
1931 (("'linux', ") ""))
1932 #t))
1933 (delete 'set-TZDIR)))
1934 ((#:tests? _ #f) #f))))))
5f3f7039 1935
dab669e0
LC
1936(define ld-wrapper-boot0
1937 (mlambda ()
1938 ;; We need this so binaries on Hurd will have libmachuser and libhurduser
1939 ;; in their RUNPATH, otherwise validate-runpath will fail.
1940 (make-ld-wrapper "ld-wrapper-boot0"
1941 #:target boot-triplet
1942 #:binutils binutils-boot0
1943 #:guile %bootstrap-guile
1944 #:bash (car (assoc-ref (%boot0-inputs) "bash"))
1945 #:guile-for-build %bootstrap-guile)))
d75acc29 1946
a2b2070b 1947(define (%boot1-inputs)
bdb36958
LC
1948 ;; 2nd stage inputs.
1949 `(("gcc" ,gcc-boot0)
f50b013f 1950 ("ld-wrapper-cross" ,(ld-wrapper-boot0))
bdb36958 1951 ("binutils-cross" ,binutils-boot0)
a2b2070b 1952 ,@(alist-delete "binutils" (%boot0-inputs))))
bdb36958
LC
1953
1954(define glibc-final-with-bootstrap-bash
1955 ;; The final libc, "cross-built". If everything went well, the resulting
1956 ;; store path has no dependencies. Actually, the really-final libc is
1957 ;; built just below; the only difference is that this one uses the
1958 ;; bootstrap Bash.
99b73d0f
LC
1959 (package
1960 (inherit glibc)
1961 (name "glibc-intermediate")
1962 (source (bootstrap-origin (package-source glibc)))
1963 (arguments
1964 `(#:guile ,%bootstrap-guile
1965 #:implicit-inputs? #f
1966
1967 ,@(substitute-keyword-arguments (package-arguments glibc)
1968 ((#:configure-flags flags)
1969 `(append (list ,(string-append "--host=" (boot-triplet))
1970 ,(string-append "--build="
1971 (nix-system->gnu-triplet)))
1972 ,flags))
1973 ((#:phases phases)
1974 `(modify-phases ,phases
1975 (add-before 'configure 'pre-configure
1976 (lambda* (#:key inputs #:allow-other-keys)
1977 ;; Don't clobber CPATH with the bootstrap libc.
1978 (setenv "NATIVE_CPATH" (getenv "CPATH"))
1979 (unsetenv "CPATH")
1980
1981 ;; Tell 'libpthread' where to find 'libihash' on Hurd systems.
1982 ,@(if (hurd-triplet? (%current-system))
1983 `((substitute* "libpthread/Makefile"
1984 (("LDLIBS-pthread.so =.*")
1985 (string-append "LDLIBS-pthread.so = "
1986 (assoc-ref %build-inputs "kernel-headers")
1987 "/lib/libihash.a\n"))))
1988 '())
1989
1990 ;; 'rpcgen' needs native libc headers to be built.
1991 (substitute* "sunrpc/Makefile"
1992 (("sunrpc-CPPFLAGS =.*" all)
1993 (string-append "CPATH = $(NATIVE_CPATH)\n"
1994 "export CPATH\n"
1995 all "\n")))
1996 #t)))))))
1997 (propagated-inputs `(("kernel-headers" ,(kernel-headers-boot0))))
1998 (native-inputs
1999 `(("bison" ,bison-boot0)
2000 ("texinfo" ,texinfo-boot0)
2001 ("perl" ,perl-boot0)
2002 ("python" ,python-boot0)))
2003 (inputs
2004 `( ;; The boot inputs. That includes the bootstrap libc. We don't want
2005 ;; it in $CPATH, hence the 'pre-configure' phase above.
2006 ,@(%boot1-inputs)
2007
2008 ;; A native MiG is needed to build Glibc on Hurd.
2009 ,@(if (hurd-triplet? (%current-system))
2010 `(("mig" ,mig-boot0))
2011 '())
2012
2013 ;; A native GCC is needed to build `cross-rpcgen'.
2014 ("native-gcc" ,@(assoc-ref (%boot0-inputs) "gcc"))
2015
2016 ;; Here, we use the bootstrap Bash, which is not satisfactory
2017 ;; because we don't want to depend on bootstrap tools.
2018 ("static-bash" ,@(assoc-ref (%boot0-inputs) "bash"))))))
bdb36958
LC
2019
2020(define (cross-gcc-wrapper gcc binutils glibc bash)
2021 "Return a wrapper for the pseudo-cross toolchain GCC/BINUTILS/GLIBC
2022that makes it available under the native tool names."
c92f1c0a 2023 (package (inherit gcc)
bdb36958
LC
2024 (name (string-append (package-name gcc) "-wrapped"))
2025 (source #f)
2026 (build-system trivial-build-system)
2027 (outputs '("out"))
2028 (arguments
2029 `(#:guile ,%bootstrap-guile
2030 #:modules ((guix build utils))
2031 #:builder (begin
2032 (use-modules (guix build utils))
2033
2034 (let* ((binutils (assoc-ref %build-inputs "binutils"))
2035 (gcc (assoc-ref %build-inputs "gcc"))
2036 (libc (assoc-ref %build-inputs "libc"))
2037 (bash (assoc-ref %build-inputs "bash"))
2038 (out (assoc-ref %outputs "out"))
2039 (bindir (string-append out "/bin"))
2040 (triplet ,(boot-triplet)))
2041 (define (wrap-program program)
2042 ;; GCC-BOOT0 is a libc-less cross-compiler, so it
2043 ;; needs to be told where to find the crt files and
2044 ;; the dynamic linker.
2045 (call-with-output-file program
2046 (lambda (p)
2047 (format p "#!~a/bin/bash
2048exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
2049 bash
2050 gcc triplet program
2051 libc libc
2052 ,(glibc-dynamic-linker))))
2053
2054 (chmod program #o555))
2055
2056 (mkdir-p bindir)
2057 (with-directory-excursion bindir
2058 (for-each (lambda (tool)
2059 (symlink (string-append binutils "/bin/"
2060 triplet "-" tool)
2061 tool))
2062 '("ar" "ranlib"))
e3cfef22
MW
2063 (for-each wrap-program '("gcc" "g++")))
2064
2065 #t))))
bdb36958
LC
2066 (native-inputs
2067 `(("binutils" ,binutils)
2068 ("gcc" ,gcc)
2069 ("libc" ,glibc)
2070 ("bash" ,bash)))
2071 (inputs '())))
2072
32793c09
LC
2073(define gcc-boot0-intermediate-wrapped
2074 (mlambda ()
2075 ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
2076 ;; non-cross names.
2077 (cross-gcc-wrapper gcc-boot0 binutils-boot0
2078 glibc-final-with-bootstrap-bash
2079 (car (assoc-ref (%boot1-inputs) "bash")))))
eb443459 2080
bdb36958 2081(define static-bash-for-glibc
90d891fc 2082 ;; A statically-linked Bash to be used by GLIBC-FINAL in system(3) & co.
99b73d0f
LC
2083 (package
2084 (inherit static-bash)
2085 (source (bootstrap-origin (package-source static-bash)))
2086 (inputs `(("gcc" ,(gcc-boot0-intermediate-wrapped))
2087 ("libc" ,glibc-final-with-bootstrap-bash)
2088 ("libc:static" ,glibc-final-with-bootstrap-bash "static")
2089 ,@(fold alist-delete (%boot1-inputs)
2090 '("gcc" "libc"))))
2091 (arguments
2092 `(#:implicit-inputs? #f
2093 #:guile ,%bootstrap-guile
2094
2095 ,@(substitute-keyword-arguments (package-arguments static-bash)
2096 ((#:configure-flags flags '())
2097 ;; Add a '-L' flag so that the pseudo-cross-ld of
2098 ;; BINUTILS-BOOT0 can find libc.a.
2099 `(append ,flags
2100 (list (string-append "LDFLAGS=-static -L"
2101 (assoc-ref %build-inputs
2102 "libc:static")
2103 "/lib")))))))))
bdb36958 2104
6162b95d
LC
2105(define gettext-boot0
2106 ;; A minimal gettext used during bootstrap.
99b73d0f
LC
2107 (package
2108 (inherit gettext-minimal)
2109 (name "gettext-boot0")
2110 ;; Newer versions of GNU gettext depends on libxml2 and ncurses. To
2111 ;; simplify the dependency chain, we stick to this version here.
2112 (version "0.19.8.1")
2113 (source (origin
2114 (method url-fetch)
2115 (uri (string-append "mirror://gnu/gettext/gettext-"
2116 version ".tar.gz"))
2117 (sha256
2118 (base32
2119 "0hsw28f9q9xaggjlsdp2qmbp2rbd1mp0njzan2ld9kiqwkq2m57z"))))
2120 (inputs (%boot1-inputs)) ;zero dependencies
2121 (arguments
2122 `(#:implicit-inputs? #f
2123 #:guile ,%bootstrap-guile
2124 #:tests? #f
2125 #:phases (modify-phases %standard-phases
2126 ;; Build only the tools.
2127 (add-after 'unpack 'chdir
2128 (lambda _
2129 (chdir "gettext-tools")
2130 #t))
2131
2132 ;; Some test programs require pthreads, which we don't have.
2133 (add-before 'configure 'no-test-programs
2134 (lambda _
2135 (substitute* "tests/Makefile.in"
2136 (("^PROGRAMS =.*$")
2137 "PROGRAMS =\n"))
2138 #t)))))))
6162b95d 2139
89223417 2140(define glibc-final
bdb36958 2141 ;; The final glibc, which embeds the statically-linked Bash built above.
7c788ed2 2142 ;; Use 'package/inherit' so we get the 'replacement' of 'glibc', if any.
99b73d0f
LC
2143 (package/inherit
2144 glibc
2145 (name "glibc")
2146 (source (bootstrap-origin (package-source glibc)))
2147 (inputs `(("static-bash" ,static-bash-for-glibc)
2148 ,@(alist-delete
2149 "static-bash"
2150 (package-inputs glibc-final-with-bootstrap-bash))))
2151
2152 ;; This time we need 'msgfmt' to install all the libc.mo files.
2153 (native-inputs `(,@(package-native-inputs glibc-final-with-bootstrap-bash)
2154 ("gettext" ,gettext-boot0)))
2155
2156 (propagated-inputs
2157 (package-propagated-inputs glibc-final-with-bootstrap-bash))
2158
2159 ;; The final libc only refers to itself, but the 'debug' output contains
2160 ;; references to GCC-BOOT0 and to the Linux headers. XXX: Would be great
2161 ;; if 'allowed-references' were per-output.
2162 (arguments
2163 `(#:allowed-references
2164 ,(cons* `(,gcc-boot0 "lib") (kernel-headers-boot0)
2165 static-bash-for-glibc
2166 (package-outputs glibc-final-with-bootstrap-bash))
2167
2168 ,@(package-arguments glibc-final-with-bootstrap-bash)))))
bdb36958 2169
32793c09
LC
2170(define gcc-boot0-wrapped
2171 (mlambda ()
2172 ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
2173 ;; non-cross names.
2174 (cross-gcc-wrapper gcc-boot0 binutils-boot0 glibc-final
2175 (car (assoc-ref (%boot1-inputs) "bash")))))
bdb36958 2176
a2b2070b 2177(define (%boot2-inputs)
bdb36958
LC
2178 ;; 3rd stage inputs.
2179 `(("libc" ,glibc-final)
6dff905e 2180 ("libc:static" ,glibc-final "static")
f50b013f 2181 ("gcc" ,(gcc-boot0-wrapped))
4ae7dc7b 2182 ,@(fold alist-delete (%boot1-inputs) '("libc" "gcc" "linux-libre-headers"))))
bdb36958
LC
2183
2184(define binutils-final
99b73d0f
LC
2185 (package
2186 (inherit binutils)
2187 (source (bootstrap-origin (package-source binutils)))
2188 (arguments
2189 `(#:guile ,%bootstrap-guile
2190 #:implicit-inputs? #f
2191 #:allowed-references ("out" ,glibc-final)
2192 ,@(package-arguments binutils)))
2193 (inputs (%boot2-inputs))))
bdb36958
LC
2194
2195(define libstdc++
2196 ;; Intermediate libstdc++ that will allow us to build the final GCC
2197 ;; (remember that GCC-BOOT0 cannot build libstdc++.)
99b73d0f 2198 (let ((lib (make-libstdc++ gcc)))
86d02fa8
EF
2199 (package
2200 (inherit lib)
99b73d0f 2201 (source (bootstrap-origin (package-source lib)))
86d02fa8
EF
2202 (arguments
2203 `(#:guile ,%bootstrap-guile
2204 #:implicit-inputs? #f
2205 #:allowed-references ("out")
2206
2207 ;; XXX: libstdc++.so NEEDs ld.so for some reason.
2208 #:validate-runpath? #f
2209
2210 ;; All of the package arguments from 'make-libstdc++
2211 ;; except for the configure-flags.
2212 ,@(package-arguments lib)
2213 #:configure-flags `("--disable-shared"
01e8263f 2214 "--disable-libstdcxx-dual-abi"
86d02fa8
EF
2215 "--disable-libstdcxx-threads"
2216 "--disable-libstdcxx-pch"
2217 ,(string-append "--with-gxx-include-dir="
2218 (assoc-ref %outputs "out")
2219 "/include"))))
2220 (outputs '("out"))
a2b2070b 2221 (inputs (%boot2-inputs))
86d02fa8 2222 (synopsis "GNU C++ standard library (intermediate)"))))
bdb36958 2223
98bd851e
LC
2224(define zlib-final
2225 ;; Zlib used by GCC-FINAL.
99b73d0f
LC
2226 (package
2227 (inherit zlib)
2228 (arguments
2229 `(#:guile ,%bootstrap-guile
2230 #:implicit-inputs? #f
2231 #:allowed-references ("out" ,glibc-final)
2232 ,@(package-arguments zlib)))
2233 (inputs (%boot2-inputs))))
98bd851e 2234
dab669e0
LC
2235(define ld-wrapper-boot3
2236 (mlambda ()
2237 ;; A linker wrapper that uses the bootstrap Guile.
2238 (make-ld-wrapper "ld-wrapper-boot3"
2239 #:binutils binutils-final
2240 #:guile %bootstrap-guile
2241 #:bash (car (assoc-ref (%boot2-inputs) "bash"))
2242 #:guile-for-build %bootstrap-guile)))
98bd851e 2243
89223417 2244(define gcc-final
bdb36958
LC
2245 ;; The final GCC.
2246 (package (inherit gcc-boot0)
2247 (name "gcc")
ab999c25
LC
2248
2249 ;; XXX: Currently #:allowed-references applies to all the outputs but the
2250 ;; "debug" output contains disallowed references, notably
2251 ;; linux-libre-headers. Disable the debugging output to work around that.
2252 (outputs (delete "debug" (package-outputs gcc-boot0)))
2253
bdb36958
LC
2254 (arguments
2255 `(#:guile ,%bootstrap-guile
2256 #:implicit-inputs? #f
2257
98bd851e 2258 #:allowed-references ("out" "lib" ,zlib-final
90d891fc 2259 ,glibc-final ,static-bash-for-glibc)
bdb36958 2260
d485ebba
LC
2261 ;; Things like libasan.so and libstdc++.so NEED ld.so for some
2262 ;; reason, but it is not in their RUNPATH. This is a false
2263 ;; positive, so turn it off.
2264 #:validate-runpath? #f
2265
eb443459 2266 ,@(substitute-keyword-arguments (package-arguments gcc)
bdb36958 2267 ((#:make-flags flags)
52cfd8cb 2268 ;; Since $LIBRARY_PATH is not honored, add the relevant flags.
98bd851e
LC
2269 `(let ((zlib (assoc-ref %build-inputs "zlib")))
2270 (map (lambda (flag)
2271 (if (string-prefix? "LDFLAGS=" flag)
2272 (string-append flag " -L"
2273 (assoc-ref %build-inputs "libstdc++")
2274 "/lib -L" zlib "/lib -Wl,-rpath="
2275 zlib "/lib")
2276 flag))
2277 ,flags)))
eb443459
JN
2278 ;; Build again GMP & co. within GCC's build process, because it's hard
2279 ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
2280 ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
bdb36958 2281 ((#:phases phases)
eb443459
JN
2282 `(modify-phases ,phases
2283 (add-after 'unpack 'unpack-gmp&co
2284 (lambda* (#:key inputs #:allow-other-keys)
2285 (let ((gmp (assoc-ref %build-inputs "gmp-source"))
2286 (mpfr (assoc-ref %build-inputs "mpfr-source"))
2287 (mpc (assoc-ref %build-inputs "mpc-source")))
2288
2289 ;; To reduce the set of pre-built bootstrap inputs, build
2290 ;; GMP & co. from GCC.
2291 (for-each (lambda (source)
2292 (invoke "tar" "xvf" source))
2293 (list gmp mpfr mpc))
2294
2295 ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
2296 ,@(map (lambda (lib)
2297 ;; Drop trailing letters, as gmp-6.0.0a unpacks
2298 ;; into gmp-6.0.0.
2299 `(symlink ,(string-trim-right
2300 (package-full-name lib "-")
2301 char-set:letter)
2302 ,(package-name lib)))
2303 (list gmp-6.0 mpfr mpc))
01e8263f
MB
2304 #t)))
2305 (add-before 'configure 'treat-glibc-as-system-header
2306 (lambda* (#:key inputs #:allow-other-keys)
2307 (let ((libc (assoc-ref inputs "libc")))
2308 ;; Make sure Glibc is treated as a "system header" so
2309 ;; #include_next does the right thing.
2310 (for-each (lambda (var)
2311 (setenv var (string-append libc "/include")))
2312 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"))
eb443459 2313 #t))))))))
bdb36958 2314
90d891fc
LC
2315 ;; This time we want Texinfo, so we get the manual. Add
2316 ;; STATIC-BASH-FOR-GLIBC so that it's used in the final shebangs of
2317 ;; scripts such as 'mkheaders' and 'fixinc.sh' (XXX: who cares about these
2318 ;; scripts?).
bdb36958 2319 (native-inputs `(("texinfo" ,texinfo-boot0)
19d27131 2320 ("perl" ,perl-boot0) ;for manpages
90d891fc 2321 ("static-bash" ,static-bash-for-glibc)
bdb36958
LC
2322 ,@(package-native-inputs gcc-boot0)))
2323
8309c389 2324 (inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp-6.0)))
bdb36958
LC
2325 ("mpfr-source" ,(package-source mpfr))
2326 ("mpc-source" ,(package-source mpc))
f50b013f 2327 ("ld-wrapper" ,(ld-wrapper-boot3))
bdb36958
LC
2328 ("binutils" ,binutils-final)
2329 ("libstdc++" ,libstdc++)
98bd851e 2330 ("zlib" ,zlib-final)
a2b2070b 2331 ,@(%boot2-inputs)))))
bdb36958 2332
a2b2070b 2333(define (%boot3-inputs)
bdb36958
LC
2334 ;; 4th stage inputs.
2335 `(("gcc" ,gcc-final)
f50b013f 2336 ("ld-wrapper" ,(ld-wrapper-boot3))
a2b2070b 2337 ,@(alist-delete "gcc" (%boot2-inputs))))
bdb36958
LC
2338
2339(define bash-final
2340 ;; Link with `-static-libgcc' to make sure we don't retain a reference
704243e0
LC
2341 ;; to the bootstrap GCC. Use "bash-minimal" to avoid an extra dependency
2342 ;; on Readline and ncurses.
99b73d0f
LC
2343 (let ((bash (static-libgcc-package bash-minimal)))
2344 (package
2345 (inherit bash)
2346 (source (bootstrap-origin (package-source bash)))
2347 (inputs (%boot3-inputs))
2348 (arguments
2349 `(#:implicit-inputs? #f
2350 #:guile ,%bootstrap-guile
2351
2352 #:disallowed-references ,(assoc-ref (%boot3-inputs) "coreutils&co")
2353
2354 ,@(package-arguments bash))))))
bdb36958 2355
a2b2070b 2356(define (%boot4-inputs)
bdb36958
LC
2357 ;; Now use the final Bash.
2358 `(("bash" ,bash-final)
a2b2070b 2359 ,@(alist-delete "bash" (%boot3-inputs))))
bdb36958 2360
8f417ed2
LC
2361(define with-boot4
2362 (package-with-explicit-inputs %boot4-inputs %bootstrap-guile))
2363
bdb36958 2364(define-public guile-final
386b71d1
LC
2365 ;; This package must be public because other modules refer to it. However,
2366 ;; mark it as hidden so that 'fold-packages' ignores it.
8f417ed2
LC
2367 (with-boot4 (hidden-package
2368 (package-with-bootstrap-guile guile-2.2/fixed))))
bdb36958 2369
89223417 2370(define glibc-utf8-locales-final
87c8b92f
LC
2371 ;; Now that we have GUILE-FINAL, build the UTF-8 locales. They are needed
2372 ;; by the build processes afterwards so their 'scm_to_locale_string' works
2373 ;; with the full range of Unicode codepoints (remember
2374 ;; 'scm_to_locale_string' is called every time a string is passed to a C
2375 ;; function.)
2376 (package
2377 (inherit glibc-utf8-locales)
58a75996
MO
2378 (native-inputs
2379 `(("glibc" ,glibc-final)
8f417ed2 2380 ("gzip" ,(with-boot4 gzip))))))
87c8b92f 2381
28cbc587
LC
2382(define-public ld-wrapper
2383 ;; The final 'ld' wrapper, which uses the final Guile and Binutils.
78dea6f1
LC
2384 (make-ld-wrapper "ld-wrapper"
2385 #:binutils binutils-final
2386 #:guile guile-final
2387 #:bash bash-final))
28cbc587 2388
a2b2070b 2389(define (%boot5-inputs)
b6ac5451
LC
2390 ;; Now with UTF-8 locales. Remember that the bootstrap binaries were built
2391 ;; with an older libc, which cannot load the new locale format. See
28cbc587 2392 ;; <https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00737.html>.
b6ac5451 2393 `(("locales" ,glibc-utf8-locales-final)
a2b2070b 2394 ,@(%boot4-inputs)))
87c8b92f 2395
8f417ed2
LC
2396(define with-boot5
2397 (package-with-explicit-inputs %boot5-inputs))
2398
bdb36958
LC
2399(define gnu-make-final
2400 ;; The final GNU Make, which uses the final Guile.
8f417ed2
LC
2401 ;; FIXME: This is a mistake: we shouldn't be propagating GUILE-FINAL to
2402 ;; PKG-CONFIG.
2403 ;; TODO: Fix that on the next rebuild cycle.
2404 (let ((pkg-config (package
2405 (inherit pkg-config)
2406 (inputs `(("guile" ,guile-final)
2407 ,@(%boot5-inputs)))
2408 (arguments
2409 `(#:implicit-inputs? #f
2410 ,@(package-arguments pkg-config))))))
2411 (package
2412 (inherit (package-with-bootstrap-guile gnu-make))
2413 (inputs `(("guile" ,guile-final)
2414 ,@(%boot5-inputs)))
2415 (native-inputs `(("pkg-config" ,pkg-config)))
2416 (arguments
2417 `(#:implicit-inputs? #f
2418 ,@(package-arguments gnu-make))))))
2419
bdb36958 2420
bdb36958
LC
2421(define coreutils-final
2422 ;; The final Coreutils. Treat them specially because some packages, such as
2423 ;; Findutils, keep a reference to the Coreutils they were built with.
8f417ed2
LC
2424 (with-boot5 (package-with-bootstrap-guile coreutils)
2425 ;; Use the final Guile, linked against the
2426 ;; final libc with working iconv, so that
2427 ;; 'substitute*' works well when touching
2428 ;; test files in Gettext.
2429 ))
bdb36958
LC
2430
2431(define grep-final
2432 ;; The final grep. Gzip holds a reference to it (via zgrep), so it must be
2433 ;; built before gzip.
8f417ed2 2434 (let ((grep (with-boot5 (package-with-bootstrap-guile grep))))
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
8f417ed2
LC
2445(define with-boot6
2446 (package-with-explicit-inputs %boot6-inputs))
2447
301a4249
LC
2448(define sed-final
2449 ;; The final sed.
8f417ed2 2450 (let ((sed (with-boot6 (package-with-bootstrap-guile sed))))
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.
8f417ed2 2458 (let ((finalize (compose with-boot6
099dbc4f 2459 package-with-bootstrap-guile)))
bdb36958 2460 `(,@(map (match-lambda
099dbc4f
LC
2461 ((name package)
2462 (list name (finalize package))))
bdb36958 2463 `(("tar" ,tar)
87c8b92f 2464 ("gzip" ,gzip)
bdb36958
LC
2465 ("bzip2" ,bzip2)
2466 ("xz" ,xz)
c00a9fbf 2467 ("file" ,file)
bdb36958
LC
2468 ("diffutils" ,diffutils)
2469 ("patch" ,patch)
bdb36958
LC
2470 ("findutils" ,findutils)
2471 ("gawk" ,gawk)))
301a4249 2472 ("sed" ,sed-final)
bdb36958
LC
2473 ("grep" ,grep-final)
2474 ("coreutils" ,coreutils-final)
2475 ("make" ,gnu-make-final)
2476 ("bash" ,bash-final)
2477 ("ld-wrapper" ,ld-wrapper)
2478 ("binutils" ,binutils-final)
2479 ("gcc" ,gcc-final)
b0fd2bd3 2480 ("libc" ,glibc-final)
6dff905e 2481 ("libc:static" ,glibc-final "static")
b0fd2bd3 2482 ("locales" ,glibc-utf8-locales-final))))
bdb36958
LC
2483
2484(define-public canonical-package
2485 (let ((name->package (fold (lambda (input result)
2486 (match input
6dff905e 2487 ((_ package . outputs)
bdb36958
LC
2488 (vhash-cons (package-full-name package)
2489 package result))))
2490 vlist-null
2491 `(("guile" ,guile-final)
2492 ,@%final-inputs))))
2493 (lambda (package)
2494 "Return the 'canonical' variant of PACKAGE---i.e., if PACKAGE is one of
2495the implicit inputs of 'gnu-build-system', return that one, otherwise return
2496PACKAGE.
2497
34d624ce 2498The goal is to avoid duplication in cases like GUILE-FINAL vs. GUILE-2.2,
bdb36958
LC
2499COREUTILS-FINAL vs. COREUTILS, etc."
2500 ;; XXX: This doesn't handle dependencies of the final inputs, such as
2501 ;; libunistring, GMP, etc.
2502 (match (vhash-assoc (package-full-name package) name->package)
2503 ((_ . canon)
2504 ;; In general we want CANON, except if we're cross-compiling: CANON
2505 ;; uses explicit inputs, so it is "anchored" in the bootstrapped
2506 ;; process, with dependencies on things that cannot be
2507 ;; cross-compiled.
2508 (if (%current-target-system)
2509 package
2510 canon))
2511 (_ package)))))
2512
2513\f
2514;;;
2515;;; GCC toolchain.
2516;;;
2517
6869b663
CD
2518;; Using the following procedure, a gcc toolchain targeting glibc-2.27 can be
2519;; instantiated like this:
2520;;
2521;; (define-public gcc-glibc-2.27-toolchain
2522;; (make-gcc-toolchain gcc glibc-2.27))
2523
2524(define* (make-gcc-toolchain gcc
2525 #:optional
2526 (libc #f))
2527 "Return a complete toolchain for GCC. If LIBC is specified, target that libc."
2528 (let ((gcc (if libc (make-gcc-libc gcc libc) gcc))
2529 (libc (if libc libc glibc-final)))
2530 (package
2531 (name (string-append (package-name gcc) "-toolchain"))
2532 (version (package-version gcc))
2533 (source #f)
2534 (build-system trivial-build-system)
2535 (arguments
2536 '(#:modules ((guix build union))
2537 #:builder (begin
2538 (use-modules (ice-9 match)
2539 (srfi srfi-26)
2540 (guix build union))
2541
2542 (let ((out (assoc-ref %outputs "out")))
2543
2544 (match %build-inputs
2545 (((names . directories) ...)
2546 (union-build out directories)))
2547
2548 (union-build (assoc-ref %outputs "debug")
2549 (list (assoc-ref %build-inputs
2550 "libc-debug")))
2551 (union-build (assoc-ref %outputs "static")
2552 (list (assoc-ref %build-inputs
2553 "libc-static")))
2554 #t))))
2555
2556 (native-search-paths (package-native-search-paths gcc))
2557 (search-paths (package-search-paths gcc))
2558
2559 (license (package-license gcc))
2560 (synopsis "Complete GCC tool chain for C/C++ development")
2561 (description
2562 "This package provides a complete GCC tool chain for C/C++ development to
2563be installed in user profiles. This includes GCC, as well as libc (headers
2564an d binaries, plus debugging symbols in the @code{debug} output), and Binutils.")
2565 (home-page "https://gcc.gnu.org/")
2566 (outputs '("out" "debug" "static"))
2567
2568 ;; The main raison d'être of this "meta-package" is (1) to conveniently
2569 ;; install everything that we need, and (2) to make sure ld-wrapper comes
2570 ;; before Binutils' ld in the user's profile.
2571 (inputs `(("gcc" ,gcc)
2572 ("ld-wrapper" ,(car (assoc-ref %final-inputs "ld-wrapper")))
2573 ("binutils" ,binutils-final)
2574 ("libc" ,libc)
2575 ("libc-debug" ,libc "debug")
2576 ("libc-static" ,libc "static"))))))
bdb36958 2577
01e8263f
MB
2578(define-public gcc-toolchain
2579 (make-gcc-toolchain gcc-final))
2580
bdb36958 2581(define-public gcc-toolchain-4.8
b887ede1 2582 (make-gcc-toolchain gcc-4.8))
bdb36958
LC
2583
2584(define-public gcc-toolchain-4.9
b887ede1
LC
2585 (make-gcc-toolchain gcc-4.9))
2586
629f4d2e 2587(define-public gcc-toolchain-5
01e8263f 2588 (make-gcc-toolchain gcc-5))
60e2d5fe 2589
e760ec41 2590(define-public gcc-toolchain-6
b887ede1 2591 (make-gcc-toolchain gcc-6))
e760ec41 2592
d7ecab74 2593(define-public gcc-toolchain-7
01e8263f 2594 gcc-toolchain)
d7ecab74 2595
5ae27f57
LC
2596(define-public gcc-toolchain-8
2597 (make-gcc-toolchain gcc-8))
2598
bdfc3276
CD
2599(define-public gcc-toolchain-9
2600 (make-gcc-toolchain gcc-9))
2601
bdb36958 2602;;; commencement.scm ends here