bootstrap: Add Mes bootstrap seeds.
[jackhill/guix/guix.git] / gnu / packages / commencement.scm
CommitLineData
bdb36958 1;;; GNU Guix --- Functional package management for GNU
20bf5fce 2;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 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>
809b0a90 6;;; Copyright © 2017, 2018 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>
bdb36958
LC
9;;;
10;;; This file is part of GNU Guix.
11;;;
12;;; GNU Guix is free software; you can redistribute it and/or modify it
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
17;;; GNU Guix is distributed in the hope that it will be useful, but
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25(define-module (gnu packages commencement)
26 #:use-module ((guix licenses)
27 #:select (gpl3+ lgpl2.0+ public-domain))
b2fd8f63 28 #:use-module (gnu packages)
bdb36958
LC
29 #:use-module (gnu packages bootstrap)
30 #:use-module (gnu packages base)
31 #:use-module (gnu packages bash)
32 #:use-module (gnu packages gcc)
2d5d63d7 33 #:use-module (gnu packages m4)
8efe2a22 34 #:use-module (gnu packages code)
c00a9fbf 35 #:use-module (gnu packages file)
bdb36958 36 #:use-module (gnu packages gawk)
2d5d63d7 37 #:use-module (gnu packages bison)
d75acc29 38 #:use-module (gnu packages flex)
bdb36958 39 #:use-module (gnu packages guile)
6162b95d 40 #:use-module (gnu packages gettext)
bdb36958
LC
41 #:use-module (gnu packages multiprecision)
42 #:use-module (gnu packages compression)
43 #:use-module (gnu packages perl)
44 #:use-module (gnu packages linux)
d75acc29 45 #:use-module (gnu packages hurd)
bdb36958
LC
46 #:use-module (gnu packages texinfo)
47 #:use-module (gnu packages pkg-config)
48 #:use-module (guix packages)
49 #:use-module (guix download)
50 #:use-module (guix build-system gnu)
51 #:use-module (guix build-system trivial)
8102cf0b 52 #:use-module (guix memoization)
bdb36958
LC
53 #:use-module (guix utils)
54 #:use-module (srfi srfi-1)
55 #:use-module (srfi srfi-26)
56 #:use-module (ice-9 vlist)
d75acc29
MR
57 #:use-module (ice-9 match)
58 #:use-module (ice-9 regex))
bdb36958
LC
59
60;;; Commentary:
61;;;
62;;; This is the commencement, this is where things start. Before the
63;;; commencement, of course, there's the 'bootstrap' module, which provides us
64;;; with the initial binaries. This module uses those bootstrap binaries to
65;;; actually build up the whole tool chain that make up the implicit inputs of
66;;; 'gnu-build-system'.
67;;;
68;;; To avoid circular dependencies, this module should not be imported
69;;; directly from anywhere.
70;;;
a1df45e9
CM
71;;; Below, we frequently use "inherit" to create modified packages. The
72;;; reason why we use "inherit" instead of "package/inherit" is because we do
73;;; not want these commencement packages to inherit grafts. By definition,
74;;; these packages are not depended on at run time by any of the packages we
75;;; use. Thus it does not make sense to inherit grafts. Furthermore, those
76;;; grafts would often lead to extra overhead for users who would end up
77;;; downloading those "-boot0" packages just to build package replacements
78;;; that are in fact not going to be used.
79;;;
bdb36958
LC
80;;; Code:
81
c3629044
JN
82(define (%bootstrap-inputs+toolchain)
83 (%bootstrap-inputs))
84
bdb36958
LC
85(define gnu-make-boot0
86 (package-with-bootstrap-guile
87 (package (inherit gnu-make)
88 (name "make-boot0")
bdb36958
LC
89 (arguments
90 `(#:guile ,%bootstrap-guile
91 #:implicit-inputs? #f
92 #:tests? #f ; cannot run "make check"
93 ,@(substitute-keyword-arguments (package-arguments gnu-make)
94 ((#:phases phases)
8e5e8724
LC
95 `(modify-phases ,phases
96 (replace 'build
97 (lambda _
53bfec7b
TGR
98 (invoke "./build.sh")
99 #t))
8e5e8724
LC
100 (replace 'install
101 (lambda* (#:key outputs #:allow-other-keys)
102 (let* ((out (assoc-ref outputs "out"))
103 (bin (string-append out "/bin")))
53bfec7b
TGR
104 (install-file "make" bin)
105 #t))))))))
bdb36958 106 (native-inputs '()) ; no need for 'pkg-config'
c3629044 107 (inputs (%bootstrap-inputs+toolchain)))))
bdb36958
LC
108
109(define diffutils-boot0
110 (package-with-bootstrap-guile
111 (let ((p (package-with-explicit-inputs diffutils
f50b013f
JN
112 (lambda _
113 `(("make" ,gnu-make-boot0)
114 ,@(%bootstrap-inputs+toolchain)))
bdb36958
LC
115 #:guile %bootstrap-guile)))
116 (package (inherit p)
09964b4f 117 (name "diffutils-boot0")
bdb36958
LC
118 (arguments `(#:tests? #f ; the test suite needs diffutils
119 ,@(package-arguments p)))))))
120
121(define findutils-boot0
122 (package-with-bootstrap-guile
09964b4f
LC
123 (package-with-explicit-inputs (package
124 (inherit findutils)
125 (name "findutils-boot0"))
f50b013f
JN
126 (lambda _
127 `(("make" ,gnu-make-boot0)
128 ("diffutils" ,diffutils-boot0) ; for tests
129 ,@(%bootstrap-inputs+toolchain)))
bdb36958
LC
130 (current-source-location)
131 #:guile %bootstrap-guile)))
132
c00a9fbf
MW
133(define file-boot0
134 (package-with-bootstrap-guile
f00b85ff
LC
135 (package-with-explicit-inputs (package
136 (inherit file)
f50b013f
JN
137 (name "file-boot0")
138 (arguments
139 '(#:strip-binaries? #f
140 #:validate-runpath? #f)))
141 (lambda _
142 `(("make" ,gnu-make-boot0)
143 ,@(%bootstrap-inputs+toolchain)))
c00a9fbf
MW
144 (current-source-location)
145 #:guile %bootstrap-guile)))
146
a2b2070b 147(define (%boot0-inputs)
bdb36958
LC
148 `(("make" ,gnu-make-boot0)
149 ("diffutils" ,diffutils-boot0)
150 ("findutils" ,findutils-boot0)
c00a9fbf 151 ("file" ,file-boot0)
c3629044 152 ,@(%bootstrap-inputs+toolchain)))
bdb36958 153
bdb36958
LC
154(define* (boot-triplet #:optional (system (%current-system)))
155 ;; Return the triplet used to create the cross toolchain needed in the
156 ;; first bootstrapping stage.
157 (nix-system->gnu-triplet system "guix"))
158
159;; Following Linux From Scratch, build a cross-toolchain in stage 0. That
160;; toolchain actually targets the same OS and arch, but it has the advantage
c3629044
JN
161;; of being independent of the libc and tools in
162;; (%BOOTSTRAP-INPUTS+TOOLCHAIN), since GCC-BOOT0 (below) is built without any
163;; reference to the target libc.
bdb36958
LC
164
165(define binutils-boot0
166 (package-with-bootstrap-guile
45953b1f 167 (package (inherit binutils)
bdb36958
LC
168 (name "binutils-cross-boot0")
169 (arguments
170 `(#:guile ,%bootstrap-guile
171 #:implicit-inputs? #f
f8badf15
MW
172
173 #:modules ((guix build gnu-build-system)
174 (guix build utils)
175 (ice-9 ftw)) ; for 'scandir'
ac423120
EF
176 #:phases (modify-phases %standard-phases
177 (add-after 'install 'add-symlinks
178 (lambda* (#:key outputs #:allow-other-keys)
179 ;; The cross-gcc invokes 'as', 'ld', etc, without the
180 ;; triplet prefix, so add symlinks.
181 (let ((out (assoc-ref outputs "out"))
182 (triplet-prefix (string-append ,(boot-triplet) "-")))
183 (define (has-triplet-prefix? name)
184 (string-prefix? triplet-prefix name))
185 (define (remove-triplet-prefix name)
186 (substring name (string-length triplet-prefix)))
187 (with-directory-excursion (string-append out "/bin")
188 (for-each (lambda (name)
189 (symlink name (remove-triplet-prefix name)))
190 (scandir "." has-triplet-prefix?)))
191 #t))))
f8badf15 192
bdb36958
LC
193 ,@(substitute-keyword-arguments (package-arguments binutils)
194 ((#:configure-flags cf)
195 `(cons ,(string-append "--target=" (boot-triplet))
196 ,cf)))))
a2b2070b 197 (inputs (%boot0-inputs)))))
bdb36958 198
3469a5ea
MB
199;; Use a "fixed" package source for this early libstdc++ variant so we can
200;; update GCC 4.9 without triggering a full rebuild.
201(define gcc-for-libstdc++
202 (package
203 (inherit gcc-4.9)
204 (source (origin
205 (inherit (package-source gcc-4.9))
206 (patches (search-patches "gcc-4.9-libsanitizer-fix.patch"
207 "gcc-arm-bug-71399.patch"
208 "gcc-asan-missing-include.patch"
209 "gcc-libvtv-runpath.patch"
210 "gcc-fix-texi2pod.patch"))))))
211
b810a850
LC
212(define libstdc++-boot0
213 ;; GCC's libcc1 is always built as a shared library (the top-level
214 ;; 'Makefile.def' forcefully adds --enable-shared) and thus needs to refer
215 ;; to libstdc++.so. We cannot build libstdc++-5.3 because it relies on
809b0a90 216 ;; C++14 features missing in some of our bootstrap compilers.
3469a5ea 217 (let ((lib (package-with-bootstrap-guile (make-libstdc++ gcc-for-libstdc++))))
b810a850
LC
218 (package
219 (inherit lib)
220 (name "libstdc++-boot0")
221 (arguments
222 `(#:guile ,%bootstrap-guile
223 #:implicit-inputs? #f
224
225 ;; XXX: libstdc++.so NEEDs ld.so for some reason.
226 #:validate-runpath? #f
227
228 ,@(package-arguments lib)))
a2b2070b 229 (inputs (%boot0-inputs))
b810a850
LC
230 (native-inputs '()))))
231
bdb36958
LC
232(define gcc-boot0
233 (package-with-bootstrap-guile
c92f1c0a 234 (package (inherit gcc)
bdb36958
LC
235 (name "gcc-cross-boot0")
236 (arguments
237 `(#:guile ,%bootstrap-guile
238 #:implicit-inputs? #f
239 #:modules ((guix build gnu-build-system)
240 (guix build utils)
241 (ice-9 regex)
242 (srfi srfi-1)
243 (srfi srfi-26))
c92f1c0a 244 ,@(substitute-keyword-arguments (package-arguments gcc)
bdb36958
LC
245 ((#:configure-flags flags)
246 `(append (list ,(string-append "--target=" (boot-triplet))
247
248 ;; No libc yet.
249 "--without-headers"
250
251 ;; Disable features not needed at this stage.
252 "--disable-shared"
253 "--enable-languages=c,c++"
254
255 ;; libstdc++ cannot be built at this stage
256 ;; ("Link tests are not allowed after
257 ;; GCC_NO_EXECUTABLES.").
258 "--disable-libstdc++-v3"
259
260 "--disable-threads"
261 "--disable-libmudflap"
262 "--disable-libatomic"
263 "--disable-libsanitizer"
264 "--disable-libitm"
265 "--disable-libgomp"
de4ac325
LC
266 "--disable-libcilkrts"
267 "--disable-libvtv"
bdb36958
LC
268 "--disable-libssp"
269 "--disable-libquadmath"
270 "--disable-decimal-float")
98bd851e
LC
271 (remove (cut string-match
272 "--(with-system-zlib|enable-languages.*)" <>)
bdb36958
LC
273 ,flags)))
274 ((#:phases phases)
53bfec7b
TGR
275 `(modify-phases ,phases
276 (add-after 'unpack 'unpack-gmp&co
277 (lambda* (#:key inputs #:allow-other-keys)
278 (let ((gmp (assoc-ref %build-inputs "gmp-source"))
279 (mpfr (assoc-ref %build-inputs "mpfr-source"))
280 (mpc (assoc-ref %build-inputs "mpc-source")))
281
282 ;; To reduce the set of pre-built bootstrap inputs, build
283 ;; GMP & co. from GCC.
284 (for-each (lambda (source)
285 (invoke "tar" "xvf" source))
286 (list gmp mpfr mpc))
287
288 ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
289 ,@(map (lambda (lib)
290 ;; Drop trailing letters, as gmp-6.0.0a unpacks
291 ;; into gmp-6.0.0.
292 `(symlink ,(string-trim-right
539bf8f2 293 (package-full-name lib "-")
53bfec7b
TGR
294 char-set:letter)
295 ,(package-name lib)))
296 (list gmp-6.0 mpfr mpc))
297 #t)))
298 (add-after 'install 'symlink-libgcc_eh
299 (lambda* (#:key outputs #:allow-other-keys)
300 (let ((out (assoc-ref outputs "lib")))
301 ;; Glibc wants to link against libgcc_eh, so provide
302 ;; it.
303 (with-directory-excursion
304 (string-append out "/lib/gcc/"
305 ,(boot-triplet)
306 "/" ,(package-version gcc))
307 (symlink "libgcc.a" "libgcc_eh.a"))
308 #t))))))))
bdb36958 309
8309c389 310 (inputs `(("gmp-source" ,(package-source gmp-6.0))
bdb36958
LC
311 ("mpfr-source" ,(package-source mpfr))
312 ("mpc-source" ,(package-source mpc))
313 ("binutils-cross" ,binutils-boot0)
314
b810a850
LC
315 ;; The libstdc++ that libcc1 links against.
316 ("libstdc++" ,libstdc++-boot0)
317
bdb36958
LC
318 ;; Call it differently so that the builder can check whether
319 ;; the "libc" input is #f.
a2b2070b
JN
320 ("libc-native" ,@(assoc-ref (%boot0-inputs) "libc"))
321 ,@(alist-delete "libc" (%boot0-inputs))))
9dee9e8f 322
19d27131
MC
323 ;; No need for the native-inputs to build the documentation at this stage.
324 (native-inputs `()))))
bdb36958
LC
325
326(define perl-boot0
4de35074
LC
327 (let ((perl (package
328 (inherit perl)
09964b4f 329 (name "perl-boot0")
4de35074 330 (arguments
81cea47d
LC
331 ;; At the very least, this must not depend on GCC & co.
332 (let ((args `(#:disallowed-references
333 ,(list %bootstrap-binutils))))
334 (substitute-keyword-arguments (package-arguments perl)
335 ((#:phases phases)
336 `(modify-phases ,phases
337 ;; Pthread support is missing in the bootstrap compiler
338 ;; (broken spec file), so disable it.
339 (add-before 'configure 'disable-pthreads
340 (lambda _
341 (substitute* "Configure"
342 (("^libswanted=(.*)pthread" _ before)
75f3aace
MW
343 (string-append "libswanted=" before)))
344 #t))))
156c0810
BW
345 ;; Do not configure with '-Dusethreads' since pthread
346 ;; support is missing.
347 ((#:configure-flags configure-flags)
348 `(delete "-Dusethreads" ,configure-flags))))))))
81cea47d
LC
349 (package-with-bootstrap-guile
350 (package-with-explicit-inputs perl
f50b013f 351 %boot0-inputs
81cea47d
LC
352 (current-source-location)
353 #:guile %bootstrap-guile))))
bdb36958 354
32f4a073
JN
355(define m4-boot0
356 (package-with-bootstrap-guile
357 (package
358 (inherit m4)
359 (name "m4-boot0")
360 (inputs (%boot0-inputs))
361 (arguments
362 `(#:guile ,%bootstrap-guile
363 #:implicit-inputs? #f
364 ,@(package-arguments m4))))))
365
d75acc29
MR
366(define bison-boot0
367 ;; This Bison is needed to build MiG so we need it early in the process.
368 ;; It is also needed to rebuild Bash's parser, which is modified by
369 ;; its CVE patches. Remove it when it's no longer needed.
f50b013f 370 (let* ((bison (package (inherit bison)
d75acc29
MR
371 (propagated-inputs `(("m4" ,m4)))
372 (inputs '()) ;remove Flex...
373 (arguments
374 '(#:tests? #f ;... and thus disable tests
375
376 ;; Zero timestamps in liby.a; this must be done
377 ;; explicitly here because the bootstrap Binutils don't
378 ;; do that (default is "cru".)
f50b013f
JN
379 #:make-flags '("ARFLAGS=crD"
380 "RANLIB=ranlib -D"
d75acc29
MR
381 "V=1"))))))
382 (package
383 (inherit (package-with-bootstrap-guile
f50b013f 384 (package-with-explicit-inputs bison %boot0-inputs
d75acc29
MR
385 (current-source-location)
386 #:guile %bootstrap-guile)))
387 (native-inputs `(("perl" ,perl-boot0))))))
388
389(define flex-boot0
390 ;; This Flex is needed to build MiG.
391 (let* ((flex (package (inherit flex)
392 (native-inputs `(("bison" ,bison-boot0)))
393 (propagated-inputs `(("m4" ,m4)))
394 (inputs `(("indent" ,indent)))
395 (arguments '(#:tests? #f)))))
396 (package-with-bootstrap-guile
f50b013f 397 (package-with-explicit-inputs flex %boot0-inputs
d75acc29
MR
398 (current-source-location)
399 #:guile %bootstrap-guile))))
400
8102cf0b
LC
401(define linux-libre-headers-boot0
402 (mlambda ()
403 "Return Linux-Libre header files for the bootstrap environment."
404 ;; Note: this is wrapped in a thunk to nicely handle circular dependencies
405 ;; between (gnu packages linux) and this module. Additionally, memoize
406 ;; the result to play well with further memoization and code that relies
407 ;; on pointer identity; see <https://bugs.gnu.org/30155>.
408 (package-with-bootstrap-guile
409 (package (inherit linux-libre-headers)
410 (arguments `(#:guile ,%bootstrap-guile
411 #:implicit-inputs? #f
412 ,@(package-arguments linux-libre-headers)))
413 (native-inputs
414 `(("perl" ,perl-boot0)
a2b2070b 415 ,@(%boot0-inputs)))))))
bdb36958 416
d75acc29
MR
417(define gnumach-headers-boot0
418 (package-with-bootstrap-guile
419 (package-with-explicit-inputs gnumach-headers
a2b2070b 420 (%boot0-inputs)
d75acc29
MR
421 (current-source-location)
422 #:guile %bootstrap-guile)))
423
424(define mig-boot0
425 (let* ((mig (package (inherit mig)
426 (native-inputs `(("bison" ,bison-boot0)
427 ("flex" ,flex-boot0)))
428 (inputs `(("flex" ,flex-boot0)))
429 (arguments
430 `(#:configure-flags
431 `(,(string-append "LDFLAGS=-Wl,-rpath="
432 (assoc-ref %build-inputs "flex") "/lib/")))))))
433 (package-with-bootstrap-guile
a2b2070b 434 (package-with-explicit-inputs mig (%boot0-inputs)
d75acc29
MR
435 (current-source-location)
436 #:guile %bootstrap-guile))))
437
438(define hurd-headers-boot0
439 (let ((hurd-headers (package (inherit hurd-headers)
440 (native-inputs `(("mig" ,mig-boot0)))
441 (inputs '()))))
442 (package-with-bootstrap-guile
a2b2070b 443 (package-with-explicit-inputs hurd-headers (%boot0-inputs)
d75acc29
MR
444 (current-source-location)
445 #:guile %bootstrap-guile))))
446
447(define hurd-minimal-boot0
448 (let ((hurd-minimal (package (inherit hurd-minimal)
449 (native-inputs `(("mig" ,mig-boot0)))
450 (inputs '()))))
451 (package-with-bootstrap-guile
a2b2070b 452 (package-with-explicit-inputs hurd-minimal (%boot0-inputs)
d75acc29
MR
453 (current-source-location)
454 #:guile %bootstrap-guile))))
455
8102cf0b
LC
456(define hurd-core-headers-boot0
457 (mlambda ()
458 "Return the Hurd and Mach headers as well as initial Hurd libraries for
d75acc29 459the bootstrap environment."
8102cf0b
LC
460 (package-with-bootstrap-guile
461 (package (inherit hurd-core-headers)
462 (arguments `(#:guile ,%bootstrap-guile
463 ,@(package-arguments hurd-core-headers)))
464 (inputs
465 `(("gnumach-headers" ,gnumach-headers-boot0)
466 ("hurd-headers" ,hurd-headers-boot0)
467 ("hurd-minimal" ,hurd-minimal-boot0)
a2b2070b 468 ,@(%boot0-inputs)))))))
d75acc29
MR
469
470(define* (kernel-headers-boot0 #:optional (system (%current-system)))
471 (match system
472 ("i586-gnu" (hurd-core-headers-boot0))
473 (_ (linux-libre-headers-boot0))))
474
bdb36958
LC
475(define texinfo-boot0
476 ;; Texinfo used to build libc's manual.
477 ;; We build without ncurses because it fails to build at this stage, and
478 ;; because we don't need the stand-alone Info reader.
a2b2070b 479 ;; Also, use (%BOOT0-INPUTS) to avoid building Perl once more.
bdb36958 480 (let ((texinfo (package (inherit texinfo)
47ed8e04 481 (native-inputs '())
5d6c4d37
LC
482 (inputs `(("perl" ,perl-boot0)))
483
484 ;; Some of Texinfo 6.1's tests would fail with "Couldn't
485 ;; set UTF-8 character type in locale" but we don't have a
486 ;; UTF-8 locale at this stage, so skip them.
487 (arguments '(#:tests? #f)))))
bdb36958 488 (package-with-bootstrap-guile
f50b013f 489 (package-with-explicit-inputs texinfo %boot0-inputs
bdb36958
LC
490 (current-source-location)
491 #:guile %bootstrap-guile))))
492
f50b013f 493(define (ld-wrapper-boot0)
d75acc29
MR
494 ;; We need this so binaries on Hurd will have libmachuser and libhurduser
495 ;; in their RUNPATH, otherwise validate-runpath will fail.
168c4000
LC
496 (make-ld-wrapper "ld-wrapper-boot0"
497 #:target boot-triplet
d75acc29
MR
498 #:binutils binutils-boot0
499 #:guile %bootstrap-guile
f50b013f
JN
500 #:bash (car (assoc-ref (%boot0-inputs) "bash"))
501 #:guile-for-build %bootstrap-guile))
d75acc29 502
a2b2070b 503(define (%boot1-inputs)
bdb36958
LC
504 ;; 2nd stage inputs.
505 `(("gcc" ,gcc-boot0)
f50b013f 506 ("ld-wrapper-cross" ,(ld-wrapper-boot0))
bdb36958 507 ("binutils-cross" ,binutils-boot0)
a2b2070b 508 ,@(alist-delete "binutils" (%boot0-inputs))))
bdb36958
LC
509
510(define glibc-final-with-bootstrap-bash
511 ;; The final libc, "cross-built". If everything went well, the resulting
512 ;; store path has no dependencies. Actually, the really-final libc is
513 ;; built just below; the only difference is that this one uses the
514 ;; bootstrap Bash.
515 (package-with-bootstrap-guile
848f550f 516 (package (inherit glibc)
bdb36958
LC
517 (name "glibc-intermediate")
518 (arguments
519 `(#:guile ,%bootstrap-guile
520 #:implicit-inputs? #f
521
522 ,@(substitute-keyword-arguments (package-arguments glibc)
523 ((#:configure-flags flags)
524 `(append (list ,(string-append "--host=" (boot-triplet))
525 ,(string-append "--build="
526 (nix-system->gnu-triplet))
527
528 ;; Build Sun/ONC RPC support. In particular,
529 ;; install rpc/*.h.
530 "--enable-obsolete-rpc")
531 ,flags))
532 ((#:phases phases)
53bfec7b
TGR
533 `(modify-phases ,phases
534 (add-before 'configure 'pre-configure
535 (lambda* (#:key inputs #:allow-other-keys)
536 ;; Don't clobber CPATH with the bootstrap libc.
537 (setenv "NATIVE_CPATH" (getenv "CPATH"))
538 (unsetenv "CPATH")
539
540 ;; Tell 'libpthread' where to find 'libihash' on Hurd systems.
541 ,@(if (hurd-triplet? (%current-system))
542 `((substitute* "libpthread/Makefile"
543 (("LDLIBS-pthread.so =.*")
544 (string-append "LDLIBS-pthread.so = "
545 (assoc-ref %build-inputs "kernel-headers")
546 "/lib/libihash.a\n"))))
547 '())
548
549 ;; 'rpcgen' needs native libc headers to be built.
550 (substitute* "sunrpc/Makefile"
551 (("sunrpc-CPPFLAGS =.*" all)
552 (string-append "CPATH = $(NATIVE_CPATH)\n"
553 "export CPATH\n"
554 all "\n")))
555 #t)))))))
d75acc29 556 (propagated-inputs `(("kernel-headers" ,(kernel-headers-boot0))))
bdb36958 557 (native-inputs
5e8cb5e6
MB
558 `(("bison" ,bison-boot0)
559 ("texinfo" ,texinfo-boot0)
ff647c3d 560 ("perl" ,perl-boot0)))
bdb36958
LC
561 (inputs
562 `(;; The boot inputs. That includes the bootstrap libc. We don't want
563 ;; it in $CPATH, hence the 'pre-configure' phase above.
a2b2070b 564 ,@(%boot1-inputs)
bdb36958 565
d75acc29 566 ;; A native MiG is needed to build Glibc on Hurd.
62596a15 567 ,@(if (hurd-triplet? (%current-system))
d75acc29
MR
568 `(("mig" ,mig-boot0))
569 '())
570
bdb36958 571 ;; A native GCC is needed to build `cross-rpcgen'.
a2b2070b 572 ("native-gcc" ,@(assoc-ref (%boot0-inputs) "gcc"))
bdb36958
LC
573
574 ;; Here, we use the bootstrap Bash, which is not satisfactory
575 ;; because we don't want to depend on bootstrap tools.
a2b2070b 576 ("static-bash" ,@(assoc-ref (%boot0-inputs) "bash")))))))
bdb36958
LC
577
578(define (cross-gcc-wrapper gcc binutils glibc bash)
579 "Return a wrapper for the pseudo-cross toolchain GCC/BINUTILS/GLIBC
580that makes it available under the native tool names."
c92f1c0a 581 (package (inherit gcc)
bdb36958
LC
582 (name (string-append (package-name gcc) "-wrapped"))
583 (source #f)
584 (build-system trivial-build-system)
585 (outputs '("out"))
586 (arguments
587 `(#:guile ,%bootstrap-guile
588 #:modules ((guix build utils))
589 #:builder (begin
590 (use-modules (guix build utils))
591
592 (let* ((binutils (assoc-ref %build-inputs "binutils"))
593 (gcc (assoc-ref %build-inputs "gcc"))
594 (libc (assoc-ref %build-inputs "libc"))
595 (bash (assoc-ref %build-inputs "bash"))
596 (out (assoc-ref %outputs "out"))
597 (bindir (string-append out "/bin"))
598 (triplet ,(boot-triplet)))
599 (define (wrap-program program)
600 ;; GCC-BOOT0 is a libc-less cross-compiler, so it
601 ;; needs to be told where to find the crt files and
602 ;; the dynamic linker.
603 (call-with-output-file program
604 (lambda (p)
605 (format p "#!~a/bin/bash
606exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
607 bash
608 gcc triplet program
609 libc libc
610 ,(glibc-dynamic-linker))))
611
612 (chmod program #o555))
613
614 (mkdir-p bindir)
615 (with-directory-excursion bindir
616 (for-each (lambda (tool)
617 (symlink (string-append binutils "/bin/"
618 triplet "-" tool)
619 tool))
620 '("ar" "ranlib"))
e3cfef22
MW
621 (for-each wrap-program '("gcc" "g++")))
622
623 #t))))
bdb36958
LC
624 (native-inputs
625 `(("binutils" ,binutils)
626 ("gcc" ,gcc)
627 ("libc" ,glibc)
628 ("bash" ,bash)))
629 (inputs '())))
630
631(define static-bash-for-glibc
90d891fc 632 ;; A statically-linked Bash to be used by GLIBC-FINAL in system(3) & co.
517af02e
JN
633 (let ((bash (package
634 (inherit static-bash)
635 (arguments
636 (substitute-keyword-arguments
637 (package-arguments static-bash)
638 ((#:guile _ #f)
639 '%bootstrap-guile)
640 ((#:configure-flags flags '())
641 ;; Add a '-L' flag so that the pseudo-cross-ld of
642 ;; BINUTILS-BOOT0 can find libc.a.
643 `(append ,flags
644 (list (string-append "LDFLAGS=-static -L"
645 (assoc-ref %build-inputs
646 "libc:static")
647 "/lib")))))))))
c573f5a5 648 (package-with-bootstrap-guile
517af02e
JN
649 (package-with-explicit-inputs
650 bash
651 (lambda _
652 (let ((gcc (cross-gcc-wrapper gcc-boot0 binutils-boot0
653 glibc-final-with-bootstrap-bash
654 (car (assoc-ref (%boot1-inputs) "bash")))))
655 `(("gcc" ,gcc)
656 ("libc" ,glibc-final-with-bootstrap-bash)
657 ("libc:static" ,glibc-final-with-bootstrap-bash "static")
658 ,@(fold alist-delete (%boot1-inputs)
659 '("gcc" "libc")))))
660 (current-source-location)
661 #:guile %bootstrap-guile))))
bdb36958 662
6162b95d
LC
663(define gettext-boot0
664 ;; A minimal gettext used during bootstrap.
669b8639 665 (let ((gettext-minimal
b94a6ca0 666 (package (inherit gettext-minimal)
669b8639
LC
667 (name "gettext-boot0")
668 (inputs '()) ;zero dependencies
669 (arguments
670 (substitute-keyword-arguments
671 `(#:tests? #f
b94a6ca0 672 ,@(package-arguments gettext-minimal))
669b8639
LC
673 ((#:phases phases)
674 `(modify-phases ,phases
675 ;; Build only the tools.
676 (add-after 'unpack 'chdir
677 (lambda _
60ff6ec4
MW
678 (chdir "gettext-tools")
679 #t))
669b8639
LC
680
681 ;; Some test programs require pthreads, which we don't have.
682 (add-before 'configure 'no-test-programs
683 (lambda _
684 (substitute* "tests/Makefile.in"
685 (("^PROGRAMS =.*$")
686 "PROGRAMS =\n"))
687 #t))
688
689 ;; Don't try to link against libexpat.
690 (delete 'link-expat)
691 (delete 'patch-tests))))))))
6162b95d
LC
692 (package-with-bootstrap-guile
693 (package-with-explicit-inputs gettext-minimal
f50b013f 694 %boot1-inputs
6162b95d
LC
695 (current-source-location)
696 #:guile %bootstrap-guile))))
697
89223417 698(define glibc-final
bdb36958 699 ;; The final glibc, which embeds the statically-linked Bash built above.
7c788ed2
LC
700 ;; Use 'package/inherit' so we get the 'replacement' of 'glibc', if any.
701 (let ((glibc (package-with-bootstrap-guile glibc)))
702 (package/inherit glibc
703 (name "glibc")
704 (inputs `(("static-bash" ,static-bash-for-glibc)
705 ,@(alist-delete
706 "static-bash"
707 (package-inputs glibc-final-with-bootstrap-bash))))
708
709 ;; This time we need 'msgfmt' to install all the libc.mo files.
710 (native-inputs `(,@(package-native-inputs glibc-final-with-bootstrap-bash)
711 ("gettext" ,gettext-boot0)))
712
713 (propagated-inputs
714 (package-propagated-inputs glibc-final-with-bootstrap-bash))
715
716 ;; The final libc only refers to itself, but the 'debug' output contains
717 ;; references to GCC-BOOT0 and to the Linux headers. XXX: Would be great
718 ;; if 'allowed-references' were per-output.
719 (arguments
720 `(#:allowed-references
721 ,(cons* `(,gcc-boot0 "lib") (kernel-headers-boot0)
722 static-bash-for-glibc
723 (package-outputs glibc-final-with-bootstrap-bash))
bdb36958 724
7c788ed2 725 ,@(package-arguments glibc-final-with-bootstrap-bash))))))
bdb36958 726
f50b013f 727(define (gcc-boot0-wrapped)
bdb36958
LC
728 ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
729 ;; non-cross names.
730 (cross-gcc-wrapper gcc-boot0 binutils-boot0 glibc-final
a2b2070b 731 (car (assoc-ref (%boot1-inputs) "bash"))))
bdb36958 732
a2b2070b 733(define (%boot2-inputs)
bdb36958
LC
734 ;; 3rd stage inputs.
735 `(("libc" ,glibc-final)
6dff905e 736 ("libc:static" ,glibc-final "static")
f50b013f 737 ("gcc" ,(gcc-boot0-wrapped))
a2b2070b 738 ,@(fold alist-delete (%boot1-inputs) '("libc" "gcc"))))
bdb36958
LC
739
740(define binutils-final
741 (package-with-bootstrap-guile
45953b1f 742 (package (inherit binutils)
bdb36958
LC
743 (arguments
744 `(#:guile ,%bootstrap-guile
745 #:implicit-inputs? #f
746 #:allowed-references ("out" ,glibc-final)
747 ,@(package-arguments binutils)))
a2b2070b 748 (inputs (%boot2-inputs)))))
bdb36958
LC
749
750(define libstdc++
751 ;; Intermediate libstdc++ that will allow us to build the final GCC
752 ;; (remember that GCC-BOOT0 cannot build libstdc++.)
86d02fa8
EF
753 (let ((lib (package-with-bootstrap-guile (make-libstdc++ gcc))))
754 (package
755 (inherit lib)
756 (arguments
757 `(#:guile ,%bootstrap-guile
758 #:implicit-inputs? #f
759 #:allowed-references ("out")
760
761 ;; XXX: libstdc++.so NEEDs ld.so for some reason.
762 #:validate-runpath? #f
763
764 ;; All of the package arguments from 'make-libstdc++
765 ;; except for the configure-flags.
766 ,@(package-arguments lib)
767 #:configure-flags `("--disable-shared"
768 "--disable-libstdcxx-threads"
769 "--disable-libstdcxx-pch"
770 ,(string-append "--with-gxx-include-dir="
771 (assoc-ref %outputs "out")
772 "/include"))))
773 (outputs '("out"))
a2b2070b 774 (inputs (%boot2-inputs))
86d02fa8 775 (synopsis "GNU C++ standard library (intermediate)"))))
bdb36958 776
98bd851e
LC
777(define zlib-final
778 ;; Zlib used by GCC-FINAL.
779 (package-with-bootstrap-guile
780 (package
781 (inherit zlib)
782 (arguments
783 `(#:guile ,%bootstrap-guile
784 #:implicit-inputs? #f
785 #:allowed-references ("out" ,glibc-final)
786 ,@(package-arguments zlib)))
a2b2070b 787 (inputs (%boot2-inputs)))))
98bd851e 788
f50b013f 789(define (ld-wrapper-boot3)
98bd851e
LC
790 ;; A linker wrapper that uses the bootstrap Guile.
791 (make-ld-wrapper "ld-wrapper-boot3"
792 #:binutils binutils-final
793 #:guile %bootstrap-guile
f50b013f
JN
794 #:bash (car (assoc-ref (%boot2-inputs) "bash"))
795 #:guile-for-build %bootstrap-guile))
98bd851e 796
89223417 797(define gcc-final
bdb36958
LC
798 ;; The final GCC.
799 (package (inherit gcc-boot0)
800 (name "gcc")
ab999c25
LC
801
802 ;; XXX: Currently #:allowed-references applies to all the outputs but the
803 ;; "debug" output contains disallowed references, notably
804 ;; linux-libre-headers. Disable the debugging output to work around that.
805 (outputs (delete "debug" (package-outputs gcc-boot0)))
806
bdb36958
LC
807 (arguments
808 `(#:guile ,%bootstrap-guile
809 #:implicit-inputs? #f
810
98bd851e 811 #:allowed-references ("out" "lib" ,zlib-final
90d891fc 812 ,glibc-final ,static-bash-for-glibc)
bdb36958 813
d485ebba
LC
814 ;; Things like libasan.so and libstdc++.so NEED ld.so for some
815 ;; reason, but it is not in their RUNPATH. This is a false
816 ;; positive, so turn it off.
817 #:validate-runpath? #f
818
bdb36958
LC
819 ;; Build again GMP & co. within GCC's build process, because it's hard
820 ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
821 ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
822 ,@(substitute-keyword-arguments (package-arguments gcc-boot0)
823 ((#:configure-flags boot-flags)
c92f1c0a 824 (let loop ((args (package-arguments gcc)))
bdb36958
LC
825 (match args
826 ((#:configure-flags normal-flags _ ...)
827 normal-flags)
828 ((_ rest ...)
829 (loop rest)))))
830 ((#:make-flags flags)
52cfd8cb 831 ;; Since $LIBRARY_PATH is not honored, add the relevant flags.
98bd851e
LC
832 `(let ((zlib (assoc-ref %build-inputs "zlib")))
833 (map (lambda (flag)
834 (if (string-prefix? "LDFLAGS=" flag)
835 (string-append flag " -L"
836 (assoc-ref %build-inputs "libstdc++")
837 "/lib -L" zlib "/lib -Wl,-rpath="
838 zlib "/lib")
839 flag))
840 ,flags)))
bdb36958
LC
841 ((#:phases phases)
842 `(alist-delete 'symlink-libgcc_eh ,phases)))))
843
90d891fc
LC
844 ;; This time we want Texinfo, so we get the manual. Add
845 ;; STATIC-BASH-FOR-GLIBC so that it's used in the final shebangs of
846 ;; scripts such as 'mkheaders' and 'fixinc.sh' (XXX: who cares about these
847 ;; scripts?).
bdb36958 848 (native-inputs `(("texinfo" ,texinfo-boot0)
19d27131 849 ("perl" ,perl-boot0) ;for manpages
90d891fc 850 ("static-bash" ,static-bash-for-glibc)
bdb36958
LC
851 ,@(package-native-inputs gcc-boot0)))
852
8309c389 853 (inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp-6.0)))
bdb36958
LC
854 ("mpfr-source" ,(package-source mpfr))
855 ("mpc-source" ,(package-source mpc))
f50b013f 856 ("ld-wrapper" ,(ld-wrapper-boot3))
bdb36958
LC
857 ("binutils" ,binutils-final)
858 ("libstdc++" ,libstdc++)
98bd851e 859 ("zlib" ,zlib-final)
a2b2070b 860 ,@(%boot2-inputs)))))
bdb36958 861
a2b2070b 862(define (%boot3-inputs)
bdb36958
LC
863 ;; 4th stage inputs.
864 `(("gcc" ,gcc-final)
f50b013f 865 ("ld-wrapper" ,(ld-wrapper-boot3))
a2b2070b 866 ,@(alist-delete "gcc" (%boot2-inputs))))
bdb36958
LC
867
868(define bash-final
869 ;; Link with `-static-libgcc' to make sure we don't retain a reference
704243e0
LC
870 ;; to the bootstrap GCC. Use "bash-minimal" to avoid an extra dependency
871 ;; on Readline and ncurses.
d9b4cbc2 872 (let ((bash (package
704243e0 873 (inherit bash-minimal)
d9b4cbc2
LC
874 (arguments
875 `(#:disallowed-references
a2b2070b 876 ,(assoc-ref (%boot3-inputs) "coreutils&co")
704243e0 877 ,@(package-arguments bash-minimal))))))
d9b4cbc2
LC
878 (package-with-bootstrap-guile
879 (package-with-explicit-inputs (static-libgcc-package bash)
f50b013f 880 %boot3-inputs
d9b4cbc2
LC
881 (current-source-location)
882 #:guile %bootstrap-guile))))
bdb36958 883
a2b2070b 884(define (%boot4-inputs)
bdb36958
LC
885 ;; Now use the final Bash.
886 `(("bash" ,bash-final)
a2b2070b 887 ,@(alist-delete "bash" (%boot3-inputs))))
bdb36958
LC
888
889(define-public guile-final
386b71d1
LC
890 ;; This package must be public because other modules refer to it. However,
891 ;; mark it as hidden so that 'fold-packages' ignores it.
bdb36958 892 (package-with-bootstrap-guile
34d624ce 893 (package-with-explicit-inputs (hidden-package guile-2.2/fixed)
f50b013f 894 %boot4-inputs
bdb36958
LC
895 (current-source-location)
896 #:guile %bootstrap-guile)))
897
89223417 898(define glibc-utf8-locales-final
87c8b92f
LC
899 ;; Now that we have GUILE-FINAL, build the UTF-8 locales. They are needed
900 ;; by the build processes afterwards so their 'scm_to_locale_string' works
901 ;; with the full range of Unicode codepoints (remember
902 ;; 'scm_to_locale_string' is called every time a string is passed to a C
903 ;; function.)
904 (package
905 (inherit glibc-utf8-locales)
906 (inputs `(("glibc" ,glibc-final)
907 ("gzip"
f50b013f 908 ,(package-with-explicit-inputs gzip %boot4-inputs
87c8b92f
LC
909 (current-source-location)
910 #:guile %bootstrap-guile))))))
911
28cbc587
LC
912(define-public ld-wrapper
913 ;; The final 'ld' wrapper, which uses the final Guile and Binutils.
78dea6f1
LC
914 (make-ld-wrapper "ld-wrapper"
915 #:binutils binutils-final
916 #:guile guile-final
917 #:bash bash-final))
28cbc587 918
a2b2070b 919(define (%boot5-inputs)
b6ac5451
LC
920 ;; Now with UTF-8 locales. Remember that the bootstrap binaries were built
921 ;; with an older libc, which cannot load the new locale format. See
28cbc587 922 ;; <https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00737.html>.
b6ac5451 923 `(("locales" ,glibc-utf8-locales-final)
a2b2070b 924 ,@(%boot4-inputs)))
87c8b92f 925
bdb36958
LC
926(define gnu-make-final
927 ;; The final GNU Make, which uses the final Guile.
928 (package-with-bootstrap-guile
929 (package-with-explicit-inputs gnu-make
f50b013f
JN
930 (lambda _
931 `(("guile" ,guile-final)
932 ,@(%boot5-inputs)))
bdb36958
LC
933 (current-source-location))))
934
bdb36958
LC
935(define coreutils-final
936 ;; The final Coreutils. Treat them specially because some packages, such as
937 ;; Findutils, keep a reference to the Coreutils they were built with.
938 (package-with-bootstrap-guile
939 (package-with-explicit-inputs coreutils
f50b013f 940 %boot5-inputs
bdb36958
LC
941 (current-source-location)
942
943 ;; Use the final Guile, linked against the
944 ;; final libc with working iconv, so that
945 ;; 'substitute*' works well when touching
946 ;; test files in Gettext.
947 #:guile guile-final)))
948
949(define grep-final
950 ;; The final grep. Gzip holds a reference to it (via zgrep), so it must be
951 ;; built before gzip.
78ca500a 952 (let ((grep (package-with-bootstrap-guile
f50b013f 953 (package-with-explicit-inputs grep %boot5-inputs
78ca500a
LC
954 (current-source-location)
955 #:guile guile-final))))
956 (package/inherit grep
957 (inputs (alist-delete "pcre" (package-inputs grep)))
958 (native-inputs `(("perl" ,perl-boot0))))))
bdb36958 959
a2b2070b 960(define (%boot6-inputs)
bdb36958
LC
961 ;; Now use the final Coreutils.
962 `(("coreutils" ,coreutils-final)
963 ("grep" ,grep-final)
a2b2070b 964 ,@(%boot5-inputs)))
b0fd2bd3 965
301a4249
LC
966(define sed-final
967 ;; The final sed.
968 (let ((sed (package-with-bootstrap-guile
f50b013f 969 (package-with-explicit-inputs sed %boot6-inputs
301a4249
LC
970 (current-source-location)
971 #:guile guile-final))))
972 (package/inherit sed (native-inputs `(("perl" ,perl-boot0))))))
973
bdb36958
LC
974(define-public %final-inputs
975 ;; Final derivations used as implicit inputs by 'gnu-build-system'. We
976 ;; still use 'package-with-bootstrap-guile' so that the bootstrap tools are
977 ;; used for origins that have patches, thereby avoiding circular
978 ;; dependencies.
979 (let ((finalize (compose package-with-bootstrap-guile
f50b013f 980 (cut package-with-explicit-inputs <> %boot6-inputs
bdb36958
LC
981 (current-source-location)))))
982 `(,@(map (match-lambda
983 ((name package)
984 (list name (finalize package))))
985 `(("tar" ,tar)
87c8b92f 986 ("gzip" ,gzip)
bdb36958
LC
987 ("bzip2" ,bzip2)
988 ("xz" ,xz)
c00a9fbf 989 ("file" ,file)
bdb36958
LC
990 ("diffutils" ,diffutils)
991 ("patch" ,patch)
bdb36958
LC
992 ("findutils" ,findutils)
993 ("gawk" ,gawk)))
301a4249 994 ("sed" ,sed-final)
bdb36958
LC
995 ("grep" ,grep-final)
996 ("coreutils" ,coreutils-final)
997 ("make" ,gnu-make-final)
998 ("bash" ,bash-final)
999 ("ld-wrapper" ,ld-wrapper)
1000 ("binutils" ,binutils-final)
1001 ("gcc" ,gcc-final)
b0fd2bd3 1002 ("libc" ,glibc-final)
6dff905e 1003 ("libc:static" ,glibc-final "static")
b0fd2bd3 1004 ("locales" ,glibc-utf8-locales-final))))
bdb36958
LC
1005
1006(define-public canonical-package
1007 (let ((name->package (fold (lambda (input result)
1008 (match input
6dff905e 1009 ((_ package . outputs)
bdb36958
LC
1010 (vhash-cons (package-full-name package)
1011 package result))))
1012 vlist-null
1013 `(("guile" ,guile-final)
1014 ,@%final-inputs))))
1015 (lambda (package)
1016 "Return the 'canonical' variant of PACKAGE---i.e., if PACKAGE is one of
1017the implicit inputs of 'gnu-build-system', return that one, otherwise return
1018PACKAGE.
1019
34d624ce 1020The goal is to avoid duplication in cases like GUILE-FINAL vs. GUILE-2.2,
bdb36958
LC
1021COREUTILS-FINAL vs. COREUTILS, etc."
1022 ;; XXX: This doesn't handle dependencies of the final inputs, such as
1023 ;; libunistring, GMP, etc.
1024 (match (vhash-assoc (package-full-name package) name->package)
1025 ((_ . canon)
1026 ;; In general we want CANON, except if we're cross-compiling: CANON
1027 ;; uses explicit inputs, so it is "anchored" in the bootstrapped
1028 ;; process, with dependencies on things that cannot be
1029 ;; cross-compiled.
1030 (if (%current-target-system)
1031 package
1032 canon))
1033 (_ package)))))
1034
1035\f
1036;;;
1037;;; GCC toolchain.
1038;;;
1039
b887ede1 1040(define (make-gcc-toolchain gcc)
bdb36958
LC
1041 "Return a complete toolchain for GCC."
1042 (package
1043 (name "gcc-toolchain")
1044 (version (package-version gcc))
1045 (source #f)
1046 (build-system trivial-build-system)
1047 (arguments
1048 '(#:modules ((guix build union))
1049 #:builder (begin
1050 (use-modules (ice-9 match)
6f450b87 1051 (srfi srfi-26)
bdb36958
LC
1052 (guix build union))
1053
6f450b87 1054 (let ((out (assoc-ref %outputs "out")))
bdb36958 1055
6f450b87
LC
1056 (match %build-inputs
1057 (((names . directories) ...)
1058 (union-build out directories)))
1059
6f450b87
LC
1060 (union-build (assoc-ref %outputs "debug")
1061 (list (assoc-ref %build-inputs
e3cfef22 1062 "libc-debug")))
5a48a066
LC
1063 (union-build (assoc-ref %outputs "static")
1064 (list (assoc-ref %build-inputs
3d5ad159 1065 "libc-static")))
e3cfef22 1066 #t))))
d474d5d0
LC
1067
1068 (native-search-paths (package-native-search-paths gcc))
1069 (search-paths (package-search-paths gcc))
1070
bdb36958
LC
1071 (license (package-license gcc))
1072 (synopsis "Complete GCC tool chain for C/C++ development")
1073 (description
1074 "This package provides a complete GCC tool chain for C/C++ development to
1075be installed in user profiles. This includes GCC, as well as libc (headers
1076and binaries, plus debugging symbols in the 'debug' output), and Binutils.")
6fd52309 1077 (home-page "https://gcc.gnu.org/")
5a48a066 1078 (outputs '("out" "debug" "static"))
bdb36958
LC
1079
1080 ;; The main raison d'être of this "meta-package" is (1) to conveniently
1081 ;; install everything that we need, and (2) to make sure ld-wrapper comes
1082 ;; before Binutils' ld in the user's profile.
1083 (inputs `(("gcc" ,gcc)
cbbb11c8 1084 ("ld-wrapper" ,(car (assoc-ref %final-inputs "ld-wrapper")))
bdb36958
LC
1085 ("binutils" ,binutils-final)
1086 ("libc" ,glibc-final)
5a48a066
LC
1087 ("libc-debug" ,glibc-final "debug")
1088 ("libc-static" ,glibc-final "static")))))
bdb36958
LC
1089
1090(define-public gcc-toolchain-4.8
b887ede1 1091 (make-gcc-toolchain gcc-4.8))
bdb36958
LC
1092
1093(define-public gcc-toolchain-4.9
b887ede1
LC
1094 (make-gcc-toolchain gcc-4.9))
1095
1096(define-public gcc-toolchain
1097 (make-gcc-toolchain gcc-final))
bdb36958 1098
629f4d2e 1099(define-public gcc-toolchain-5
b887ede1 1100 gcc-toolchain)
60e2d5fe 1101
e760ec41 1102(define-public gcc-toolchain-6
b887ede1 1103 (make-gcc-toolchain gcc-6))
e760ec41 1104
d7ecab74 1105(define-public gcc-toolchain-7
b887ede1 1106 (make-gcc-toolchain gcc-7))
d7ecab74 1107
5ae27f57
LC
1108(define-public gcc-toolchain-8
1109 (make-gcc-toolchain gcc-8))
1110
bdb36958 1111;;; commencement.scm ends here