guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Ludovic Courtès
Subject: 05/07: gnu: perl: Do not retain references to GCC & co.
Date: Wed, 06 Apr 2016 20:40:30 +0000

civodul pushed a commit to branch core-updates
in repository guix.

commit 81cea47d4a4c0054beb234004b990d6f514d0514
Author: Ludovic Courtès <address@hidden>
Date:   Wed Apr 6 15:10:12 2016 +0200

    gnu: perl: Do not retain references to GCC & co.
    
    Fixes <http://bugs.gnu.org/23077>.
    Reported by David Thompson <address@hidden>.
    
    * 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.
---
 gnu/packages/commencement.scm |   33 ++++++++++++++++++---------------
 gnu/packages/perl.scm         |   39 +++++++++++++++++++++++++++++----------
 2 files changed, 47 insertions(+), 25 deletions(-)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 59a7c77..0d9133f 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -270,21 +270,24 @@
                 (name "perl-boot0")
                 (replacement #f)
                 (arguments
-                 (substitute-keyword-arguments (package-arguments perl)
-                   ((#:phases phases)
-                    `(modify-phases ,phases
-                       ;; Pthread support is missing in the bootstrap compiler
-                       ;; (broken spec file), so disable it.
-                       (add-before 'configure 'disable-pthreads
-                         (lambda _
-                           (substitute* "Configure"
-                             (("^libswanted=(.*)pthread" _ before)
-                              (string-append "libswanted=" before))))))))))))
-   (package-with-bootstrap-guile
-    (package-with-explicit-inputs perl
-                                  %boot0-inputs
-                                  (current-source-location)
-                                  #:guile %bootstrap-guile))))
+                 ;; At the very least, this must not depend on GCC & co.
+                 (let ((args `(#:disallowed-references
+                               ,(list %bootstrap-binutils))))
+                   (substitute-keyword-arguments (package-arguments perl)
+                     ((#:phases phases)
+                      `(modify-phases ,phases
+                         ;; Pthread support is missing in the bootstrap 
compiler
+                         ;; (broken spec file), so disable it.
+                         (add-before 'configure 'disable-pthreads
+                           (lambda _
+                             (substitute* "Configure"
+                               (("^libswanted=(.*)pthread" _ before)
+                                (string-append "libswanted=" 
before)))))))))))))
+    (package-with-bootstrap-guile
+     (package-with-explicit-inputs perl
+                                   %boot0-inputs
+                                   (current-source-location)
+                                   #:guile %bootstrap-guile))))
 
 (define (linux-libre-headers-boot0)
   "Return Linux-Libre header files for the bootstrap environment."
diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm
index 9bbcc8f..41bcd7d 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")))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]