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