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
140 ,@(substitute-keyword-arguments (package-arguments binutils)
141 ((#:configure-flags cf)
142 `(cons ,(string-append "--target=" (boot-triplet))
144 (inputs %boot0-inputs))))
147 (package-with-bootstrap-guile
148 (package (inherit gcc-4.8)
149 (name "gcc-cross-boot0")
151 `(#:guile ,%bootstrap-guile
152 #:implicit-inputs? #f
153 #:modules ((guix build gnu-build-system)
158 ,@(substitute-keyword-arguments (package-arguments gcc-4.8)
159 ((#:configure-flags flags)
160 `(append (list ,(string-append "--target=" (boot-triplet))
165 ;; Disable features not needed at this stage.
167 "--enable-languages=c,c++"
169 ;; libstdc++ cannot be built at this stage
170 ;; ("Link tests are not allowed after
171 ;; GCC_NO_EXECUTABLES.").
172 "--disable-libstdc++-v3"
175 "--disable-libmudflap"
176 "--disable-libatomic"
177 "--disable-libsanitizer"
181 "--disable-libquadmath"
182 "--disable-decimal-float")
183 (remove (cut string-match "--enable-languages.*" <>)
187 'unpack 'unpack-gmp&co
188 (lambda* (#:key inputs #:allow-other-keys)
189 (let ((gmp (assoc-ref %build-inputs "gmp-source"))
190 (mpfr (assoc-ref %build-inputs "mpfr-source"))
191 (mpc (assoc-ref %build-inputs "mpc-source")))
193 ;; To reduce the set of pre-built bootstrap inputs, build
194 ;; GMP & co. from GCC.
195 (for-each (lambda (source)
196 (or (zero? (system* "tar" "xvf" source))
197 (error "failed to unpack tarball"
201 ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
203 ;; Drop trailing letters, as gmp-6.0.0a unpacks
205 `(symlink ,(string-trim-right
206 (package-full-name lib)
208 ,(package-name lib)))
209 (list gmp mpfr mpc))))
211 'install 'symlink-libgcc_eh
212 (lambda* (#:key outputs #:allow-other-keys)
213 (let ((out (assoc-ref outputs "lib")))
214 ;; Glibc wants to link against libgcc_eh, so provide
216 (with-directory-excursion
217 (string-append out "/lib/gcc/"
219 "/" ,(package-version gcc-4.8))
220 (symlink "libgcc.a" "libgcc_eh.a"))))
223 (inputs `(("gmp-source" ,(package-source gmp))
224 ("mpfr-source" ,(package-source mpfr))
225 ("mpc-source" ,(package-source mpc))
226 ("binutils-cross" ,binutils-boot0)
228 ;; Call it differently so that the builder can check whether
229 ;; the "libc" input is #f.
230 ("libc-native" ,@(assoc-ref %boot0-inputs "libc"))
231 ,@(alist-delete "libc" %boot0-inputs)))
233 ;; No need for Texinfo at this stage.
234 (native-inputs (alist-delete "texinfo"
235 (package-native-inputs gcc-4.8))))))
238 (package-with-bootstrap-guile
239 (package-with-explicit-inputs perl
241 (current-source-location)
242 #:guile %bootstrap-guile)))
244 (define (linux-libre-headers-boot0)
245 "Return Linux-Libre header files for the bootstrap environment."
246 ;; Note: this is wrapped in a thunk to nicely handle circular dependencies
247 ;; between (gnu packages linux) and this module.
248 (package-with-bootstrap-guile
249 (package (inherit linux-libre-headers)
250 (arguments `(#:guile ,%bootstrap-guile
251 #:implicit-inputs? #f
252 ,@(package-arguments linux-libre-headers)))
254 `(("perl" ,perl-boot0)
257 (define texinfo-boot0
258 ;; Texinfo used to build libc's manual.
259 ;; We build without ncurses because it fails to build at this stage, and
260 ;; because we don't need the stand-alone Info reader.
261 ;; Also, use %BOOT0-INPUTS to avoid building Perl once more.
262 (let ((texinfo (package (inherit texinfo)
263 (inputs (alist-delete "ncurses" (package-inputs texinfo))))))
264 (package-with-bootstrap-guile
265 (package-with-explicit-inputs texinfo %boot0-inputs
266 (current-source-location)
267 #:guile %bootstrap-guile))))
269 (define %boot1-inputs
272 ("binutils-cross" ,binutils-boot0)
274 ;; Keep "binutils" here because the cross-gcc invokes `as', not the
278 (define glibc-final-with-bootstrap-bash
279 ;; The final libc, "cross-built". If everything went well, the resulting
280 ;; store path has no dependencies. Actually, the really-final libc is
281 ;; built just below; the only difference is that this one uses the
283 (package-with-bootstrap-guile
284 (package (inherit glibc)
285 (name "glibc-intermediate")
287 `(#:guile ,%bootstrap-guile
288 #:implicit-inputs? #f
290 ,@(substitute-keyword-arguments (package-arguments glibc)
291 ((#:configure-flags flags)
292 `(append (list ,(string-append "--host=" (boot-triplet))
293 ,(string-append "--build="
294 (nix-system->gnu-triplet))
296 ;; Build Sun/ONC RPC support. In particular,
298 "--enable-obsolete-rpc")
302 'configure 'pre-configure
303 (lambda* (#:key inputs #:allow-other-keys)
304 ;; Don't clobber CPATH with the bootstrap libc.
305 (setenv "NATIVE_CPATH" (getenv "CPATH"))
308 ;; 'rpcgen' needs native libc headers to be built.
309 (substitute* "sunrpc/Makefile"
310 (("sunrpc-CPPFLAGS =.*" all)
311 (string-append "CPATH = $(NATIVE_CPATH)\n"
315 (propagated-inputs `(("linux-headers" ,(linux-libre-headers-boot0))))
317 `(("texinfo" ,texinfo-boot0)
318 ("perl" ,perl-boot0)))
320 `(;; The boot inputs. That includes the bootstrap libc. We don't want
321 ;; it in $CPATH, hence the 'pre-configure' phase above.
324 ;; A native GCC is needed to build `cross-rpcgen'.
325 ("native-gcc" ,@(assoc-ref %boot0-inputs "gcc"))
327 ;; Here, we use the bootstrap Bash, which is not satisfactory
328 ;; because we don't want to depend on bootstrap tools.
329 ("static-bash" ,@(assoc-ref %boot0-inputs "bash")))))))
331 (define (cross-gcc-wrapper gcc binutils glibc bash)
332 "Return a wrapper for the pseudo-cross toolchain GCC/BINUTILS/GLIBC
333 that makes it available under the native tool names."
334 (package (inherit gcc-4.8)
335 (name (string-append (package-name gcc) "-wrapped"))
337 (build-system trivial-build-system)
340 `(#:guile ,%bootstrap-guile
341 #:modules ((guix build utils))
343 (use-modules (guix build utils))
345 (let* ((binutils (assoc-ref %build-inputs "binutils"))
346 (gcc (assoc-ref %build-inputs "gcc"))
347 (libc (assoc-ref %build-inputs "libc"))
348 (bash (assoc-ref %build-inputs "bash"))
349 (out (assoc-ref %outputs "out"))
350 (bindir (string-append out "/bin"))
351 (triplet ,(boot-triplet)))
352 (define (wrap-program program)
353 ;; GCC-BOOT0 is a libc-less cross-compiler, so it
354 ;; needs to be told where to find the crt files and
355 ;; the dynamic linker.
356 (call-with-output-file program
358 (format p "#!~a/bin/bash
359 exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
363 ,(glibc-dynamic-linker))))
365 (chmod program #o555))
368 (with-directory-excursion bindir
369 (for-each (lambda (tool)
370 (symlink (string-append binutils "/bin/"
374 (for-each wrap-program '("gcc" "g++")))))))
376 `(("binutils" ,binutils)
383 ;; XXX: This Bison is needed to rebuild Bash's parser, which is modified by
384 ;; its CVE patches. Remove it when it's no longer needed.
385 (let* ((m4 (package-with-bootstrap-guile
386 (package-with-explicit-inputs m4 %boot0-inputs
387 (current-source-location)
388 #:guile %bootstrap-guile)))
389 (bison (package (inherit bison)
390 (native-inputs `(("perl" ,perl-boot0)))
391 (propagated-inputs `(("m4" ,m4)))
392 (inputs '()) ;remove Flex...
393 (arguments '(#:tests? #f))))) ;... and thus disable tests
394 (package-with-bootstrap-guile
395 (package-with-explicit-inputs bison %boot0-inputs
396 (current-source-location)
397 #:guile %bootstrap-guile))))
399 (define static-bash-for-glibc
400 ;; A statically-linked Bash to be embedded in GLIBC-FINAL, for use by
402 (let* ((gcc (cross-gcc-wrapper gcc-boot0 binutils-boot0
403 glibc-final-with-bootstrap-bash
404 (car (assoc-ref %boot1-inputs "bash"))))
405 (bash (package (inherit bash-light)
406 (native-inputs `(("bison" ,bison-boot1)))
408 `(#:guile ,%bootstrap-guile
409 ,@(package-arguments bash-light))))))
410 (package-with-bootstrap-guile
411 (package-with-explicit-inputs (static-package bash)
413 ("libc" ,glibc-final-with-bootstrap-bash)
414 ,@(fold alist-delete %boot1-inputs
416 (current-source-location)))))
418 (define gettext-boot0
419 ;; A minimal gettext used during bootstrap.
420 (let ((gettext-minimal
421 (package (inherit gnu-gettext)
422 (name "gettext-boot0")
423 (inputs '()) ;zero dependencies
425 (substitute-keyword-arguments
427 ,@(package-arguments gnu-gettext))
429 `(modify-phases ,phases
430 ;; Build only the tools.
431 (add-after 'unpack 'chdir
433 (chdir "gettext-tools")))
435 ;; Some test programs require pthreads, which we don't have.
436 (add-before 'configure 'no-test-programs
438 (substitute* "tests/Makefile.in"
443 ;; Don't try to link against libexpat.
445 (delete 'patch-tests))))))))
446 (package-with-bootstrap-guile
447 (package-with-explicit-inputs gettext-minimal
449 (current-source-location)
450 #:guile %bootstrap-guile))))
452 (define-public glibc-final
453 ;; The final glibc, which embeds the statically-linked Bash built above.
454 (package (inherit glibc-final-with-bootstrap-bash)
456 (inputs `(("static-bash" ,static-bash-for-glibc)
459 (package-inputs glibc-final-with-bootstrap-bash))))
461 ;; This time we need 'msgfmt' to install all the libc.mo files.
462 (native-inputs `(,@(package-native-inputs glibc-final-with-bootstrap-bash)
463 ("gettext" ,gettext-boot0)))
465 ;; The final libc only refers to itself, but the 'debug' output contains
466 ;; references to GCC-BOOT0 and to the Linux headers. XXX: Would be great
467 ;; if 'allowed-references' were per-output.
469 `(#:allowed-references
470 ,(cons* `(,gcc-boot0 "lib") (linux-libre-headers-boot0)
471 (package-outputs glibc-final-with-bootstrap-bash))
473 ,@(package-arguments glibc-final-with-bootstrap-bash)))))
475 (define gcc-boot0-wrapped
476 ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
478 (cross-gcc-wrapper gcc-boot0 binutils-boot0 glibc-final
479 (car (assoc-ref %boot1-inputs "bash"))))
481 (define %boot2-inputs
483 `(("libc" ,glibc-final)
484 ("gcc" ,gcc-boot0-wrapped)
485 ,@(fold alist-delete %boot1-inputs '("libc" "gcc"))))
487 (define binutils-final
488 (package-with-bootstrap-guile
489 (package (inherit binutils)
491 `(#:guile ,%bootstrap-guile
492 #:implicit-inputs? #f
493 #:allowed-references ("out" ,glibc-final)
494 ,@(package-arguments binutils)))
495 (inputs %boot2-inputs))))
498 ;; Intermediate libstdc++ that will allow us to build the final GCC
499 ;; (remember that GCC-BOOT0 cannot build libstdc++.)
500 (package-with-bootstrap-guile
501 (package (inherit gcc-4.8)
504 `(#:guile ,%bootstrap-guile
505 #:implicit-inputs? #f
508 #:phases (alist-cons-before
511 (chdir "libstdc++-v3"))
513 #:configure-flags `("--disable-shared"
514 "--disable-libstdcxx-threads"
515 "--disable-libstdcxx-pch"
516 ,(string-append "--with-gxx-include-dir="
517 (assoc-ref %outputs "out")
520 ;; ,(package-version gcc-4.8)
523 (inputs %boot2-inputs)
525 (propagated-inputs '())
526 (synopsis "GNU C++ standard library (intermediate)"))))
528 (define-public gcc-final
530 (package (inherit gcc-boot0)
533 `(#:guile ,%bootstrap-guile
534 #:implicit-inputs? #f
536 #:allowed-references ("out" "lib" ,glibc-final)
538 ;; Things like libasan.so and libstdc++.so NEED ld.so for some
539 ;; reason, but it is not in their RUNPATH. This is a false
540 ;; positive, so turn it off.
541 #:validate-runpath? #f
543 ;; Build again GMP & co. within GCC's build process, because it's hard
544 ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
545 ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
546 ,@(substitute-keyword-arguments (package-arguments gcc-boot0)
547 ((#:configure-flags boot-flags)
548 (let loop ((args (package-arguments gcc-4.8)))
550 ((#:configure-flags normal-flags _ ...)
554 ((#:make-flags flags)
555 ;; Since $LIBRARY_PATH and $CPATH are not honored, add the
557 `(cons (string-append "CPPFLAGS=-I"
558 (assoc-ref %build-inputs "libstdc++")
561 (if (string-prefix? "LDFLAGS=" flag)
562 (string-append flag " -L"
563 (assoc-ref %build-inputs "libstdc++")
568 `(alist-delete 'symlink-libgcc_eh ,phases)))))
570 ;; This time we want Texinfo, so we get the manual.
571 (native-inputs `(("texinfo" ,texinfo-boot0)
572 ,@(package-native-inputs gcc-boot0)))
574 (inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp)))
575 ("mpfr-source" ,(package-source mpfr))
576 ("mpc-source" ,(package-source mpc))
577 ("binutils" ,binutils-final)
578 ("libstdc++" ,libstdc++)
581 (define ld-wrapper-boot3
582 ;; A linker wrapper that uses the bootstrap Guile.
583 (make-ld-wrapper "ld-wrapper-boot3"
584 #:binutils binutils-final
585 #:guile %bootstrap-guile
586 #:bash (car (assoc-ref %boot2-inputs "bash"))))
588 (define %boot3-inputs
591 ("ld-wrapper" ,ld-wrapper-boot3)
592 ,@(alist-delete "gcc" %boot2-inputs)))
595 ;; Link with `-static-libgcc' to make sure we don't retain a reference
596 ;; to the bootstrap GCC.
597 (package-with-bootstrap-guile
598 (package-with-explicit-inputs (static-libgcc-package bash)
600 (current-source-location)
601 #:guile %bootstrap-guile)))
603 (define %boot4-inputs
604 ;; Now use the final Bash.
605 `(("bash" ,bash-final)
606 ,@(alist-delete "bash" %boot3-inputs)))
608 (define-public guile-final
609 (package-with-bootstrap-guile
610 (package-with-explicit-inputs guile-2.0/fixed
612 (current-source-location)
613 #:guile %bootstrap-guile)))
615 (define-public glibc-utf8-locales-final
616 ;; Now that we have GUILE-FINAL, build the UTF-8 locales. They are needed
617 ;; by the build processes afterwards so their 'scm_to_locale_string' works
618 ;; with the full range of Unicode codepoints (remember
619 ;; 'scm_to_locale_string' is called every time a string is passed to a C
622 (inherit glibc-utf8-locales)
623 (inputs `(("glibc" ,glibc-final)
625 ,(package-with-explicit-inputs gzip %boot4-inputs
626 (current-source-location)
627 #:guile %bootstrap-guile))))))
629 (define %boot5-inputs
630 ;; Now with UTF-8 locale.
631 `(("locales" ,glibc-utf8-locales-final)
634 (define gnu-make-final
635 ;; The final GNU Make, which uses the final Guile.
636 (package-with-bootstrap-guile
637 (package-with-explicit-inputs gnu-make
638 `(("guile" ,guile-final)
640 (current-source-location))))
642 (define-public ld-wrapper
643 ;; The final `ld' wrapper, which uses the final Guile.
644 (package (inherit ld-wrapper-boot3)
646 (inputs `(("guile" ,guile-final)
648 ,@(fold alist-delete (package-inputs ld-wrapper-boot3)
649 '("guile" "bash"))))))
651 (define coreutils-final
652 ;; The final Coreutils. Treat them specially because some packages, such as
653 ;; Findutils, keep a reference to the Coreutils they were built with.
654 (package-with-bootstrap-guile
655 (package-with-explicit-inputs coreutils
657 (current-source-location)
659 ;; Use the final Guile, linked against the
660 ;; final libc with working iconv, so that
661 ;; 'substitute*' works well when touching
662 ;; test files in Gettext.
663 #:guile guile-final)))
666 ;; The final grep. Gzip holds a reference to it (via zgrep), so it must be
667 ;; built before gzip.
668 (package-with-bootstrap-guile
669 (package-with-explicit-inputs grep
671 (current-source-location)
672 #:guile guile-final)))
674 (define %boot6-inputs
675 ;; Now use the final Coreutils.
676 `(("coreutils" ,coreutils-final)
680 (define-public %final-inputs
681 ;; Final derivations used as implicit inputs by 'gnu-build-system'. We
682 ;; still use 'package-with-bootstrap-guile' so that the bootstrap tools are
683 ;; used for origins that have patches, thereby avoiding circular
685 (let ((finalize (compose package-with-bootstrap-guile
686 (cut package-with-explicit-inputs <> %boot6-inputs
687 (current-source-location)))))
688 `(,@(map (match-lambda
690 (list name (finalize package))))
696 ("diffutils" ,diffutils)
699 ("findutils" ,findutils)
702 ("coreutils" ,coreutils-final)
703 ("make" ,gnu-make-final)
705 ("ld-wrapper" ,ld-wrapper)
706 ("binutils" ,binutils-final)
708 ("libc" ,glibc-final)
709 ("locales" ,glibc-utf8-locales-final))))
711 (define-public canonical-package
712 (let ((name->package (fold (lambda (input result)
715 (vhash-cons (package-full-name package)
718 `(("guile" ,guile-final)
721 "Return the 'canonical' variant of PACKAGE---i.e., if PACKAGE is one of
722 the implicit inputs of 'gnu-build-system', return that one, otherwise return
725 The goal is to avoid duplication in cases like GUILE-FINAL vs. GUILE-2.0,
726 COREUTILS-FINAL vs. COREUTILS, etc."
727 ;; XXX: This doesn't handle dependencies of the final inputs, such as
728 ;; libunistring, GMP, etc.
729 (match (vhash-assoc (package-full-name package) name->package)
731 ;; In general we want CANON, except if we're cross-compiling: CANON
732 ;; uses explicit inputs, so it is "anchored" in the bootstrapped
733 ;; process, with dependencies on things that cannot be
735 (if (%current-target-system)
745 (define (gcc-toolchain gcc)
746 "Return a complete toolchain for GCC."
748 (name "gcc-toolchain")
749 (version (package-version gcc))
751 (build-system trivial-build-system)
753 '(#:modules ((guix build union))
755 (use-modules (ice-9 match)
759 (let ((out (assoc-ref %outputs "out")))
762 (((names . directories) ...)
763 (union-build out directories)))
765 ;; Remove the 'sh' and 'bash' binaries that come with
766 ;; libc to avoid polluting the user's profile (these are
767 ;; statically-linked binaries with no locale support and
769 (for-each (lambda (file)
770 (delete-file (string-append out "/bin/" file)))
773 (union-build (assoc-ref %outputs "debug")
774 (list (assoc-ref %build-inputs
777 (native-search-paths (package-native-search-paths gcc))
778 (search-paths (package-search-paths gcc))
780 (license (package-license gcc))
781 (synopsis "Complete GCC tool chain for C/C++ development")
783 "This package provides a complete GCC tool chain for C/C++ development to
784 be installed in user profiles. This includes GCC, as well as libc (headers
785 and binaries, plus debugging symbols in the 'debug' output), and Binutils.")
786 (home-page "http://gcc.gnu.org/")
787 (outputs '("out" "debug"))
789 ;; The main raison d'être of this "meta-package" is (1) to conveniently
790 ;; install everything that we need, and (2) to make sure ld-wrapper comes
791 ;; before Binutils' ld in the user's profile.
792 (inputs `(("gcc" ,gcc)
793 ("ld-wrapper" ,(car (assoc-ref %final-inputs "ld-wrapper")))
794 ("binutils" ,binutils-final)
795 ("libc" ,glibc-final)
796 ("libc-debug" ,glibc-final "debug")))))
798 (define-public gcc-toolchain-4.8
799 (gcc-toolchain gcc-final))
801 (define-public gcc-toolchain-4.9
802 (gcc-toolchain gcc-4.9))
804 (define-public gcc-toolchain-5.1
805 (gcc-toolchain gcc-5.1))
807 ;;; commencement.scm ends here