1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
5 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
7 ;;; This file is part of GNU Guix.
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages commencement)
23 #:use-module ((guix licenses)
24 #:select (gpl3+ lgpl2.0+ public-domain))
25 #:use-module (gnu packages bootstrap)
26 #:use-module (gnu packages base)
27 #:use-module (gnu packages bash)
28 #:use-module (gnu packages gcc)
29 #:use-module (gnu packages m4)
30 #:use-module (gnu packages file)
31 #:use-module (gnu packages gawk)
32 #:use-module (gnu packages bison)
33 #:use-module (gnu packages guile)
34 #:use-module (gnu packages gettext)
35 #:use-module (gnu packages multiprecision)
36 #:use-module (gnu packages compression)
37 #:use-module (gnu packages perl)
38 #:use-module (gnu packages linux)
39 #:use-module (gnu packages texinfo)
40 #:use-module (gnu packages pkg-config)
41 #:use-module (guix packages)
42 #:use-module (guix download)
43 #:use-module (guix build-system gnu)
44 #:use-module (guix build-system trivial)
45 #:use-module (guix utils)
46 #:use-module (srfi srfi-1)
47 #:use-module (srfi srfi-26)
48 #:use-module (ice-9 vlist)
49 #:use-module (ice-9 match))
53 ;;; This is the commencement, this is where things start. Before the
54 ;;; commencement, of course, there's the 'bootstrap' module, which provides us
55 ;;; with the initial binaries. This module uses those bootstrap binaries to
56 ;;; actually build up the whole tool chain that make up the implicit inputs of
57 ;;; 'gnu-build-system'.
59 ;;; To avoid circular dependencies, this module should not be imported
60 ;;; directly from anywhere.
64 (define gnu-make-boot0
65 (package-with-bootstrap-guile
66 (package (inherit gnu-make)
69 `(#:guile ,%bootstrap-guile
71 #:tests? #f ; cannot run "make check"
72 ,@(substitute-keyword-arguments (package-arguments gnu-make)
76 (zero? (system* "./build.sh")))
78 'install (lambda* (#:key outputs #:allow-other-keys)
79 (let* ((out (assoc-ref outputs "out"))
80 (bin (string-append out "/bin")))
83 (string-append bin "/make"))))
85 (native-inputs '()) ; no need for 'pkg-config'
86 (inputs %bootstrap-inputs))))
88 (define diffutils-boot0
89 (package-with-bootstrap-guile
90 (let ((p (package-with-explicit-inputs diffutils
91 `(("make" ,gnu-make-boot0)
93 #:guile %bootstrap-guile)))
95 (arguments `(#:tests? #f ; the test suite needs diffutils
96 ,@(package-arguments p)))))))
98 (define findutils-boot0
99 (package-with-bootstrap-guile
100 (package-with-explicit-inputs findutils
101 `(("make" ,gnu-make-boot0)
102 ("diffutils" ,diffutils-boot0) ; for tests
104 (current-source-location)
105 #:guile %bootstrap-guile)))
108 (package-with-bootstrap-guile
109 (package-with-explicit-inputs file
110 `(("make" ,gnu-make-boot0)
112 (current-source-location)
113 #:guile %bootstrap-guile)))
116 (define %boot0-inputs
117 `(("make" ,gnu-make-boot0)
118 ("diffutils" ,diffutils-boot0)
119 ("findutils" ,findutils-boot0)
121 ,@%bootstrap-inputs))
123 (define* (boot-triplet #:optional (system (%current-system)))
124 ;; Return the triplet used to create the cross toolchain needed in the
125 ;; first bootstrapping stage.
126 (nix-system->gnu-triplet system "guix"))
128 ;; Following Linux From Scratch, build a cross-toolchain in stage 0. That
129 ;; toolchain actually targets the same OS and arch, but it has the advantage
130 ;; of being independent of the libc and tools in %BOOTSTRAP-INPUTS, since
131 ;; GCC-BOOT0 (below) is built without any reference to the target libc.
133 (define binutils-boot0
134 (package-with-bootstrap-guile
135 (package (inherit binutils)
136 (name "binutils-cross-boot0")
138 `(#:guile ,%bootstrap-guile
139 #:implicit-inputs? #f
141 #:modules ((guix build gnu-build-system)
143 (ice-9 ftw)) ; for 'scandir'
144 #:phases (alist-cons-after
145 'install 'add-symlinks
146 (lambda* (#:key outputs #:allow-other-keys)
147 ;; The cross-gcc invokes 'as', 'ld', etc, without the
148 ;; triplet prefix, so add symlinks.
149 (let ((out (assoc-ref outputs "out"))
150 (triplet-prefix (string-append ,(boot-triplet) "-")))
151 (define (has-triplet-prefix? name)
152 (string-prefix? triplet-prefix name))
153 (define (remove-triplet-prefix name)
154 (substring name (string-length triplet-prefix)))
155 (with-directory-excursion (string-append out "/bin")
156 (for-each (lambda (name)
157 (symlink name (remove-triplet-prefix name)))
158 (scandir "." has-triplet-prefix?)))
162 ,@(substitute-keyword-arguments (package-arguments binutils)
163 ((#:configure-flags cf)
164 `(cons ,(string-append "--target=" (boot-triplet))
166 (inputs %boot0-inputs))))
169 (package-with-bootstrap-guile
170 (package (inherit gcc)
171 (name "gcc-cross-boot0")
173 `(#:guile ,%bootstrap-guile
174 #:implicit-inputs? #f
175 #:modules ((guix build gnu-build-system)
180 ,@(substitute-keyword-arguments (package-arguments gcc)
181 ((#:configure-flags flags)
182 `(append (list ,(string-append "--target=" (boot-triplet))
187 ;; Disable features not needed at this stage.
189 "--enable-languages=c,c++"
191 ;; libstdc++ cannot be built at this stage
192 ;; ("Link tests are not allowed after
193 ;; GCC_NO_EXECUTABLES.").
194 "--disable-libstdc++-v3"
197 "--disable-libmudflap"
198 "--disable-libatomic"
199 "--disable-libsanitizer"
202 "--disable-libcilkrts"
205 "--disable-libquadmath"
206 "--disable-decimal-float")
207 (remove (cut string-match "--enable-languages.*" <>)
211 'unpack 'unpack-gmp&co
212 (lambda* (#:key inputs #:allow-other-keys)
213 (let ((gmp (assoc-ref %build-inputs "gmp-source"))
214 (mpfr (assoc-ref %build-inputs "mpfr-source"))
215 (mpc (assoc-ref %build-inputs "mpc-source")))
217 ;; To reduce the set of pre-built bootstrap inputs, build
218 ;; GMP & co. from GCC.
219 (for-each (lambda (source)
220 (or (zero? (system* "tar" "xvf" source))
221 (error "failed to unpack tarball"
225 ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
227 ;; Drop trailing letters, as gmp-6.0.0a unpacks
229 `(symlink ,(string-trim-right
230 (package-full-name lib)
232 ,(package-name lib)))
233 (list gmp mpfr mpc))))
235 'install 'symlink-libgcc_eh
236 (lambda* (#:key outputs #:allow-other-keys)
237 (let ((out (assoc-ref outputs "lib")))
238 ;; Glibc wants to link against libgcc_eh, so provide
240 (with-directory-excursion
241 (string-append out "/lib/gcc/"
243 "/" ,(package-version gcc))
244 (symlink "libgcc.a" "libgcc_eh.a"))))
247 (inputs `(("gmp-source" ,(package-source gmp))
248 ("mpfr-source" ,(package-source mpfr))
249 ("mpc-source" ,(package-source mpc))
250 ("binutils-cross" ,binutils-boot0)
252 ;; Call it differently so that the builder can check whether
253 ;; the "libc" input is #f.
254 ("libc-native" ,@(assoc-ref %boot0-inputs "libc"))
255 ,@(alist-delete "libc" %boot0-inputs)))
257 ;; No need for Texinfo at this stage.
258 (native-inputs (alist-delete "texinfo"
259 (package-native-inputs gcc))))))
262 (package-with-bootstrap-guile
263 (package-with-explicit-inputs perl
265 (current-source-location)
266 #:guile %bootstrap-guile)))
268 (define (linux-libre-headers-boot0)
269 "Return Linux-Libre header files for the bootstrap environment."
270 ;; Note: this is wrapped in a thunk to nicely handle circular dependencies
271 ;; between (gnu packages linux) and this module.
272 (package-with-bootstrap-guile
273 (package (inherit linux-libre-headers)
274 (arguments `(#:guile ,%bootstrap-guile
275 #:implicit-inputs? #f
276 ,@(package-arguments linux-libre-headers)))
278 `(("perl" ,perl-boot0)
281 (define texinfo-boot0
282 ;; Texinfo used to build libc's manual.
283 ;; We build without ncurses because it fails to build at this stage, and
284 ;; because we don't need the stand-alone Info reader.
285 ;; Also, use %BOOT0-INPUTS to avoid building Perl once more.
286 (let ((texinfo (package (inherit texinfo)
288 (inputs (alist-delete "ncurses" (package-inputs texinfo))))))
289 (package-with-bootstrap-guile
290 (package-with-explicit-inputs texinfo %boot0-inputs
291 (current-source-location)
292 #:guile %bootstrap-guile))))
294 (define %boot1-inputs
297 ("binutils-cross" ,binutils-boot0)
298 ,@(alist-delete "binutils" %boot0-inputs)))
300 (define glibc-final-with-bootstrap-bash
301 ;; The final libc, "cross-built". If everything went well, the resulting
302 ;; store path has no dependencies. Actually, the really-final libc is
303 ;; built just below; the only difference is that this one uses the
305 (package-with-bootstrap-guile
306 (package (inherit glibc)
307 (name "glibc-intermediate")
309 `(#:guile ,%bootstrap-guile
310 #:implicit-inputs? #f
312 ,@(substitute-keyword-arguments (package-arguments glibc)
313 ((#:configure-flags flags)
314 `(append (list ,(string-append "--host=" (boot-triplet))
315 ,(string-append "--build="
316 (nix-system->gnu-triplet))
318 ;; Build Sun/ONC RPC support. In particular,
320 "--enable-obsolete-rpc")
324 'configure 'pre-configure
325 (lambda* (#:key inputs #:allow-other-keys)
326 ;; Don't clobber CPATH with the bootstrap libc.
327 (setenv "NATIVE_CPATH" (getenv "CPATH"))
330 ;; 'rpcgen' needs native libc headers to be built.
331 (substitute* "sunrpc/Makefile"
332 (("sunrpc-CPPFLAGS =.*" all)
333 (string-append "CPATH = $(NATIVE_CPATH)\n"
337 (propagated-inputs `(("linux-headers" ,(linux-libre-headers-boot0))))
339 `(("texinfo" ,texinfo-boot0)
340 ("perl" ,perl-boot0)))
342 `(;; The boot inputs. That includes the bootstrap libc. We don't want
343 ;; it in $CPATH, hence the 'pre-configure' phase above.
346 ;; A native GCC is needed to build `cross-rpcgen'.
347 ("native-gcc" ,@(assoc-ref %boot0-inputs "gcc"))
349 ;; Here, we use the bootstrap Bash, which is not satisfactory
350 ;; because we don't want to depend on bootstrap tools.
351 ("static-bash" ,@(assoc-ref %boot0-inputs "bash")))))))
353 (define (cross-gcc-wrapper gcc binutils glibc bash)
354 "Return a wrapper for the pseudo-cross toolchain GCC/BINUTILS/GLIBC
355 that makes it available under the native tool names."
356 (package (inherit gcc)
357 (name (string-append (package-name gcc) "-wrapped"))
359 (build-system trivial-build-system)
362 `(#:guile ,%bootstrap-guile
363 #:modules ((guix build utils))
365 (use-modules (guix build utils))
367 (let* ((binutils (assoc-ref %build-inputs "binutils"))
368 (gcc (assoc-ref %build-inputs "gcc"))
369 (libc (assoc-ref %build-inputs "libc"))
370 (bash (assoc-ref %build-inputs "bash"))
371 (out (assoc-ref %outputs "out"))
372 (bindir (string-append out "/bin"))
373 (triplet ,(boot-triplet)))
374 (define (wrap-program program)
375 ;; GCC-BOOT0 is a libc-less cross-compiler, so it
376 ;; needs to be told where to find the crt files and
377 ;; the dynamic linker.
378 (call-with-output-file program
380 (format p "#!~a/bin/bash
381 exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
385 ,(glibc-dynamic-linker))))
387 (chmod program #o555))
390 (with-directory-excursion bindir
391 (for-each (lambda (tool)
392 (symlink (string-append binutils "/bin/"
396 (for-each wrap-program '("gcc" "g++")))))))
398 `(("binutils" ,binutils)
405 ;; XXX: This Bison is needed to rebuild Bash's parser, which is modified by
406 ;; its CVE patches. Remove it when it's no longer needed.
407 (let* ((m4 (package-with-bootstrap-guile
408 (package-with-explicit-inputs m4 %boot0-inputs
409 (current-source-location)
410 #:guile %bootstrap-guile)))
411 (bison (package (inherit bison)
412 (native-inputs `(("perl" ,perl-boot0)))
413 (propagated-inputs `(("m4" ,m4)))
414 (inputs '()) ;remove Flex...
415 (arguments '(#:tests? #f))))) ;... and thus disable tests
416 (package-with-bootstrap-guile
417 (package-with-explicit-inputs bison %boot0-inputs
418 (current-source-location)
419 #:guile %bootstrap-guile))))
421 (define static-bash-for-glibc
422 ;; A statically-linked Bash to be used by GLIBC-FINAL in system(3) & co.
423 (let* ((gcc (cross-gcc-wrapper gcc-boot0 binutils-boot0
424 glibc-final-with-bootstrap-bash
425 (car (assoc-ref %boot1-inputs "bash"))))
426 (bash (package (inherit static-bash)
427 (native-inputs `(("bison" ,bison-boot1)))
429 `(#:guile ,%bootstrap-guile
430 ,@(package-arguments static-bash))))))
431 (package-with-bootstrap-guile
432 (package-with-explicit-inputs bash
434 ("libc" ,glibc-final-with-bootstrap-bash)
435 ,@(fold alist-delete %boot1-inputs
437 (current-source-location)))))
439 (define gettext-boot0
440 ;; A minimal gettext used during bootstrap.
441 (let ((gettext-minimal
442 (package (inherit gnu-gettext)
443 (name "gettext-boot0")
444 (inputs '()) ;zero dependencies
446 (substitute-keyword-arguments
448 ,@(package-arguments gnu-gettext))
450 `(modify-phases ,phases
451 ;; Build only the tools.
452 (add-after 'unpack 'chdir
454 (chdir "gettext-tools")))
456 ;; Some test programs require pthreads, which we don't have.
457 (add-before 'configure 'no-test-programs
459 (substitute* "tests/Makefile.in"
464 ;; Don't try to link against libexpat.
466 (delete 'patch-tests))))))))
467 (package-with-bootstrap-guile
468 (package-with-explicit-inputs gettext-minimal
470 (current-source-location)
471 #:guile %bootstrap-guile))))
474 ;; The final glibc, which embeds the statically-linked Bash built above.
475 (package (inherit glibc-final-with-bootstrap-bash)
477 (inputs `(("static-bash" ,static-bash-for-glibc)
480 (package-inputs glibc-final-with-bootstrap-bash))))
482 ;; This time we need 'msgfmt' to install all the libc.mo files.
483 (native-inputs `(,@(package-native-inputs glibc-final-with-bootstrap-bash)
484 ("gettext" ,gettext-boot0)))
486 ;; The final libc only refers to itself, but the 'debug' output contains
487 ;; references to GCC-BOOT0 and to the Linux headers. XXX: Would be great
488 ;; if 'allowed-references' were per-output.
490 `(#:allowed-references
491 ,(cons* `(,gcc-boot0 "lib") (linux-libre-headers-boot0)
492 static-bash-for-glibc
493 (package-outputs glibc-final-with-bootstrap-bash))
495 ,@(package-arguments glibc-final-with-bootstrap-bash)))))
497 (define gcc-boot0-wrapped
498 ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
500 (cross-gcc-wrapper gcc-boot0 binutils-boot0 glibc-final
501 (car (assoc-ref %boot1-inputs "bash"))))
503 (define %boot2-inputs
505 `(("libc" ,glibc-final)
506 ("gcc" ,gcc-boot0-wrapped)
507 ,@(fold alist-delete %boot1-inputs '("libc" "gcc"))))
509 (define binutils-final
510 (package-with-bootstrap-guile
511 (package (inherit binutils)
513 `(#:guile ,%bootstrap-guile
514 #:implicit-inputs? #f
515 #:allowed-references ("out" ,glibc-final)
516 ,@(package-arguments binutils)))
517 (inputs %boot2-inputs))))
520 ;; Intermediate libstdc++ that will allow us to build the final GCC
521 ;; (remember that GCC-BOOT0 cannot build libstdc++.)
522 ;; TODO: Write in terms of 'make-libstdc++'.
523 (package-with-bootstrap-guile
524 (package (inherit gcc)
527 `(#:guile ,%bootstrap-guile
528 #:implicit-inputs? #f
531 #:phases (alist-cons-before
534 (chdir "libstdc++-v3"))
536 #:configure-flags `("--disable-shared"
537 "--disable-libstdcxx-threads"
538 "--disable-libstdcxx-pch"
539 ,(string-append "--with-gxx-include-dir="
540 (assoc-ref %outputs "out")
543 ;; ,(package-version gcc)
546 (inputs %boot2-inputs)
548 (propagated-inputs '())
549 (synopsis "GNU C++ standard library (intermediate)"))))
553 (package (inherit gcc-boot0)
556 ;; XXX: Currently #:allowed-references applies to all the outputs but the
557 ;; "debug" output contains disallowed references, notably
558 ;; linux-libre-headers. Disable the debugging output to work around that.
559 (outputs (delete "debug" (package-outputs gcc-boot0)))
562 `(#:guile ,%bootstrap-guile
563 #:implicit-inputs? #f
565 #:allowed-references ("out" "lib"
566 ,glibc-final ,static-bash-for-glibc)
568 ;; Things like libasan.so and libstdc++.so NEED ld.so for some
569 ;; reason, but it is not in their RUNPATH. This is a false
570 ;; positive, so turn it off.
571 #:validate-runpath? #f
573 ;; Build again GMP & co. within GCC's build process, because it's hard
574 ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
575 ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
576 ,@(substitute-keyword-arguments (package-arguments gcc-boot0)
577 ((#:configure-flags boot-flags)
578 (let loop ((args (package-arguments gcc)))
580 ((#:configure-flags normal-flags _ ...)
584 ((#:make-flags flags)
585 ;; Since $LIBRARY_PATH and $CPATH are not honored, add the
587 `(cons (string-append "CPPFLAGS=-I"
588 (assoc-ref %build-inputs "libstdc++")
591 (if (string-prefix? "LDFLAGS=" flag)
592 (string-append flag " -L"
593 (assoc-ref %build-inputs "libstdc++")
598 `(alist-delete 'symlink-libgcc_eh ,phases)))))
600 ;; This time we want Texinfo, so we get the manual. Add
601 ;; STATIC-BASH-FOR-GLIBC so that it's used in the final shebangs of
602 ;; scripts such as 'mkheaders' and 'fixinc.sh' (XXX: who cares about these
604 (native-inputs `(("texinfo" ,texinfo-boot0)
605 ("static-bash" ,static-bash-for-glibc)
606 ,@(package-native-inputs gcc-boot0)))
608 (inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp)))
609 ("mpfr-source" ,(package-source mpfr))
610 ("mpc-source" ,(package-source mpc))
611 ("binutils" ,binutils-final)
612 ("libstdc++" ,libstdc++)
615 (define ld-wrapper-boot3
616 ;; A linker wrapper that uses the bootstrap Guile.
617 (make-ld-wrapper "ld-wrapper-boot3"
618 #:binutils binutils-final
619 #:guile %bootstrap-guile
620 #:bash (car (assoc-ref %boot2-inputs "bash"))))
622 (define %boot3-inputs
625 ("ld-wrapper" ,ld-wrapper-boot3)
626 ,@(alist-delete "gcc" %boot2-inputs)))
629 ;; Link with `-static-libgcc' to make sure we don't retain a reference
630 ;; to the bootstrap GCC.
631 (package-with-bootstrap-guile
632 (package-with-explicit-inputs (static-libgcc-package bash)
634 (current-source-location)
635 #:guile %bootstrap-guile)))
637 (define %boot4-inputs
638 ;; Now use the final Bash.
639 `(("bash" ,bash-final)
640 ,@(alist-delete "bash" %boot3-inputs)))
642 (define-public guile-final
643 (package-with-bootstrap-guile
644 (package-with-explicit-inputs guile-2.0/fixed
646 (current-source-location)
647 #:guile %bootstrap-guile)))
649 (define glibc-utf8-locales-final
650 ;; Now that we have GUILE-FINAL, build the UTF-8 locales. They are needed
651 ;; by the build processes afterwards so their 'scm_to_locale_string' works
652 ;; with the full range of Unicode codepoints (remember
653 ;; 'scm_to_locale_string' is called every time a string is passed to a C
656 (inherit glibc-utf8-locales)
657 (inputs `(("glibc" ,glibc-final)
659 ,(package-with-explicit-inputs gzip %boot4-inputs
660 (current-source-location)
661 #:guile %bootstrap-guile))))))
663 (define-public ld-wrapper
664 ;; The final 'ld' wrapper, which uses the final Guile and Binutils.
665 (package (inherit ld-wrapper-boot3)
667 (inputs `(("guile" ,guile-final)
669 ,@(fold alist-delete (package-inputs ld-wrapper-boot3)
670 '("guile" "bash"))))))
672 (define %boot5-inputs
673 ;; Now with UTF-8 locales. Remember that the bootstrap binaries were built
674 ;; with an older libc, which cannot load the new locale format. See
675 ;; <https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00737.html>.
676 `(("locales" ,glibc-utf8-locales-final)
679 (define gnu-make-final
680 ;; The final GNU Make, which uses the final Guile.
681 (package-with-bootstrap-guile
682 (package-with-explicit-inputs gnu-make
683 `(("guile" ,guile-final)
685 (current-source-location))))
687 (define coreutils-final
688 ;; The final Coreutils. Treat them specially because some packages, such as
689 ;; Findutils, keep a reference to the Coreutils they were built with.
690 (package-with-bootstrap-guile
691 (package-with-explicit-inputs coreutils
693 (current-source-location)
695 ;; Use the final Guile, linked against the
696 ;; final libc with working iconv, so that
697 ;; 'substitute*' works well when touching
698 ;; test files in Gettext.
699 #:guile guile-final)))
702 ;; The final grep. Gzip holds a reference to it (via zgrep), so it must be
703 ;; built before gzip.
704 (package-with-bootstrap-guile
705 (package-with-explicit-inputs grep
707 (current-source-location)
708 #:guile guile-final)))
710 (define %boot6-inputs
711 ;; Now use the final Coreutils.
712 `(("coreutils" ,coreutils-final)
716 (define-public %final-inputs
717 ;; Final derivations used as implicit inputs by 'gnu-build-system'. We
718 ;; still use 'package-with-bootstrap-guile' so that the bootstrap tools are
719 ;; used for origins that have patches, thereby avoiding circular
721 (let ((finalize (compose package-with-bootstrap-guile
722 (cut package-with-explicit-inputs <> %boot6-inputs
723 (current-source-location)))))
724 `(,@(map (match-lambda
726 (list name (finalize package))))
732 ("diffutils" ,diffutils)
735 ("findutils" ,findutils)
738 ("coreutils" ,coreutils-final)
739 ("make" ,gnu-make-final)
741 ("ld-wrapper" ,ld-wrapper)
742 ("binutils" ,binutils-final)
744 ("libc" ,glibc-final)
745 ("locales" ,glibc-utf8-locales-final))))
747 (define-public canonical-package
748 (let ((name->package (fold (lambda (input result)
751 (vhash-cons (package-full-name package)
754 `(("guile" ,guile-final)
757 "Return the 'canonical' variant of PACKAGE---i.e., if PACKAGE is one of
758 the implicit inputs of 'gnu-build-system', return that one, otherwise return
761 The goal is to avoid duplication in cases like GUILE-FINAL vs. GUILE-2.0,
762 COREUTILS-FINAL vs. COREUTILS, etc."
763 ;; XXX: This doesn't handle dependencies of the final inputs, such as
764 ;; libunistring, GMP, etc.
765 (match (vhash-assoc (package-full-name package) name->package)
767 ;; In general we want CANON, except if we're cross-compiling: CANON
768 ;; uses explicit inputs, so it is "anchored" in the bootstrapped
769 ;; process, with dependencies on things that cannot be
771 (if (%current-target-system)
781 (define (gcc-toolchain gcc)
782 "Return a complete toolchain for GCC."
784 (name "gcc-toolchain")
785 (version (package-version gcc))
787 (build-system trivial-build-system)
789 '(#:modules ((guix build union))
791 (use-modules (ice-9 match)
795 (let ((out (assoc-ref %outputs "out")))
798 (((names . directories) ...)
799 (union-build out directories)))
801 (union-build (assoc-ref %outputs "debug")
802 (list (assoc-ref %build-inputs
805 (native-search-paths (package-native-search-paths gcc))
806 (search-paths (package-search-paths gcc))
808 (license (package-license gcc))
809 (synopsis "Complete GCC tool chain for C/C++ development")
811 "This package provides a complete GCC tool chain for C/C++ development to
812 be installed in user profiles. This includes GCC, as well as libc (headers
813 and binaries, plus debugging symbols in the 'debug' output), and Binutils.")
814 (home-page "http://gcc.gnu.org/")
815 (outputs '("out" "debug"))
817 ;; The main raison d'être of this "meta-package" is (1) to conveniently
818 ;; install everything that we need, and (2) to make sure ld-wrapper comes
819 ;; before Binutils' ld in the user's profile.
820 (inputs `(("gcc" ,gcc)
821 ("ld-wrapper" ,(car (assoc-ref %final-inputs "ld-wrapper")))
822 ("binutils" ,binutils-final)
823 ("libc" ,glibc-final)
824 ("libc-debug" ,glibc-final "debug")))))
826 (define-public gcc-toolchain-4.8
827 (gcc-toolchain gcc-final))
829 (define-public gcc-toolchain-4.9
830 (gcc-toolchain gcc-4.9))
832 (define-public gcc-toolchain-5
833 (gcc-toolchain gcc-5))
835 ;;; commencement.scm ends here