summaryrefslogtreecommitdiff
path: root/gnu/packages/perl.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-04-06 15:10:12 +0200
committerLudovic Courtès <ludo@gnu.org>2016-04-06 22:24:13 +0200
commit81cea47d4a4c0054beb234004b990d6f514d0514 (patch)
treea07974e003b1b7ed1667042bcfca96510f6b03dd /gnu/packages/perl.scm
parent2a5739b4c0856721181e4e7ab4b747541a64efca (diff)
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.
Diffstat (limited to 'gnu/packages/perl.scm')
-rw-r--r--gnu/packages/perl.scm39
1 files changed, 29 insertions, 10 deletions
diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm
index 9bbcc8ffa4..41bcd7da84 100644
--- a/gnu/packages/perl.scm
+++ b/gnu/packages/perl.scm
@@ -86,15 +86,7 @@
"-Dinstallstyle=lib/perl5"
"-Duseshrplib"
(string-append "-Dlocincpth=" libc "/include")
- (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"))))))
+ (string-append "-Dloclibpth=" libc "/lib"))))))
(add-before
'strip 'make-shared-objects-writable
@@ -105,7 +97,34 @@
(lib (string-append out "/lib")))
(for-each (lambda (dso)
(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
(variable "PERL5LIB")
(files '("lib/perl5/site_perl")))))