gnu: WebKitGTK: Remove obsolete patch.
[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)
cdba9148
MB
1411 ((#:configure-flags flags ''())
1412 ;; The generated config.status has some problems due to the
1413 ;; bootstrap environment. Disable dependency tracking to work
1414 ;; around it.
1415 `(cons "--disable-dependency-tracking" ,flags))
9a45a24f
LC
1416 ((#:phases phases)
1417 `(modify-phases ,phases
1418 (replace 'build
1419 (lambda _
1420 (invoke "./build.sh")))
1421 (replace 'install
1422 (lambda* (#:key outputs #:allow-other-keys)
1423 (let* ((out (assoc-ref outputs "out"))
1424 (bin (string-append out "/bin")))
1425 (install-file "make" bin)
1426 #t))))))))
1427 (native-inputs '()) ; no need for 'pkg-config'
1428 (inputs (%bootstrap-inputs+toolchain))))
bdb36958
LC
1429
1430(define diffutils-boot0
99b73d0f
LC
1431 (package
1432 (inherit diffutils)
1433 (name "diffutils-boot0")
1434 (native-inputs `())
1435 (inputs
1436 `(("make" ,gnu-make-boot0)
1437 ,@(%bootstrap-inputs+toolchain)))
1438 (arguments
1439 `(#:tests? #f ; the test suite needs diffutils
1440 #:guile ,%bootstrap-guile
1441 #:implicit-inputs? #f
1442 ,@(package-arguments diffutils)))))
bdb36958
LC
1443
1444(define findutils-boot0
99b73d0f
LC
1445 (package
1446 (inherit findutils)
1447 (name "findutils-boot0")
1448 (source (bootstrap-origin (package-source findutils)))
1449 (inputs
1450 `(("make" ,gnu-make-boot0)
1451 ("diffutils" ,diffutils-boot0) ; for tests
1452 ,@(%bootstrap-inputs+toolchain)))
1453 (arguments
1454 `(#:implicit-inputs? #f
1455 #:guile ,%bootstrap-guile
717867a6
MB
1456
1457 ;; The build system assumes we have done a mistake when time_t is 32-bit
1458 ;; on a 64-bit system. Ignore that for our bootstrap toolchain.
1459 ,@(if (target-64bit?)
1460 (substitute-keyword-arguments (package-arguments findutils)
1461 ((#:configure-flags flags ''())
1462 `(cons "TIME_T_32_BIT_OK=yes"
1463 ,flags)))
1464 (package-arguments findutils))))))
bdb36958 1465
c00a9fbf 1466(define file-boot0
99b73d0f
LC
1467 (package
1468 (inherit file)
1469 (source (bootstrap-origin (package-source file)))
1470 (name "file-boot0")
1471 (inputs
1472 `(("make" ,gnu-make-boot0)
1473 ,@(%bootstrap-inputs+toolchain)))
1474 (arguments
1475 `(#:implicit-inputs? #f
1476 #:guile ,%bootstrap-guile
1477 #:strip-binaries? #f
1478 #:validate-runpath? #f))))
c00a9fbf 1479
a2b2070b 1480(define (%boot0-inputs)
bdb36958
LC
1481 `(("make" ,gnu-make-boot0)
1482 ("diffutils" ,diffutils-boot0)
1483 ("findutils" ,findutils-boot0)
c00a9fbf 1484 ("file" ,file-boot0)
c3629044 1485 ,@(%bootstrap-inputs+toolchain)))
bdb36958 1486
bdb36958
LC
1487(define* (boot-triplet #:optional (system (%current-system)))
1488 ;; Return the triplet used to create the cross toolchain needed in the
1489 ;; first bootstrapping stage.
1490 (nix-system->gnu-triplet system "guix"))
1491
1492;; Following Linux From Scratch, build a cross-toolchain in stage 0. That
1493;; toolchain actually targets the same OS and arch, but it has the advantage
c3629044
JN
1494;; of being independent of the libc and tools in
1495;; (%BOOTSTRAP-INPUTS+TOOLCHAIN), since GCC-BOOT0 (below) is built without any
1496;; reference to the target libc.
bdb36958
LC
1497
1498(define binutils-boot0
99b73d0f
LC
1499 (package
1500 (inherit binutils)
1501 (source (bootstrap-origin (package-source binutils)))
1502 (name "binutils-cross-boot0")
1503 (arguments
1504 `(#:guile ,%bootstrap-guile
1505 #:implicit-inputs? #f
1506
1507 #:modules ((guix build gnu-build-system)
1508 (guix build utils)
1509 (ice-9 ftw)) ; for 'scandir'
1510 #:phases (modify-phases %standard-phases
1511 (add-after 'install 'add-symlinks
1512 (lambda* (#:key outputs #:allow-other-keys)
1513 ;; The cross-gcc invokes 'as', 'ld', etc, without the
1514 ;; triplet prefix, so add symlinks.
1515 (let ((out (assoc-ref outputs "out"))
1516 (triplet-prefix (string-append ,(boot-triplet) "-")))
1517 (define (has-triplet-prefix? name)
1518 (string-prefix? triplet-prefix name))
1519 (define (remove-triplet-prefix name)
1520 (substring name (string-length triplet-prefix)))
1521 (with-directory-excursion (string-append out "/bin")
1522 (for-each (lambda (name)
1523 (symlink name (remove-triplet-prefix name)))
1524 (scandir "." has-triplet-prefix?)))
1525 #t))))
1526
1527 ,@(substitute-keyword-arguments (package-arguments binutils)
1528 ((#:configure-flags cf)
1529 `(cons ,(string-append "--target=" (boot-triplet))
1530 ,cf)))))
1531 (inputs (%boot0-inputs))))
bdb36958 1532
b810a850
LC
1533(define libstdc++-boot0
1534 ;; GCC's libcc1 is always built as a shared library (the top-level
1535 ;; 'Makefile.def' forcefully adds --enable-shared) and thus needs to refer
1536 ;; to libstdc++.so. We cannot build libstdc++-5.3 because it relies on
809b0a90 1537 ;; C++14 features missing in some of our bootstrap compilers.
99b73d0f 1538 (let ((lib (make-libstdc++ gcc-4.9)))
b810a850
LC
1539 (package
1540 (inherit lib)
99b73d0f 1541 (source (bootstrap-origin (package-source lib)))
b810a850
LC
1542 (name "libstdc++-boot0")
1543 (arguments
1544 `(#:guile ,%bootstrap-guile
1545 #:implicit-inputs? #f
1546
1547 ;; XXX: libstdc++.so NEEDs ld.so for some reason.
1548 #:validate-runpath? #f
1549
d536c39e 1550 ,@(match (%current-system)
eb443459 1551 ((or "i686-linux" "x86_64-linux")
d536c39e
JN
1552 (substitute-keyword-arguments (package-arguments lib)
1553 ((#:phases phases)
1554 `(modify-phases ,phases
a6facf94
MB
1555 (add-after 'unpack 'workaround-wrapper-bug
1556 ;; XXX: The crude gcc-cross-wrapper causes "g++ -v" to
1557 ;; fail, which in turn confuses the configure script.
1558 (lambda _
1559 (substitute* "libstdc++-v3/configure"
1560 (("g\\+\\+ -v") "true"))
1561 #t))))))
d536c39e 1562 (_ (package-arguments lib)))))
a2b2070b 1563 (inputs (%boot0-inputs))
b810a850
LC
1564 (native-inputs '()))))
1565
bdb36958 1566(define gcc-boot0
99b73d0f
LC
1567 (package
1568 (inherit gcc)
1569 (name "gcc-cross-boot0")
1570 (source (bootstrap-origin (package-source gcc)))
1571 (arguments
1572 `(#:guile ,%bootstrap-guile
1573 #:implicit-inputs? #f
1574 #:modules ((guix build gnu-build-system)
1575 (guix build utils)
1576 (ice-9 regex)
1577 (srfi srfi-1)
1578 (srfi srfi-26))
1579 ,@(substitute-keyword-arguments (package-arguments gcc)
1580 ((#:configure-flags flags)
1581 `(append (list ,(string-append "--target=" (boot-triplet))
1582
1583 ;; No libc yet.
1584 "--without-headers"
1585
1586 ;; Disable features not needed at this stage.
1587 "--disable-shared"
1588 "--enable-languages=c,c++"
1589
1590 ;; libstdc++ cannot be built at this stage
1591 ;; ("Link tests are not allowed after
1592 ;; GCC_NO_EXECUTABLES.").
1593 "--disable-libstdc++-v3"
1594
1595 "--disable-threads"
1596 "--disable-libmudflap"
1597 "--disable-libatomic"
1598 "--disable-libsanitizer"
1599 "--disable-libitm"
1600 "--disable-libgomp"
1601 "--disable-libmpx"
1602 "--disable-libcilkrts"
1603 "--disable-libvtv"
1604 "--disable-libssp"
1605 "--disable-libquadmath"
1606 "--disable-decimal-float")
1607 (remove (cut string-match
1608 "--(with-system-zlib|enable-languages.*)" <>)
1609 ,flags)))
1610 ((#:make-flags flags)
1611 `(let* ((libc (assoc-ref %build-inputs "libc"))
1612 (libc-native (or (assoc-ref %build-inputs "libc-native")
1613 libc)))
1614 `(,(string-append "LDFLAGS="
1615 "-Wl,-rpath=" libc-native "/lib "
1616 "-Wl,-dynamic-linker "
1617 "-Wl," libc-native ,(glibc-dynamic-linker
1618 (match (%current-system)
1619 ("x86_64-linux" "i686-linux")
1620 (_ (%current-system))))))))
1621 ((#:phases phases)
1622 `(modify-phases ,phases
1623 (add-after 'unpack 'unpack-gmp&co
1624 (lambda* (#:key inputs #:allow-other-keys)
1625 (let ((gmp (assoc-ref %build-inputs "gmp-source"))
1626 (mpfr (assoc-ref %build-inputs "mpfr-source"))
1627 (mpc (assoc-ref %build-inputs "mpc-source")))
1628
1629 ;; To reduce the set of pre-built bootstrap inputs, build
1630 ;; GMP & co. from GCC.
1631 (for-each (lambda (source)
1632 (invoke "tar" "xvf" source))
1633 (list gmp mpfr mpc))
1634
1635 ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
1636 ,@(map (lambda (lib)
1637 ;; Drop trailing letters, as gmp-6.0.0a unpacks
1638 ;; into gmp-6.0.0.
1639 `(symlink ,(string-trim-right
1640 (package-full-name lib "-")
1641 char-set:letter)
1642 ,(package-name lib)))
1643 (list gmp-6.0 mpfr mpc))
1644 #t)))
1645 ,(match (%current-system)
1646 ((or "i686-linux" "x86_64-linux")
1647 '(add-before 'configure 'fix-libcc1
77e02d94
MB
1648 (lambda* (#:key inputs #:allow-other-keys)
1649 ;; libcc1.so NEEDs libgcc_s.so, so provide one here
1650 ;; to placate the 'validate-runpath' phase.
1651 (substitute* "libcc1/Makefile.in"
1652 (("la_LDFLAGS =")
1653 (string-append "la_LDFLAGS = -Wl,-rpath="
1654 (assoc-ref inputs "gcc") "/lib")))
1655 ;; XXX: "g++ -v" is broken (see also libstdc++ above).
1656 (substitute* "libcc1/configure"
1657 (("g\\+\\+ -v") "true"))
1658 #t)))
99b73d0f
LC
1659 (_ '(add-before 'configure 'return-true
1660 (lambda _ #t))))
1661 (add-after 'install 'symlink-libgcc_eh
1662 (lambda* (#:key outputs #:allow-other-keys)
1663 (let ((out (assoc-ref outputs "lib")))
1664 ;; Glibc wants to link against libgcc_eh, so provide
1665 ;; it.
1666 (with-directory-excursion
1667 (string-append out "/lib/gcc/"
1668 ,(boot-triplet)
1669 "/" ,(package-version gcc))
1670 (symlink "libgcc.a" "libgcc_eh.a"))
1671 #t))))))))
bdb36958 1672
99b73d0f
LC
1673 (inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp-6.0)))
1674 ("mpfr-source" ,(bootstrap-origin (package-source mpfr)))
1675 ("mpc-source" ,(bootstrap-origin (package-source mpc)))
1676 ("binutils-cross" ,binutils-boot0)
bdb36958 1677
99b73d0f
LC
1678 ;; The libstdc++ that libcc1 links against.
1679 ("libstdc++" ,libstdc++-boot0)
b810a850 1680
99b73d0f
LC
1681 ;; Call it differently so that the builder can check whether
1682 ;; the "libc" input is #f.
1683 ("libc-native" ,@(assoc-ref (%boot0-inputs) "libc"))
1684 ,@(alist-delete "libc" (%boot0-inputs))))
9dee9e8f 1685
99b73d0f
LC
1686 ;; No need for the native-inputs to build the documentation at this stage.
1687 (native-inputs `())))
bdb36958
LC
1688
1689(define perl-boot0
99b73d0f
LC
1690 (package
1691 (inherit perl)
1692 (name "perl-boot0")
1693 (source (bootstrap-origin (package-source perl)))
1694 (inputs (%boot0-inputs))
1695 (arguments
1696 `(#:implicit-inputs? #f
1697 #:guile ,%bootstrap-guile
1698 #:validate-runpath? #f
1699
1700 ;; At the very least, this must not depend on GCC & co.
1701 #:disallowed-references ,(list %bootstrap-binutils)
1702
1703 ,@(substitute-keyword-arguments (package-arguments perl)
1704 ((#:phases phases)
1705 `(modify-phases ,phases
1706 ;; Pthread support is missing in the bootstrap compiler
1707 ;; (broken spec file), so disable it.
1708 (add-before 'configure 'disable-pthreads
1709 (lambda _
1710 (substitute* "Configure"
1711 (("^libswanted=(.*)pthread" _ before)
1712 (string-append "libswanted=" before)))
1713 #t))))
1714 ;; Do not configure with '-Dusethreads' since pthread
1715 ;; support is missing.
1716 ((#:configure-flags configure-flags)
1717 `(delete "-Dusethreads" ,configure-flags)))))))
bdb36958 1718
32f4a073 1719(define m4-boot0
99b73d0f
LC
1720 (package
1721 (inherit m4)
1722 (name "m4-boot0")
1723 (source (bootstrap-origin (package-source m4)))
1724 (inputs (%boot0-inputs))
1725 (arguments
1726 `(#:guile ,%bootstrap-guile
1727 #:implicit-inputs? #f
1728 ,@(package-arguments m4)))))
1729
d75acc29
MR
1730(define bison-boot0
1731 ;; This Bison is needed to build MiG so we need it early in the process.
12908554 1732 ;; Recent versions of Linux-Libre headers also depend on this.
99b73d0f
LC
1733 (package
1734 (inherit bison)
e5c1f5cf 1735 (name "bison-boot0")
57bc2dcf 1736 (propagated-inputs `(("m4" ,m4-boot0)))
99b73d0f
LC
1737 (native-inputs `(("perl" ,perl-boot0)))
1738 (inputs (%boot0-inputs)) ;remove Flex...
1739 (arguments
1740 `(#:tests? #f ;... and thus disable tests
1741 #:implicit-inputs? #f
1742 #:guile ,%bootstrap-guile
1743
99b73d0f
LC
1744 ;; Zero timestamps in liby.a; this must be done
1745 ;; explicitly here because the bootstrap Binutils don't
1746 ;; do that (default is "cru".)
1747 #:make-flags `("ARFLAGS=crD"
1748 ,,(match (%current-system)
1749 ;; ranlib: '-D': No such file
1750 ((or "i686-linux" "x86_64-linux")
1751 "RANLIB=ranlib")
1752 (_
1753 "RANLIB=ranlib -D"))
62548232
LC
1754 "V=1")
1755
1756 ,@(package-arguments bison)))))
d75acc29
MR
1757
1758(define flex-boot0
12908554 1759 ;; This Flex is needed to build MiG as well as Linux-Libre headers.
99b73d0f
LC
1760 (package
1761 (inherit flex)
1762 (native-inputs `(("bison" ,bison-boot0)))
57bc2dcf 1763 (propagated-inputs `(("m4" ,m4-boot0)))
99b73d0f
LC
1764 (inputs (%boot0-inputs))
1765 (arguments
1766 `(#:implicit-inputs? #f
1767 #:guile ,%bootstrap-guile
1768 #:tests? #f))))
d75acc29 1769
8102cf0b
LC
1770(define linux-libre-headers-boot0
1771 (mlambda ()
1772 "Return Linux-Libre header files for the bootstrap environment."
1773 ;; Note: this is wrapped in a thunk to nicely handle circular dependencies
1774 ;; between (gnu packages linux) and this module. Additionally, memoize
1775 ;; the result to play well with further memoization and code that relies
1776 ;; on pointer identity; see <https://bugs.gnu.org/30155>.
99b73d0f
LC
1777 (package
1778 (inherit linux-libre-headers)
1779 (arguments
1780 `(#:guile ,%bootstrap-guile
1781 #:implicit-inputs? #f
1782 ,@(package-arguments linux-libre-headers)))
1783 (native-inputs
1784 `(("perl" ,perl-boot0)
1785
1786 ;; Flex and Bison are required since version 4.16.
1787 ("flex" ,flex-boot0)
1788 ("bison" ,bison-boot0)
1789 ,@(%boot0-inputs))))))
bdb36958 1790
efa8fdda
LC
1791(define with-boot0
1792 (package-with-explicit-inputs %boot0-inputs
1793 %bootstrap-guile))
1794
d75acc29 1795(define gnumach-headers-boot0
efa8fdda 1796 (with-boot0 (package-with-bootstrap-guile gnumach-headers)))
d75acc29
MR
1797
1798(define mig-boot0
efa8fdda
LC
1799 (let* ((mig (package
1800 (inherit (package-with-bootstrap-guile mig))
d75acc29
MR
1801 (native-inputs `(("bison" ,bison-boot0)
1802 ("flex" ,flex-boot0)))
1803 (inputs `(("flex" ,flex-boot0)))
1804 (arguments
1805 `(#:configure-flags
1806 `(,(string-append "LDFLAGS=-Wl,-rpath="
1807 (assoc-ref %build-inputs "flex") "/lib/")))))))
efa8fdda 1808 (with-boot0 mig)))
d75acc29
MR
1809
1810(define hurd-headers-boot0
1811 (let ((hurd-headers (package (inherit hurd-headers)
1812 (native-inputs `(("mig" ,mig-boot0)))
1813 (inputs '()))))
efa8fdda 1814 (with-boot0 (package-with-bootstrap-guile hurd-headers))))
d75acc29
MR
1815
1816(define hurd-minimal-boot0
1817 (let ((hurd-minimal (package (inherit hurd-minimal)
1818 (native-inputs `(("mig" ,mig-boot0)))
1819 (inputs '()))))
efa8fdda 1820 (with-boot0 (package-with-bootstrap-guile hurd-minimal))))
d75acc29 1821
8102cf0b
LC
1822(define hurd-core-headers-boot0
1823 (mlambda ()
1824 "Return the Hurd and Mach headers as well as initial Hurd libraries for
d75acc29 1825the bootstrap environment."
efa8fdda
LC
1826 (package (inherit (package-with-bootstrap-guile hurd-core-headers))
1827 (arguments `(#:guile ,%bootstrap-guile
1828 ,@(package-arguments hurd-core-headers)))
1829 (inputs
1830 `(("gnumach-headers" ,gnumach-headers-boot0)
1831 ("hurd-headers" ,hurd-headers-boot0)
1832 ("hurd-minimal" ,hurd-minimal-boot0)
1833 ,@(%boot0-inputs))))))
d75acc29
MR
1834
1835(define* (kernel-headers-boot0 #:optional (system (%current-system)))
1836 (match system
1837 ("i586-gnu" (hurd-core-headers-boot0))
1838 (_ (linux-libre-headers-boot0))))
1839
bdb36958
LC
1840(define texinfo-boot0
1841 ;; Texinfo used to build libc's manual.
1842 ;; We build without ncurses because it fails to build at this stage, and
1843 ;; because we don't need the stand-alone Info reader.
a2b2070b 1844 ;; Also, use (%BOOT0-INPUTS) to avoid building Perl once more.
99b73d0f
LC
1845 (package
1846 (inherit texinfo)
1847 (native-inputs '())
1848 (inputs `(,@(%boot0-inputs)
1849 ("perl" ,perl-boot0)))
1850 (arguments
1851 `(#:implicit-inputs? #f
1852 #:guile ,%bootstrap-guile
1853
1854 ;; Some of Texinfo 6.1's tests would fail with "Couldn't set UTF-8
1855 ;; character type in locale" but we don't have a UTF-8 locale at this
1856 ;; stage, so skip them.
1857 #:tests? #f))))
bdb36958 1858
5f3f7039
MB
1859(define expat-sans-tests
1860 (package
1861 (inherit expat)
99b73d0f 1862 (inputs (%boot0-inputs))
5f3f7039
MB
1863 (arguments
1864 ;; XXX: Linking 'runtestscpp' fails with things like:
1865 ;;
1866 ;; ld: Dwarf Error: found dwarf version '3789', this reader only handles version 2 and 3 information.
1867 ;;
1868 ;; Skip tests altogether.
99b73d0f
LC
1869 `(#:implicit-inputs? #f
1870 #:guile ,%bootstrap-guile
1871
1872 ,@(substitute-keyword-arguments (package-arguments expat)
1873 ((#:configure-flags flags ''())
1874 ;; Since we're not passing the right -Wl,-rpath flags, build the
1875 ;; static library to avoid RUNPATH validation failure.
1876 `(cons "--disable-shared" ,flags))
1877 ((#:tests? _ #f) #f))))))
5f3f7039
MB
1878
1879(define python-boot0
99b73d0f
LC
1880 (package
1881 (inherit python-minimal)
1882 ;; We cannot use Python 3.7 and later here, because they require
1883 ;; pthreads, which is missing on non-x86 platforms at this stage.
1884 ;; Python 3.6 technically supports being built without threading
1885 ;; support, but requires additional patches.
73fec9ca 1886 (version "3.5.9")
99b73d0f
LC
1887 (source (bootstrap-origin
1888 (origin
404efac4 1889 (method url-fetch)
99b73d0f
LC
1890 (uri (string-append "https://www.python.org/ftp/python/"
1891 version "/Python-" version ".tar.xz"))
99b73d0f
LC
1892 (sha256
1893 (base32
73fec9ca 1894 "0jdh9pvx6m6lfz2liwvvhn7vks7qrysqgwn517fkpxb77b33fjn2"))
404efac4
MB
1895 (modules '((guix build utils)))
1896 (snippet
1897 '(begin
1898 ;; Delete the bundled copy of libexpat.
1899 (delete-file-recursively "Modules/expat")
1900 (substitute* "Modules/Setup.dist"
1901 ;; Link Expat instead of embedding the bundled one.
1902 (("^#pyexpat.*") "pyexpat pyexpat.c -lexpat\n"))
1903 #t)))))
99b73d0f
LC
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 2399 (let ((pkg-config (package
537b2dab 2400 (inherit %pkg-config) ;the native pkg-config
8f417ed2
LC
2401 (inputs `(("guile" ,guile-final)
2402 ,@(%boot5-inputs)))
2403 (arguments
2404 `(#:implicit-inputs? #f
2405 ,@(package-arguments pkg-config))))))
2406 (package
2407 (inherit (package-with-bootstrap-guile gnu-make))
2408 (inputs `(("guile" ,guile-final)
2409 ,@(%boot5-inputs)))
2410 (native-inputs `(("pkg-config" ,pkg-config)))
2411 (arguments
2412 `(#:implicit-inputs? #f
2413 ,@(package-arguments gnu-make))))))
2414
bdb36958 2415
bdb36958
LC
2416(define coreutils-final
2417 ;; The final Coreutils. Treat them specially because some packages, such as
2418 ;; Findutils, keep a reference to the Coreutils they were built with.
8f417ed2
LC
2419 (with-boot5 (package-with-bootstrap-guile coreutils)
2420 ;; Use the final Guile, linked against the
2421 ;; final libc with working iconv, so that
2422 ;; 'substitute*' works well when touching
2423 ;; test files in Gettext.
2424 ))
bdb36958
LC
2425
2426(define grep-final
2427 ;; The final grep. Gzip holds a reference to it (via zgrep), so it must be
2428 ;; built before gzip.
8f417ed2 2429 (let ((grep (with-boot5 (package-with-bootstrap-guile grep))))
78ca500a
LC
2430 (package/inherit grep
2431 (inputs (alist-delete "pcre" (package-inputs grep)))
2432 (native-inputs `(("perl" ,perl-boot0))))))
bdb36958 2433
a2b2070b 2434(define (%boot6-inputs)
bdb36958
LC
2435 ;; Now use the final Coreutils.
2436 `(("coreutils" ,coreutils-final)
2437 ("grep" ,grep-final)
a2b2070b 2438 ,@(%boot5-inputs)))
b0fd2bd3 2439
8f417ed2
LC
2440(define with-boot6
2441 (package-with-explicit-inputs %boot6-inputs))
2442
301a4249
LC
2443(define sed-final
2444 ;; The final sed.
8f417ed2 2445 (let ((sed (with-boot6 (package-with-bootstrap-guile sed))))
301a4249
LC
2446 (package/inherit sed (native-inputs `(("perl" ,perl-boot0))))))
2447
bdb36958
LC
2448(define-public %final-inputs
2449 ;; Final derivations used as implicit inputs by 'gnu-build-system'. We
2450 ;; still use 'package-with-bootstrap-guile' so that the bootstrap tools are
2451 ;; used for origins that have patches, thereby avoiding circular
2452 ;; dependencies.
8f417ed2 2453 (let ((finalize (compose with-boot6
099dbc4f 2454 package-with-bootstrap-guile)))
bdb36958 2455 `(,@(map (match-lambda
099dbc4f
LC
2456 ((name package)
2457 (list name (finalize package))))
bdb36958 2458 `(("tar" ,tar)
87c8b92f 2459 ("gzip" ,gzip)
bdb36958
LC
2460 ("bzip2" ,bzip2)
2461 ("xz" ,xz)
c00a9fbf 2462 ("file" ,file)
bdb36958
LC
2463 ("diffutils" ,diffutils)
2464 ("patch" ,patch)
bdb36958
LC
2465 ("findutils" ,findutils)
2466 ("gawk" ,gawk)))
301a4249 2467 ("sed" ,sed-final)
bdb36958
LC
2468 ("grep" ,grep-final)
2469 ("coreutils" ,coreutils-final)
2470 ("make" ,gnu-make-final)
2471 ("bash" ,bash-final)
2472 ("ld-wrapper" ,ld-wrapper)
2473 ("binutils" ,binutils-final)
2474 ("gcc" ,gcc-final)
b0fd2bd3 2475 ("libc" ,glibc-final)
6dff905e 2476 ("libc:static" ,glibc-final "static")
b0fd2bd3 2477 ("locales" ,glibc-utf8-locales-final))))
bdb36958
LC
2478
2479(define-public canonical-package
2480 (let ((name->package (fold (lambda (input result)
2481 (match input
6dff905e 2482 ((_ package . outputs)
bdb36958
LC
2483 (vhash-cons (package-full-name package)
2484 package result))))
2485 vlist-null
2486 `(("guile" ,guile-final)
2487 ,@%final-inputs))))
2488 (lambda (package)
2489 "Return the 'canonical' variant of PACKAGE---i.e., if PACKAGE is one of
2490the implicit inputs of 'gnu-build-system', return that one, otherwise return
2491PACKAGE.
2492
34d624ce 2493The goal is to avoid duplication in cases like GUILE-FINAL vs. GUILE-2.2,
bdb36958
LC
2494COREUTILS-FINAL vs. COREUTILS, etc."
2495 ;; XXX: This doesn't handle dependencies of the final inputs, such as
2496 ;; libunistring, GMP, etc.
2497 (match (vhash-assoc (package-full-name package) name->package)
2498 ((_ . canon)
2499 ;; In general we want CANON, except if we're cross-compiling: CANON
2500 ;; uses explicit inputs, so it is "anchored" in the bootstrapped
2501 ;; process, with dependencies on things that cannot be
2502 ;; cross-compiled.
2503 (if (%current-target-system)
2504 package
2505 canon))
2506 (_ package)))))
2507
2508\f
2509;;;
2510;;; GCC toolchain.
2511;;;
2512
6869b663
CD
2513;; Using the following procedure, a gcc toolchain targeting glibc-2.27 can be
2514;; instantiated like this:
2515;;
2516;; (define-public gcc-glibc-2.27-toolchain
2517;; (make-gcc-toolchain gcc glibc-2.27))
2518
2519(define* (make-gcc-toolchain gcc
2520 #:optional
2521 (libc #f))
2522 "Return a complete toolchain for GCC. If LIBC is specified, target that libc."
2523 (let ((gcc (if libc (make-gcc-libc gcc libc) gcc))
2524 (libc (if libc libc glibc-final)))
2525 (package
2526 (name (string-append (package-name gcc) "-toolchain"))
2527 (version (package-version gcc))
2528 (source #f)
2529 (build-system trivial-build-system)
2530 (arguments
2531 '(#:modules ((guix build union))
2532 #:builder (begin
2533 (use-modules (ice-9 match)
2534 (srfi srfi-26)
2535 (guix build union))
2536
2537 (let ((out (assoc-ref %outputs "out")))
2538
2539 (match %build-inputs
2540 (((names . directories) ...)
2541 (union-build out directories)))
2542
2543 (union-build (assoc-ref %outputs "debug")
2544 (list (assoc-ref %build-inputs
2545 "libc-debug")))
2546 (union-build (assoc-ref %outputs "static")
2547 (list (assoc-ref %build-inputs
2548 "libc-static")))
2549 #t))))
2550
2551 (native-search-paths (package-native-search-paths gcc))
2552 (search-paths (package-search-paths gcc))
2553
2554 (license (package-license gcc))
2555 (synopsis "Complete GCC tool chain for C/C++ development")
2556 (description
2557 "This package provides a complete GCC tool chain for C/C++ development to
34e8f0af
JB
2558be installed in user profiles. This includes GCC, as well as libc (headers and
2559binaries, plus debugging symbols in the @code{debug} output), and Binutils.")
6869b663
CD
2560 (home-page "https://gcc.gnu.org/")
2561 (outputs '("out" "debug" "static"))
2562
2563 ;; The main raison d'être of this "meta-package" is (1) to conveniently
2564 ;; install everything that we need, and (2) to make sure ld-wrapper comes
2565 ;; before Binutils' ld in the user's profile.
2566 (inputs `(("gcc" ,gcc)
2567 ("ld-wrapper" ,(car (assoc-ref %final-inputs "ld-wrapper")))
2568 ("binutils" ,binutils-final)
2569 ("libc" ,libc)
2570 ("libc-debug" ,libc "debug")
2571 ("libc-static" ,libc "static"))))))
bdb36958 2572
01e8263f
MB
2573(define-public gcc-toolchain
2574 (make-gcc-toolchain gcc-final))
2575
bdb36958 2576(define-public gcc-toolchain-4.8
b887ede1 2577 (make-gcc-toolchain gcc-4.8))
bdb36958
LC
2578
2579(define-public gcc-toolchain-4.9
b887ede1
LC
2580 (make-gcc-toolchain gcc-4.9))
2581
629f4d2e 2582(define-public gcc-toolchain-5
01e8263f 2583 (make-gcc-toolchain gcc-5))
60e2d5fe 2584
e760ec41 2585(define-public gcc-toolchain-6
b887ede1 2586 (make-gcc-toolchain gcc-6))
e760ec41 2587
d7ecab74 2588(define-public gcc-toolchain-7
01e8263f 2589 gcc-toolchain)
d7ecab74 2590
5ae27f57
LC
2591(define-public gcc-toolchain-8
2592 (make-gcc-toolchain gcc-8))
2593
bdfc3276
CD
2594(define-public gcc-toolchain-9
2595 (make-gcc-toolchain gcc-9))
2596
4ac5d4fe
KH
2597;; Provide the Fortran toolchain package only for the version of gfortran that
2598;; is used by Guix internally to build Fortran libraries, because combining
2599;; code compiled with different versions can cause problems.
2600
2601(define-public gfortran-toolchain
2602 (package (inherit (make-gcc-toolchain gfortran))
2603 (synopsis "Complete GCC tool chain for Fortran development")
2604 (description "This package provides a complete GCC tool chain for
2605Fortran development to be installed in user profiles. This includes
2606gfortran, as well as libc (headers and binaries, plus debugging symbols
2607in the @code{debug} output), and binutils.")))
2608
2609
bdb36958 2610;;; commencement.scm ends here