gnu: gcc: Add a "lib" output.

* gnu/packages/gcc.scm (gcc-4.7)[configure-flags]: Add
  --with-gxx-include-dir.
  [outputs]: New field.
  [arguments] <phases>: Adjust to use the "lib" output.  Add
  'substitute*' calls for "libstdc++-v3/python/Makefile.in" and
  "gcc/config.in".
* gnu/packages/base.scm (gcc-boot0) <symlink-libgcc_eh>: Use the "lib"
  output.
  (cross-gcc-wrapper): Add 'outputs' field.
  (glibc-final)[arguments]: Adjust #:allowed-references to list
  '(GCC-BOOT0 "lib").
  (libstdc++): Add 'outputs' field.
  (gcc-final)[arguments]: Add "lib" to #:allowed-references.
* gnu/packages/make-bootstrap.scm (%gcc-static): Add 'outputs' field.
This commit is contained in:
Ludovic Courtès 2014-06-09 11:58:43 +02:00
parent e0a0c84b4f
commit 84e6756c57
3 changed files with 42 additions and 7 deletions

View File

@ -741,7 +741,7 @@ identifier SYSTEM."
(alist-cons-after (alist-cons-after
'install 'symlink-libgcc_eh 'install 'symlink-libgcc_eh
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))) (let ((out (assoc-ref outputs "lib")))
;; Glibc wants to link against libgcc_eh, so provide ;; Glibc wants to link against libgcc_eh, so provide
;; it. ;; it.
(with-directory-excursion (with-directory-excursion
@ -866,6 +866,7 @@ that makes it available under the native tool names."
(name (string-append (package-name gcc) "-wrapped")) (name (string-append (package-name gcc) "-wrapped"))
(source #f) (source #f)
(build-system trivial-build-system) (build-system trivial-build-system)
(outputs '("out"))
(arguments (arguments
`(#:guile ,%bootstrap-guile `(#:guile ,%bootstrap-guile
#:modules ((guix build utils)) #:modules ((guix build utils))
@ -941,7 +942,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
;; if 'allowed-references' were per-output. ;; if 'allowed-references' were per-output.
(arguments (arguments
`(#:allowed-references `(#:allowed-references
,(cons* gcc-boot0 (linux-libre-headers-boot0) ,(cons* `(,gcc-boot0 "lib") (linux-libre-headers-boot0)
(package-outputs glibc-final-with-bootstrap-bash)) (package-outputs glibc-final-with-bootstrap-bash))
,@(package-arguments glibc-final-with-bootstrap-bash))))) ,@(package-arguments glibc-final-with-bootstrap-bash)))))
@ -993,6 +994,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
;; "/include/c++/" ;; "/include/c++/"
;; ,(package-version gcc-4.8) ;; ,(package-version gcc-4.8)
)))) ))))
(outputs '("out"))
(inputs %boot2-inputs) (inputs %boot2-inputs)
(native-inputs '()) (native-inputs '())
(propagated-inputs '()) (propagated-inputs '())
@ -1007,7 +1009,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
`(#:guile ,%bootstrap-guile `(#:guile ,%bootstrap-guile
#:implicit-inputs? #f #:implicit-inputs? #f
#:allowed-references ("out" ,glibc-final) #:allowed-references ("out" "lib" ,glibc-final)
;; Build again GMP & co. within GCC's build process, because it's hard ;; Build again GMP & co. within GCC's build process, because it's hard
;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus

View File

@ -79,6 +79,14 @@ where the OS part is overloaded to denote a specific ABI---into GCC
"--with-local-prefix=/no-gcc-local-prefix" "--with-local-prefix=/no-gcc-local-prefix"
;; With a separate "lib" output, the build system
;; incorrectly guesses GPLUSPLUS_INCLUDE_DIR, so force
;; it. (Don't use a versioned sub-directory, that's
;; unnecessary.)
,(string-append "--with-gxx-include-dir="
(assoc-ref %outputs "out")
"/include/c++")
,(let ((libc (assoc-ref %build-inputs "libc"))) ,(let ((libc (assoc-ref %build-inputs "libc")))
(if libc (if libc
(string-append "--with-native-system-header-dir=" libc (string-append "--with-native-system-header-dir=" libc
@ -103,6 +111,12 @@ where the OS part is overloaded to denote a specific ABI---into GCC
(base32 (base32
"1hx9h64ivarlzi4hxvq42as5m9vlr5cyzaaq4gzj4i619zmkfz1g")))) "1hx9h64ivarlzi4hxvq42as5m9vlr5cyzaaq4gzj4i619zmkfz1g"))))
(build-system gnu-build-system) (build-system gnu-build-system)
;; Separate out the run-time support libraries because all the
;; dynamic-linked objects depend on it.
(outputs '("out" ; commands, etc. (60+ MiB)
"lib")) ; libgcc_s, libgomp, etc. (15+ MiB)
(inputs `(("gmp" ,gmp) (inputs `(("gmp" ,gmp)
("mpfr" ,mpfr) ("mpfr" ,mpfr)
("mpc" ,mpc) ("mpc" ,mpc)
@ -143,8 +157,9 @@ where the OS part is overloaded to denote a specific ABI---into GCC
(alist-cons-before (alist-cons-before
'configure 'pre-configure 'configure 'pre-configure
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")) (let ((libdir (or (assoc-ref outputs "lib")
(libc (assoc-ref inputs "libc"))) (assoc-ref outputs "out")))
(libc (assoc-ref inputs "libc")))
(when libc (when libc
;; The following is not performed for `--without-headers' ;; The following is not performed for `--without-headers'
;; cross-compiler builds. ;; cross-compiler builds.
@ -170,7 +185,7 @@ where the OS part is overloaded to denote a specific ABI---into GCC
;; <http://sourceware.org/ml/libc-help/2013-11/msg00023.html>.) ;; <http://sourceware.org/ml/libc-help/2013-11/msg00023.html>.)
(format #f "#define GNU_USER_TARGET_LIB_SPEC \ (format #f "#define GNU_USER_TARGET_LIB_SPEC \
\"-L~a/lib %{!static:-rpath=~a/lib %{!static-libgcc:-rpath=~a/lib64 -rpath=~a/lib -lgcc_s}} \" ~a" \"-L~a/lib %{!static:-rpath=~a/lib %{!static-libgcc:-rpath=~a/lib64 -rpath=~a/lib -lgcc_s}} \" ~a"
libc libc out out suffix)) libc libc libdir libdir suffix))
(("#define GNU_USER_TARGET_STARTFILE_SPEC.*$" line) (("#define GNU_USER_TARGET_STARTFILE_SPEC.*$" line)
(format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\" (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
#define STANDARD_STARTFILE_PREFIX_2 \"\" #define STANDARD_STARTFILE_PREFIX_2 \"\"
@ -180,7 +195,24 @@ where the OS part is overloaded to denote a specific ABI---into GCC
;; Don't retain a dependency on the build-time sed. ;; Don't retain a dependency on the build-time sed.
(substitute* "fixincludes/fixincl.x" (substitute* "fixincludes/fixincl.x"
(("static char const sed_cmd_z\\[\\] =.*;") (("static char const sed_cmd_z\\[\\] =.*;")
"static char const sed_cmd_z[] = \"sed\";")))) "static char const sed_cmd_z[] = \"sed\";"))
;; Move libstdc++*-gdb.py to the "lib" output to avoid a
;; circularity between "out" and "lib". (Note:
;; --with-python-dir is useless because it imposes $(prefix) as
;; the parent directory.)
(substitute* "libstdc++-v3/python/Makefile.in"
(("pythondir = .*$")
(string-append "pythondir = " libdir "/share"
"/gcc-$(gcc_version)/python\n")))
;; Avoid another circularity between the outputs: this #define
;; ends up in auto-host.h in the "lib" output, referring to
;; "out". (This variable is used to augment cpp's search path,
;; but there's nothing useful to look for here.)
(substitute* "gcc/config.in"
(("PREFIX_INCLUDE_DIR")
"PREFIX_INCLUDE_DIR_isnt_necessary_here"))))
(alist-cons-after (alist-cons-after
'configure 'post-configure 'configure 'post-configure

View File

@ -393,6 +393,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
(package-with-relocatable-glibc (package-with-relocatable-glibc
(package (inherit gcc-4.8) (package (inherit gcc-4.8)
(name "gcc-static") (name "gcc-static")
(outputs '("out")) ; all in one
(arguments (arguments
`(#:modules ((guix build utils) `(#:modules ((guix build utils)
(guix build gnu-build-system) (guix build gnu-build-system)