aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnu-system.am4
-rw-r--r--gnu/packages/autotools.scm7
-rw-r--r--gnu/packages/base.scm13
-rw-r--r--gnu/packages/commencement.scm66
-rw-r--r--gnu/packages/cross-base.scm2
-rw-r--r--gnu/packages/gcc.scm11
-rw-r--r--gnu/packages/ld-wrapper.in89
-rw-r--r--gnu/packages/ld-wrapper2.in207
-rw-r--r--gnu/packages/patches/perl-module-pluggable-search.patch25
-rw-r--r--gnu/packages/perl.scm4
-rw-r--r--guix/build-system/cmake.scm2
-rw-r--r--guix/build-system/glib-or-gtk.scm2
-rw-r--r--guix/build/gnu-build-system.scm12
-rw-r--r--guix/build/gremlin.scm36
-rw-r--r--tests/gremlin.scm12
15 files changed, 196 insertions, 296 deletions
diff --git a/gnu-system.am b/gnu-system.am
index ae6b4e2bab..820e1e1e79 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -504,6 +504,7 @@ dist_patch_DATA = \
gnu/packages/patches/patchutils-xfail-gendiff-tests.patch \
gnu/packages/patches/pavucontrol-sigsegv.patch \
gnu/packages/patches/perl-gd-options-passthrough-and-fontconfig.patch \
+ gnu/packages/patches/perl-module-pluggable-search.patch \
gnu/packages/patches/perl-net-amazon-s3-moose-warning.patch \
gnu/packages/patches/perl-no-sys-dirs.patch \
gnu/packages/patches/perl-tk-x11-discover.patch \
@@ -581,8 +582,7 @@ dist_patch_DATA = \
gnu/packages/patches/zathura-plugindir-environment-variable.patch
MISC_DISTRO_FILES = \
- gnu/packages/ld-wrapper.in \
- gnu/packages/ld-wrapper2.in
+ gnu/packages/ld-wrapper.in
bootstrapdir = $(guilemoduledir)/gnu/packages/bootstrap
bootstrap_x86_64_linuxdir = $(bootstrapdir)/x86_64-linux
diff --git a/gnu/packages/autotools.scm b/gnu/packages/autotools.scm
index bc2b20ed46..24ff90cc5c 100644
--- a/gnu/packages/autotools.scm
+++ b/gnu/packages/autotools.scm
@@ -303,12 +303,7 @@ complexity of working with shared libraries across platforms.")
version ".tar.xz"))
(sha256
(base32
- "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))
-
- ;; FIXME: We don't need this patch here, we just keep it to
- ;; avoid a rebuild today.
- (patches
- (list (search-patch "libtool-skip-tests.patch")))))
+ "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))))
(build-system gnu-build-system)
(arguments
'(#:configure-flags '("--enable-ltdl-install") ;really install it
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 361436157d..c6206fdce2 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -34,6 +34,7 @@
#:use-module (gnu packages linux)
#:use-module (gnu packages texinfo)
#:use-module (gnu packages pkg-config)
+ #:use-module (gnu packages gettext)
#:use-module (guix utils)
#:use-module (guix packages)
#:use-module (guix download)
@@ -568,9 +569,11 @@ store.")
(inputs `(("static-bash" ,(static-package bash-light))))
- ;; To build the manual, we need Texinfo and Perl.
+ ;; To build the manual, we need Texinfo and Perl. Gettext is needed to
+ ;; install the message catalogs, with 'msgfmt'.
(native-inputs `(("texinfo" ,texinfo)
- ("perl" ,perl)))
+ ("perl" ,perl)
+ ("gettext" ,gnu-gettext)))
(native-search-paths
;; Search path for packages that provide locale data. This is useful
@@ -689,7 +692,7 @@ command.")
(define-public tzdata
(package
(name "tzdata")
- (version "2015b")
+ (version "2015c")
(source (origin
(method url-fetch)
(uri (string-append
@@ -697,7 +700,7 @@ command.")
version ".tar.gz"))
(sha256
(base32
- "0qmdr1yqqn94b5a54axwszfzimyxg27i6xsfmp0sswd3nfjw2sjm"))))
+ "0nin48g5dmkfgckp25bngxchn3sw3yyjss5sq7gs5xspbxgsq3w6"))))
(build-system gnu-build-system)
(arguments
'(#:tests? #f
@@ -744,7 +747,7 @@ command.")
version ".tar.gz"))
(sha256
(base32
- "0xjxlgzva13y8qi3vfbb3nq5pii8ax9wi4yc7vj9134rbciz2s76"))))))
+ "0bplibiy70dvlrhwqzkzxgmg81j6d2kklvjgi2f1g2zz1nkb3vkz"))))))
(home-page "http://www.iana.org/time-zones")
(synopsis "Database of current and historical time zones")
(description "The Time Zone Database (often called tz or zoneinfo)
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 4a9fc5b205..da1b1ffd98 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -31,6 +31,7 @@
#:use-module (gnu packages gawk)
#:use-module (gnu packages bison)
#:use-module (gnu packages guile)
+ #:use-module (gnu packages gettext)
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages compression)
#:use-module (gnu packages perl)
@@ -157,8 +158,6 @@
(srfi srfi-1)
(srfi srfi-26))
,@(substitute-keyword-arguments (package-arguments gcc-4.8)
- ((#:validate-runpath? _)
- #t)
((#:configure-flags flags)
`(append (list ,(string-append "--target=" (boot-triplet))
@@ -418,6 +417,40 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
'("gcc" "libc")))
(current-source-location)))))
+(define gettext-boot0
+ ;; A minimal gettext used during bootstrap.
+ (let ((gettext-minimal
+ (package (inherit gnu-gettext)
+ (name "gettext-boot0")
+ (inputs '()) ;zero dependencies
+ (arguments
+ (substitute-keyword-arguments
+ `(#:tests? #f
+ ,@(package-arguments gnu-gettext))
+ ((#:phases phases)
+ `(modify-phases ,phases
+ ;; Build only the tools.
+ (add-after 'unpack 'chdir
+ (lambda _
+ (chdir "gettext-tools")))
+
+ ;; Some test programs require pthreads, which we don't have.
+ (add-before 'configure 'no-test-programs
+ (lambda _
+ (substitute* "tests/Makefile.in"
+ (("^PROGRAMS =.*$")
+ "PROGRAMS =\n"))
+ #t))
+
+ ;; Don't try to link against libexpat.
+ (delete 'link-expat)
+ (delete 'patch-tests))))))))
+ (package-with-bootstrap-guile
+ (package-with-explicit-inputs gettext-minimal
+ %boot1-inputs
+ (current-source-location)
+ #:guile %bootstrap-guile))))
+
(define-public glibc-final
;; The final glibc, which embeds the statically-linked Bash built above.
(package (inherit glibc-final-with-bootstrap-bash)
@@ -427,6 +460,10 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
"static-bash"
(package-inputs glibc-final-with-bootstrap-bash))))
+ ;; This time we need 'msgfmt' to install all the libc.mo files.
+ (native-inputs `(,@(package-native-inputs glibc-final-with-bootstrap-bash)
+ ("gettext" ,gettext-boot0)))
+
;; The final libc only refers to itself, but the 'debug' output contains
;; references to GCC-BOOT0 and to the Linux headers. XXX: Would be great
;; if 'allowed-references' were per-output.
@@ -501,6 +538,11 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
#:allowed-references ("out" "lib" ,glibc-final)
+ ;; Things like libasan.so and libstdc++.so NEED ld.so for some
+ ;; reason, but it is not in their RUNPATH. This is a false
+ ;; positive, so turn it off.
+ #:validate-runpath? #f
+
;; 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
;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
@@ -525,11 +567,6 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
"/lib")
flag))
,flags)))
- ((#:validate-runpath? _)
- ;; Things like libasan.so and libstdc++.so NEED ld.so and/or
- ;; libgcc_s.so but RUNPATH is empty. This is a false positive, so
- ;; turn it off.
- #f)
((#:phases phases)
`(alist-delete 'symlink-libgcc_eh ,phases)))))
@@ -708,19 +745,6 @@ COREUTILS-FINAL vs. COREUTILS, etc."
;;; GCC toolchain.
;;;
-(define (fixed-ld-wrapper)
- ;; FIXME: In this cycle, a bug was introduced in ld-wrapper: it would
- ;; incorrectly flag ~/.guix-profile/lib/libfoo.so as "impure", due to a bug
- ;; in its symlink resolution code. To work around that while avoiding a
- ;; full rebuild, use an ld-wrapper with the bug-fix for 'gcc-toolchain'.
- (let ((orig (car (assoc-ref %final-inputs "ld-wrapper"))))
- (package
- (inherit orig)
- (location (source-properties->location (current-source-location)))
- (inputs `(("wrapper" ,(search-path %load-path
- "gnu/packages/ld-wrapper2.in"))
- ,@(package-inputs orig))))))
-
(define (gcc-toolchain gcc)
"Return a complete toolchain for GCC."
(package
@@ -759,7 +783,7 @@ and binaries, plus debugging symbols in the 'debug' output), and Binutils.")
;; install everything that we need, and (2) to make sure ld-wrapper comes
;; before Binutils' ld in the user's profile.
(inputs `(("gcc" ,gcc)
- ("ld-wrapper" ,(fixed-ld-wrapper))
+ ("ld-wrapper" ,(car (assoc-ref %final-inputs "ld-wrapper")))
("binutils" ,binutils-final)
("libc" ,glibc-final)
("libc-debug" ,glibc-final "debug")))))
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 01cfdf73e8..9a459400e8 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -175,8 +175,6 @@ may be either a libc package or #f.)"
#t)))
,phases)
phases)))
- ((#:validate-runpath? _)
- #t)
((#:strip-binaries? _)
;; Disable stripping as this can break binaries, with object files of
;; libgcc.a showing up as having an unknown architecture. See
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index e712e43b1f..dbce52e2f2 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -190,10 +190,6 @@ where the OS part is overloaded to denote a specific ABI---into GCC
#:tests? #f
- ;; libstdc++.so NEEDs libgcc_s.so but somehow it doesn't get
- ;; $(libdir) in its RUNPATH, so turn it off.
- #:validate-runpath? #f
-
#:phases
(alist-cons-before
'configure 'pre-configure
@@ -252,6 +248,13 @@ where the OS part is overloaded to denote a specific ABI---into GCC
(("static char const sed_cmd_z\\[\\] =.*;")
"static char const sed_cmd_z[] = \"sed\";"))
+ ;; Add a RUNPATH to libstdc++.so so that it finds libgcc_s.
+ ;; See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32354>
+ ;; and <http://bugs.gnu.org/20358>.
+ (substitute* "libstdc++-v3/src/Makefile.in"
+ (("^OPT_LDFLAGS = ")
+ "OPT_LDFLAGS = -Wl,-rpath=$(libdir) "))
+
;; 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
diff --git a/gnu/packages/ld-wrapper.in b/gnu/packages/ld-wrapper.in
index 094018de3d..db662e7d76 100644
--- a/gnu/packages/ld-wrapper.in
+++ b/gnu/packages/ld-wrapper.in
@@ -92,34 +92,32 @@ exec @GUILE@ -c "(load-compiled \"@SELF@.go\") (apply $main (cdr (command-line))
(let loop ((file file)
(depth 0))
- (catch 'system-error
- (lambda ()
- (if (>= depth %max-symlink-depth)
- file
- (loop (readlink file) (+ depth 1))))
- (lambda args
- (if (= EINVAL (system-error-errno args))
- file
- (apply throw args))))))
-
-(define (dereference-symlinks file)
- ;; Same as 'readlink*' but return FILE if the symlink target is invalid or
- ;; FILE does not exist.
- (catch 'system-error
- (lambda ()
- ;; When used from a user environment, FILE may refer to
- ;; ~/.guix-profile/lib/libfoo.so, which is itself a symlink to the
- ;; store. Check whether this is the case.
- (readlink* file))
- (lambda args
- (if (= ENOENT (system-error-errno args))
- file
- (apply throw args)))))
+ (define (absolute target)
+ (if (absolute-file-name? target)
+ target
+ (string-append (dirname file) "/" target)))
+
+ (if (>= depth %max-symlink-depth)
+ file
+ (call-with-values
+ (lambda ()
+ (catch 'system-error
+ (lambda ()
+ (values #t (readlink file)))
+ (lambda args
+ (let ((errno (system-error-errno args)))
+ (if (or (= errno EINVAL) (= errno ENOENT))
+ (values #f file)
+ (apply throw args))))))
+ (lambda (success? target)
+ (if success?
+ (loop (absolute target) (+ depth 1))
+ file))))))
(define (pure-file-name? file)
;; Return #t when FILE is the name of a file either within the store
;; (possibly via a symlink) or within the build directory.
- (let ((file (dereference-symlinks file)))
+ (let ((file (readlink* file)))
(or (not (string-prefix? "/" file))
(string-prefix? %store-directory file)
(string-prefix? %temporary-directory file)
@@ -128,7 +126,7 @@ exec @GUILE@ -c "(load-compiled \"@SELF@.go\") (apply $main (cdr (command-line))
(define (store-file-name? file)
;; Return #t when FILE is a store file, possibly indirectly.
- (string-prefix? %store-directory (dereference-symlinks file)))
+ (string-prefix? %store-directory (readlink* file)))
(define (shared-library? file)
;; Return #t when FILE denotes a shared library.
@@ -142,34 +140,45 @@ exec @GUILE@ -c "(load-compiled \"@SELF@.go\") (apply $main (cdr (command-line))
(define (library-files-linked args)
;; Return the file names of shared libraries explicitly linked against via
;; `-l' or with an absolute file name in ARGS.
- (define path+files
+ (define path+files+args
(fold (lambda (argument result)
(match result
- ((library-path . library-files)
+ ((library-path library-files ("-dynamic-linker" . rest))
+ ;; When passed '-dynamic-linker ld.so', ignore 'ld.so'.
+ ;; See <http://bugs.gnu.org/20102>.
+ (list library-path
+ library-files
+ (cons* argument "-dynamic-linker" rest)))
+ ((library-path library-files previous-args)
(cond ((string-prefix? "-L" argument) ;augment the search path
- (cons (append library-path
+ (list (append library-path
(list (string-drop argument 2)))
- library-files))
+ library-files
+ (cons argument previous-args)))
((string-prefix? "-l" argument) ;add library
(let* ((lib (string-append "lib"
(string-drop argument 2)
".so"))
(full (search-path library-path lib)))
- (if full
- (cons library-path
- (cons full library-files))
- result)))
+ (list library-path
+ (if full
+ (cons full library-files)
+ library-files)
+ (cons argument previous-args))))
((and (string-prefix? %store-directory argument)
(shared-library? argument)) ;add library
- (cons library-path
- (cons argument library-files)))
+ (list library-path
+ (cons argument library-files)
+ (cons argument previous-args)))
(else
- result)))))
- (cons '() '())
+ (list library-path
+ library-files
+ (cons argument previous-args)))))))
+ (list '() '() '())
args))
- (match path+files
- ((path . files)
+ (match path+files+args
+ ((path files arguments)
(reverse files))))
(define (rpath-arguments library-files)
@@ -202,6 +211,8 @@ impure library ~s~%"
(args (append args (rpath-arguments libs))))
(when %debug?
(format (current-error-port)
+ "ld-wrapper: libraries linked: ~s~%" libs)
+ (format (current-error-port)
"ld-wrapper: invoking `~a' with ~s~%"
%real-ld args))
(apply execl %real-ld (basename %real-ld) args)))
diff --git a/gnu/packages/ld-wrapper2.in b/gnu/packages/ld-wrapper2.in
deleted file mode 100644
index f4ab17c59f..0000000000
--- a/gnu/packages/ld-wrapper2.in
+++ /dev/null
@@ -1,207 +0,0 @@
-#!@BASH@
-# -*- mode: scheme; coding: utf-8; -*-
-
-# XXX: We have to go through Bash because there's no command-line switch to
-# augment %load-compiled-path, and because of the silly 127-byte limit for
-# the shebang line in Linux.
-# Use `load-compiled' because `load' (and `-l') doesn't otherwise load our
-# .go file (see <http://bugs.gnu.org/12519>).
-
-main="(@ (gnu build-support ld-wrapper) ld-wrapper)"
-exec @GUILE@ -c "(load-compiled \"@SELF@.go\") (apply $main (cdr (command-line)))" "$@"
-!#
-;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
-;;;
-;;; This file is part of GNU Guix.
-;;;
-;;; GNU Guix is free software; you can redistribute it and/or modify it
-;;; under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 3 of the License, or (at
-;;; your option) any later version.
-;;;
-;;; GNU Guix is distributed in the hope that it will be useful, but
-;;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
-
-(define-module (gnu build-support ld-wrapper)
- #:use-module (srfi srfi-1)
- #:use-module (ice-9 match)
- #:export (ld-wrapper))
-
-;;; Commentary:
-;;;
-;;; This is a wrapper for the linker. Its purpose is to inspect the -L and
-;;; -l switches passed to the linker, add corresponding -rpath arguments, and
-;;; invoke the actual linker with this new set of arguments.
-;;;
-;;; The alternatives to this hack would be:
-;;;
-;;; 1. Using $LD_RUN_PATH. However, that would tend to include more than
-;;; needed in the RPATH; for instance, given a package with `libfoo' as
-;;; an input, all its binaries would have libfoo in their RPATH,
-;;; regardless of whether they actually NEED it.
-;;;
-;;; 2. Use a GCC "lib" spec string such as `%{L*:-rpath %*}', which adds a
-;;; `-rpath LIBDIR' argument for each occurrence of `-L LIBDIR'.
-;;; However, this doesn't work when $LIBRARY_PATH is used, because the
-;;; additional `-L' switches are not matched by the above rule, because
-;;; the rule only matches explicit user-provided switches. See
-;;; <http://gcc.gnu.org/ml/gcc-help/2012-09/msg00110.html> for details.
-;;;
-;;; As a bonus, this wrapper checks for "impurities"--i.e., references to
-;;; libraries outside the store.
-;;;
-;;; Code:
-
-(define %real-ld
- ;; Name of the linker that we wrap.
- "@LD@")
-
-(define %store-directory
- ;; File name of the store.
- (or (getenv "NIX_STORE") "/gnu/store"))
-
-(define %temporary-directory
- ;; Temporary directory.
- (or (getenv "TMPDIR") "/tmp"))
-
-(define %build-directory
- ;; Top build directory when run from a builder.
- (getenv "NIX_BUILD_TOP"))
-
-(define %allow-impurities?
- ;; Whether to allow references to libraries outside the store.
- (getenv "GUIX_LD_WRAPPER_ALLOW_IMPURITIES"))
-
-(define %debug?
- ;; Whether to emit debugging output.
- (getenv "GUIX_LD_WRAPPER_DEBUG"))
-
-(define %disable-rpath?
- ;; Whether to disable automatic '-rpath' addition.
- (getenv "GUIX_LD_WRAPPER_DISABLE_RPATH"))
-
-(define (readlink* file)
- ;; Call 'readlink' until the result is not a symlink.
- (define %max-symlink-depth 50)
-
- (let loop ((file file)
- (depth 0))
- (define (absolute target)
- (if (absolute-file-name? target)
- target
- (string-append (dirname file) "/" target)))
-
- (if (>= depth %max-symlink-depth)
- file
- (call-with-values
- (lambda ()
- (catch 'system-error
- (lambda ()
- (values #t (readlink file)))
- (lambda args
- (let ((errno (system-error-errno args)))
- (if (or (= errno EINVAL) (= errno ENOENT))
- (values #f file)
- (apply throw args))))))
- (lambda (success? target)
- (if success?
- (loop (absolute target) (+ depth 1))
- file))))))
-
-(define (pure-file-name? file)
- ;; Return #t when FILE is the name of a file either within the store
- ;; (possibly via a symlink) or within the build directory.
- (let ((file (readlink* file)))
- (or (not (string-prefix? "/" file))
- (string-prefix? %store-directory file)
- (string-prefix? %temporary-directory file)
- (and %build-directory
- (string-prefix? %build-directory file)))))
-
-(define (store-file-name? file)
- ;; Return #t when FILE is a store file, possibly indirectly.
- (string-prefix? %store-directory (readlink* file)))
-
-(define (shared-library? file)
- ;; Return #t when FILE denotes a shared library.
- (or (string-suffix? ".so" file)
- (let ((index (string-contains file ".so.")))
- ;; Since we cannot use regexps during bootstrap, roll our own.
- (and index
- (string-every (char-set-union (char-set #\.) char-set:digit)
- (string-drop file (+ index 3)))))))
-
-(define (library-files-linked args)
- ;; Return the file names of shared libraries explicitly linked against via
- ;; `-l' or with an absolute file name in ARGS.
- (define path+files
- (fold (lambda (argument result)
- (match result
- ((library-path . library-files)
- (cond ((string-prefix? "-L" argument) ;augment the search path
- (cons (append library-path
- (list (string-drop argument 2)))
- library-files))
- ((string-prefix? "-l" argument) ;add library
- (let* ((lib (string-append "lib"
- (string-drop argument 2)
- ".so"))
- (full (search-path library-path lib)))
- (if full
- (cons library-path
- (cons full library-files))
- result)))
- ((and (string-prefix? %store-directory argument)
- (shared-library? argument)) ;add library
- (cons library-path
- (cons argument library-files)))
- (else
- result)))))
- (cons '() '())
- args))
-
- (match path+files
- ((path . files)
- (reverse files))))
-
-(define (rpath-arguments library-files)
- ;; Return the `-rpath' argument list for each of LIBRARY-FILES, a list of
- ;; absolute file names.
- (fold-right (lambda (file args)
- ;; Add '-rpath' if and only if FILE is in the store; we don't
- ;; want to add '-rpath' for files under %BUILD-DIRECTORY or
- ;; %TEMPORARY-DIRECTORY because that could leak to installed
- ;; files.
- (cond ((and (not %disable-rpath?)
- (store-file-name? file))
- (cons* "-rpath" (dirname file) args))
- ((or %allow-impurities?
- (pure-file-name? file))
- args)
- (else
- (begin
- (format (current-error-port)
- "ld-wrapper: error: attempt to use \
-impure library ~s~%"
- file)
- (exit 1)))))
- '()
- library-files))
-
-(define (ld-wrapper . args)
- ;; Invoke the real `ld' with ARGS, augmented with `-rpath' switches.
- (let* ((libs (library-files-linked args))
- (args (append args (rpath-arguments libs))))
- (when %debug?
- (format (current-error-port)
- "ld-wrapper: invoking `~a' with ~s~%"
- %real-ld args))
- (apply execl %real-ld (basename %real-ld) args)))
-
-;;; ld-wrapper.scm ends here
diff --git a/gnu/packages/patches/perl-module-pluggable-search.patch b/gnu/packages/patches/perl-module-pluggable-search.patch
new file mode 100644
index 0000000000..bb2a57f7e5
--- /dev/null
+++ b/gnu/packages/patches/perl-module-pluggable-search.patch
@@ -0,0 +1,25 @@
+Fix core Perl module Module::Pluggable such that it can find plugins that live
+in symlinked directories.
+
+Patch borrowed/adapted from Nixpkgs.
+
+--- perl-5.16.1/cpan/Module-Pluggable/lib/Module/Pluggable/Object.pm 2015-04-08 23:28:48.120164135 -0500
++++ perl-5.16.1/cpan/Module-Pluggable/lib/Module/Pluggable/Object.pm 2015-04-08 23:30:27.032166704 -0500
+@@ -164,7 +164,7 @@
+ my $sp = catdir($dir, (split /::/, $searchpath));
+
+ # if it doesn't exist or it's not a dir then skip it
+- next unless ( -e $sp && -d _ ); # Use the cached stat the second time
++ next unless ( -e $sp );
+
+ my @files = $self->find_files($sp);
+
+@@ -279,7 +279,7 @@
+ (my $path = $File::Find::name) =~ s#^\\./##;
+ push @files, $path;
+ }
+- }, $search_path );
++ }, "$search_path/." );
+ }
+ #chdir $cwd;
+ return @files;
diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm
index e55eb8791d..80c476b2b1 100644
--- a/gnu/packages/perl.scm
+++ b/gnu/packages/perl.scm
@@ -44,7 +44,9 @@
(sha256
(base32
"15qxzba3a50c9nik5ydgyfp62x7h9vxxn12yd1jgl93hb1wj96km"))
- (patches (list (search-patch "perl-no-sys-dirs.patch")))))
+ (patches (map search-patch
+ '("perl-no-sys-dirs.patch"
+ "perl-module-pluggable-search.patch")))))
(build-system gnu-build-system)
(arguments
'(#:tests? #f
diff --git a/guix/build-system/cmake.scm b/guix/build-system/cmake.scm
index 2e6784251e..1bc1879be5 100644
--- a/guix/build-system/cmake.scm
+++ b/guix/build-system/cmake.scm
@@ -84,6 +84,7 @@
(tests? #t)
(test-target "test")
(parallel-build? #t) (parallel-tests? #f)
+ (validate-runpath? #t)
(patch-shebangs? #t)
(strip-binaries? #t)
(strip-flags ''("--strip-debug"))
@@ -121,6 +122,7 @@ provides a 'CMakeLists.txt' file as its build system."
#:test-target ,test-target
#:parallel-build? ,parallel-build?
#:parallel-tests? ,parallel-tests?
+ #:validate-runpath? ,validate-runpath?
#:patch-shebangs? ,patch-shebangs?
#:strip-binaries? ,strip-binaries?
#:strip-flags ,strip-flags
diff --git a/guix/build-system/glib-or-gtk.scm b/guix/build-system/glib-or-gtk.scm
index 85d01961a5..954c716893 100644
--- a/guix/build-system/glib-or-gtk.scm
+++ b/guix/build-system/glib-or-gtk.scm
@@ -127,6 +127,7 @@
(test-target "check")
(parallel-build? #t)
(parallel-tests? #t)
+ (validate-runpath? #t)
(patch-shebangs? #t)
(strip-binaries? #t)
(strip-flags ''("--strip-debug"))
@@ -175,6 +176,7 @@
#:test-target ,test-target
#:parallel-build? ,parallel-build?
#:parallel-tests? ,parallel-tests?
+ #:validate-runpath? ,validate-runpath?
#:patch-shebangs? ,patch-shebangs?
#:strip-binaries? ,strip-binaries?
#:strip-flags ,strip-flags
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index c60f8ba162..5062479360 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -164,7 +164,10 @@ files such as `.in' templates. Most scripts honor $SHELL and
$CONFIG_SHELL, but some don't, such as `mkinstalldirs' or Automake's
`missing' script."
(for-each patch-shebang
- (remove file-is-directory? (find-files "." ".*"))))
+ (remove (lambda (file)
+ (or (not (file-exists? file)) ;dangling symlink
+ (file-is-directory? file)))
+ (find-files "."))))
(define (patch-generated-file-shebangs . rest)
"Patch shebangs in generated files, including `SHELL' variables in
@@ -173,9 +176,10 @@ makefiles."
;; `configure'.
(for-each patch-shebang
(filter (lambda (file)
- (and (executable-file? file)
+ (and (file-exists? file)
+ (executable-file? file)
(not (file-is-directory? file))))
- (find-files "." ".*")))
+ (find-files ".")))
;; Patch `SHELL' in generated makefiles.
(for-each patch-makefile-SHELL (find-files "." "^(GNU)?[mM]akefile$")))
@@ -414,7 +418,7 @@ effects, such as displaying warnings or error messages."
(loop tail (and (pred head) result))))))
(define* (validate-runpath #:key
- validate-runpath?
+ (validate-runpath? #t)
(elf-directories '("lib" "lib64" "libexec"
"bin" "sbin"))
outputs #:allow-other-keys)
diff --git a/guix/build/gremlin.scm b/guix/build/gremlin.scm
index 30b06034dd..fed529b193 100644
--- a/guix/build/gremlin.scm
+++ b/guix/build/gremlin.scm
@@ -39,6 +39,7 @@
elf-dynamic-info-needed
elf-dynamic-info-rpath
elf-dynamic-info-runpath
+ expand-origin
validate-needed-in-runpath))
@@ -236,6 +237,30 @@ value of DT_NEEDED entries is a string.)"
(string-prefix? libc-lib lib))
%libc-libraries))
+(define (expand-variable str variable value)
+ "Replace occurrences of '$VARIABLE' or '${VARIABLE}' in STR with VALUE."
+ (define variables
+ (list (string-append "$" variable)
+ (string-append "${" variable "}")))
+
+ (let loop ((thing variables)
+ (str str))
+ (match thing
+ (()
+ str)
+ ((head tail ...)
+ (let ((index (string-contains str head))
+ (len (string-length head)))
+ (loop (if index variables tail)
+ (if index
+ (string-replace str value
+ index (+ index len))
+ str)))))))
+
+(define (expand-origin str directory)
+ "Replace occurrences of '$ORIGIN' in STR with DIRECTORY."
+ (expand-variable str "ORIGIN" directory))
+
(define* (validate-needed-in-runpath file
#:key (always-found? libc-library?))
"Return #t if all the libraries listed as FILE's 'DT_NEEDED' entries are
@@ -254,17 +279,18 @@ exceeds total size~%"
(let* ((elf (call-with-input-file file
(compose parse-elf get-bytevector-all)))
+ (expand (cute expand-origin <> (dirname file)))
(dyninfo (elf-dynamic-info elf)))
(when dyninfo
- (let* ((runpath (filter store-file-name?
- (elf-dynamic-info-runpath dyninfo)))
- (bogus (remove store-file-name?
- (elf-dynamic-info-runpath dyninfo)))
+ ;; XXX: In theory we should also expand $PLATFORM and $LIB, but these
+ ;; appear to be really unused.
+ (let* ((expanded (map expand (elf-dynamic-info-runpath dyninfo)))
+ (runpath (filter store-file-name? expanded))
+ (bogus (remove store-file-name? expanded))
(needed (remove always-found?
(elf-dynamic-info-needed dyninfo)))
(not-found (remove (cut search-path runpath <>)
needed)))
- ;; XXX: $ORIGIN is not supported.
(unless (null? bogus)
(format (current-error-port)
"~a: warning: RUNPATH contains bogus entries: ~s~%"
diff --git a/tests/gremlin.scm b/tests/gremlin.scm
index 225a72ff9f..dc9f78c21a 100644
--- a/tests/gremlin.scm
+++ b/tests/gremlin.scm
@@ -21,6 +21,7 @@
#:use-module (guix build utils)
#:use-module (guix build gremlin)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
#:use-module (srfi srfi-64)
#:use-module (rnrs io ports)
#:use-module (ice-9 match))
@@ -51,6 +52,17 @@
(string-take lib (string-contains lib ".so")))
(elf-dynamic-info-needed dyninfo))))))
+(test-equal "expand-origin"
+ '("OOO/../lib"
+ "OOO"
+ "../OOO/bar/OOO/baz"
+ "ORIGIN/foo")
+ (map (cut expand-origin <> "OOO")
+ '("$ORIGIN/../lib"
+ "${ORIGIN}"
+ "../${ORIGIN}/bar/$ORIGIN/baz"
+ "ORIGIN/foo")))
+
(test-end "gremlin")