gnu: gcc: Use the system zlib.

* gnu/packages/gcc.scm (gcc-4.7) <configure-flags>: Pass
'--with-system-zlib'.
* gnu/packages/commencement.scm (gcc-boot0)[arguments]: Remove
'--with-system-zlib' from the configure flags.
* gnu/packages/commencement.scm (zlib-final): New variable.
(gcc-final)[arguments]: Add ZLIB-FINAL to #:allowed-references.
Pass -L and -Wl,-rpath for zlib in LDFLAGS, as a configure flag.
[inputs]: Add LD-WRAPPER-BOOT3 and ZLIB-FINAL.
This commit is contained in:
Ludovic Courtès 2015-12-11 23:45:29 +01:00
parent 52cfd8cb54
commit 98bd851ee8
2 changed files with 34 additions and 16 deletions

View file

@ -204,7 +204,8 @@ (define gcc-boot0
"--disable-libssp" "--disable-libssp"
"--disable-libquadmath" "--disable-libquadmath"
"--disable-decimal-float") "--disable-decimal-float")
(remove (cut string-match "--enable-languages.*" <>) (remove (cut string-match
"--(with-system-zlib|enable-languages.*)" <>)
,flags))) ,flags)))
((#:phases phases) ((#:phases phases)
`(alist-cons-after `(alist-cons-after
@ -548,6 +549,25 @@ (define libstdc++
(propagated-inputs '()) (propagated-inputs '())
(synopsis "GNU C++ standard library (intermediate)")))) (synopsis "GNU C++ standard library (intermediate)"))))
(define zlib-final
;; Zlib used by GCC-FINAL.
(package-with-bootstrap-guile
(package
(inherit zlib)
(arguments
`(#:guile ,%bootstrap-guile
#:implicit-inputs? #f
#:allowed-references ("out" ,glibc-final)
,@(package-arguments zlib)))
(inputs %boot2-inputs))))
(define ld-wrapper-boot3
;; A linker wrapper that uses the bootstrap Guile.
(make-ld-wrapper "ld-wrapper-boot3"
#:binutils binutils-final
#:guile %bootstrap-guile
#:bash (car (assoc-ref %boot2-inputs "bash"))))
(define gcc-final (define gcc-final
;; The final GCC. ;; The final GCC.
(package (inherit gcc-boot0) (package (inherit gcc-boot0)
@ -562,7 +582,7 @@ (define gcc-final
`(#:guile ,%bootstrap-guile `(#:guile ,%bootstrap-guile
#:implicit-inputs? #f #:implicit-inputs? #f
#:allowed-references ("out" "lib" #:allowed-references ("out" "lib" ,zlib-final
,glibc-final ,static-bash-for-glibc) ,glibc-final ,static-bash-for-glibc)
;; Things like libasan.so and libstdc++.so NEED ld.so for some ;; Things like libasan.so and libstdc++.so NEED ld.so for some
@ -583,13 +603,15 @@ (define gcc-final
(loop rest))))) (loop rest)))))
((#:make-flags flags) ((#:make-flags flags)
;; Since $LIBRARY_PATH is not honored, add the relevant flags. ;; Since $LIBRARY_PATH is not honored, add the relevant flags.
`(map (lambda (flag) `(let ((zlib (assoc-ref %build-inputs "zlib")))
(map (lambda (flag)
(if (string-prefix? "LDFLAGS=" flag) (if (string-prefix? "LDFLAGS=" flag)
(string-append flag " -L" (string-append flag " -L"
(assoc-ref %build-inputs "libstdc++") (assoc-ref %build-inputs "libstdc++")
"/lib") "/lib -L" zlib "/lib -Wl,-rpath="
zlib "/lib")
flag)) flag))
,flags)) ,flags)))
((#:phases phases) ((#:phases phases)
`(alist-delete 'symlink-libgcc_eh ,phases))))) `(alist-delete 'symlink-libgcc_eh ,phases)))))
@ -604,17 +626,12 @@ (define gcc-final
(inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp))) (inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp)))
("mpfr-source" ,(package-source mpfr)) ("mpfr-source" ,(package-source mpfr))
("mpc-source" ,(package-source mpc)) ("mpc-source" ,(package-source mpc))
("ld-wrapper" ,ld-wrapper-boot3)
("binutils" ,binutils-final) ("binutils" ,binutils-final)
("libstdc++" ,libstdc++) ("libstdc++" ,libstdc++)
("zlib" ,zlib-final)
,@%boot2-inputs)))) ,@%boot2-inputs))))
(define ld-wrapper-boot3
;; A linker wrapper that uses the bootstrap Guile.
(make-ld-wrapper "ld-wrapper-boot3"
#:binutils binutils-final
#:guile %bootstrap-guile
#:bash (car (assoc-ref %boot2-inputs "bash"))))
(define %boot3-inputs (define %boot3-inputs
;; 4th stage inputs. ;; 4th stage inputs.
`(("gcc" ,gcc-final) `(("gcc" ,gcc-final)

View file

@ -97,6 +97,7 @@ (define-public gcc-4.7
'("--enable-plugin" '("--enable-plugin"
"--enable-languages=c,c++" "--enable-languages=c,c++"
"--disable-multilib" "--disable-multilib"
"--with-system-zlib"
;; No pre-compiled libstdc++ headers, to save space. ;; No pre-compiled libstdc++ headers, to save space.
"--disable-libstdcxx-pch" "--disable-libstdcxx-pch"