gnu: perl: Do not retain references to GCC & co.

Fixes <http://bugs.gnu.org/23077>.
Reported by David Thompson <dthompson2@worcester.edu>.

* gnu/packages/perl.scm (perl)[arguments]: Add 'remove-extra-references'
phase.  Remove -Dlibpth and -Dplibpth from #:configure-flags.
* gnu/packages/commencement.scm (perl-boot0): Add #:disallowed-references.
This commit is contained in:
Ludovic Courtès 2016-04-06 15:10:12 +02:00
parent 2a5739b4c0
commit 81cea47d4a
2 changed files with 47 additions and 25 deletions

View File

@ -270,21 +270,24 @@
(name "perl-boot0") (name "perl-boot0")
(replacement #f) (replacement #f)
(arguments (arguments
(substitute-keyword-arguments (package-arguments perl) ;; At the very least, this must not depend on GCC & co.
((#:phases phases) (let ((args `(#:disallowed-references
`(modify-phases ,phases ,(list %bootstrap-binutils))))
;; Pthread support is missing in the bootstrap compiler (substitute-keyword-arguments (package-arguments perl)
;; (broken spec file), so disable it. ((#:phases phases)
(add-before 'configure 'disable-pthreads `(modify-phases ,phases
(lambda _ ;; Pthread support is missing in the bootstrap compiler
(substitute* "Configure" ;; (broken spec file), so disable it.
(("^libswanted=(.*)pthread" _ before) (add-before 'configure 'disable-pthreads
(string-append "libswanted=" before)))))))))))) (lambda _
(package-with-bootstrap-guile (substitute* "Configure"
(package-with-explicit-inputs perl (("^libswanted=(.*)pthread" _ before)
%boot0-inputs (string-append "libswanted=" before)))))))))))))
(current-source-location) (package-with-bootstrap-guile
#:guile %bootstrap-guile)))) (package-with-explicit-inputs perl
%boot0-inputs
(current-source-location)
#:guile %bootstrap-guile))))
(define (linux-libre-headers-boot0) (define (linux-libre-headers-boot0)
"Return Linux-Libre header files for the bootstrap environment." "Return Linux-Libre header files for the bootstrap environment."

View File

@ -86,15 +86,7 @@
"-Dinstallstyle=lib/perl5" "-Dinstallstyle=lib/perl5"
"-Duseshrplib" "-Duseshrplib"
(string-append "-Dlocincpth=" libc "/include") (string-append "-Dlocincpth=" libc "/include")
(string-append "-Dloclibpth=" libc "/lib") (string-append "-Dloclibpth=" libc "/lib"))))))
;; Force the library search path to contain only libc
;; because it is recorded in Config.pm and
;; Config_heavy.pl; we don't want to keep a reference
;; to everything that's in $LIBRARY_PATH at build
;; time (Binutils, bzip2, file, etc.)
(string-append "-Dlibpth=" libc "/lib")
(string-append "-Dplibpth=" libc "/lib"))))))
(add-before (add-before
'strip 'make-shared-objects-writable 'strip 'make-shared-objects-writable
@ -105,7 +97,34 @@
(lib (string-append out "/lib"))) (lib (string-append out "/lib")))
(for-each (lambda (dso) (for-each (lambda (dso)
(chmod dso #o755)) (chmod dso #o755))
(find-files lib "\\.so$")))))))) (find-files lib "\\.so$")))))
(add-after 'install 'remove-extra-references
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(libc (assoc-ref inputs "libc"))
(config1 (car (find-files (string-append out "/lib/perl5")
"^Config_heavy\\.pl$")))
(config2 (find-files (string-append out "/lib/perl5")
"^Config\\.pm$")))
;; Force the library search path to contain only libc because
;; it is recorded in Config.pm and Config_heavy.pl; we don't
;; want to keep a reference to everything that's in
;; $LIBRARY_PATH at build time (GCC, Binutils, bzip2, file,
;; etc.)
(substitute* config1
(("^incpth=.*$")
(string-append "incpth='" libc "/include'\n"))
(("^(libpth|plibpth|libspath)=.*$" _ variable)
(string-append variable "='" libc "/lib'\n")))
(for-each (lambda (file)
(substitute* config2
(("libpth => .*$")
(string-append "libpth => '" libc
"/lib',\n"))))
config2)
#t))))))
(native-search-paths (list (search-path-specification (native-search-paths (list (search-path-specification
(variable "PERL5LIB") (variable "PERL5LIB")
(files '("lib/perl5/site_perl"))))) (files '("lib/perl5/site_perl")))))