summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-05-02 22:42:53 +0200
committerLudovic Courtès <ludo@gnu.org>2015-05-02 22:42:53 +0200
commitb9212a5455304661d1e969ced5df63aa9b6b761f (patch)
treee2857c8336cc1dbae087ba4717707bc24b4df2dd
parenta413bc8bd3c2c7d00d8d021a2224a59d26765dad (diff)
parent5f6887e839c10f0c905969d07baca4e03f453e82 (diff)
downloadguix-b9212a5455304661d1e969ced5df63aa9b6b761f.tar.gz
Merge branch 'core-updates'
-rw-r--r--build-aux/check-available-binaries.scm2
-rw-r--r--build-aux/hydra/gnu-system.scm4
-rwxr-xr-xbuild-aux/list-packages.scm6
-rw-r--r--etc/completion/bash/guix2
-rw-r--r--gnu-system.am6
-rw-r--r--gnu/packages/audio.scm24
-rw-r--r--gnu/packages/autotools.scm7
-rw-r--r--gnu/packages/base.scm13
-rw-r--r--gnu/packages/cmake.scm14
-rw-r--r--gnu/packages/commencement.scm66
-rw-r--r--gnu/packages/cross-base.scm2
-rw-r--r--gnu/packages/databases.scm2
-rw-r--r--gnu/packages/gcc.scm76
-rw-r--r--gnu/packages/gl.scm115
-rw-r--r--gnu/packages/gtk.scm14
-rw-r--r--gnu/packages/ld-wrapper.in89
-rw-r--r--gnu/packages/ld-wrapper2.in207
-rw-r--r--gnu/packages/patches/cmake-fix-tests.patch40
-rw-r--r--gnu/packages/patches/gcc-libvtv-runpath.patch15
-rw-r--r--gnu/packages/patches/perl-module-pluggable-search.patch25
-rw-r--r--gnu/packages/patches/qt5-conflicting-typedefs.patch70
-rw-r--r--gnu/packages/perl.scm4
-rw-r--r--gnu/packages/polkit.scm7
-rw-r--r--gnu/packages/qt.scm3
-rw-r--r--gnu/packages/rdf.scm22
-rw-r--r--gnu/packages/wxwidgets.scm3
-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--guix/packages.scm6
-rw-r--r--tests/gremlin.scm12
32 files changed, 494 insertions, 414 deletions
diff --git a/build-aux/check-available-binaries.scm b/build-aux/check-available-binaries.scm
index bc6207eb2a..04f88b7d0c 100644
--- a/build-aux/check-available-binaries.scm
+++ b/build-aux/check-available-binaries.scm
@@ -33,7 +33,7 @@
     (let* ((native (append-map (lambda (system)
                                  (map (cut package-derivation store <> system)
                                       (list %bootstrap-tarballs emacs)))
-                               %supported-systems))
+                               %hydra-supported-systems))
            (cross  (map (cut package-cross-derivation store
                              %bootstrap-tarballs <>)
                         '("mips64el-linux-gnuabi64")))
diff --git a/build-aux/hydra/gnu-system.scm b/build-aux/hydra/gnu-system.scm
index 9a47b4f423..c612ff1f12 100644
--- a/build-aux/hydra/gnu-system.scm
+++ b/build-aux/hydra/gnu-system.scm
@@ -210,10 +210,6 @@ valid."
              #f)))))
 
 
-(define %hydra-supported-systems
-  ;; This is the list of system types for which build slaves are available.
-  '("x86_64-linux" "i686-linux" "mips64el-linux"))
-
 ;;;
 ;;; Hydra entry point.
 ;;;
diff --git a/build-aux/list-packages.scm b/build-aux/list-packages.scm
index f3e4ac2846..c4f445291b 100755
--- a/build-aux/list-packages.scm
+++ b/build-aux/list-packages.scm
@@ -167,7 +167,11 @@ decreasing, is 1."
           ,system))
 
     `(div "status: "
-          ,(list-join (map url (package-transitive-supported-systems package))
+          ,(list-join (map url
+                           (lset-intersection
+                            string=?
+                            %hydra-supported-systems
+                            (package-transitive-supported-systems package)))
                       " ")))
 
   (define (package-logo name)
diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
index 2a3fa1201e..e4d9a497b3 100644
--- a/etc/completion/bash/guix
+++ b/etc/completion/bash/guix
@@ -35,7 +35,7 @@ _guix_complete_installed_package ()
 _guix_complete_option ()
 {
     local options="$(${COMP_WORDS[0]} ${COMP_WORDS[1]} --help \
-                            | grep '^  -' \
+                            | grep '^  \+-' \
                             | sed -e's/^.*--\([a-zA-Z0-9_-]\+\)\(=\?\).*/--\1\2/g' )"
     compopt -o nospace
     COMPREPLY=($(compgen -W "$options" -- "${COMP_WORDS[$word_count - 1]}"))
diff --git a/gnu-system.am b/gnu-system.am
index 60901a6bc2..26228fccfa 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -421,6 +421,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/gawk-shell.patch				\
   gnu/packages/patches/gcc-arm-link-spec-fix.patch		\
   gnu/packages/patches/gcc-cross-environment-variables.patch	\
+  gnu/packages/patches/gcc-libvtv-runpath.patch			\
   gnu/packages/patches/geoclue-config.patch			\
   gnu/packages/patches/ghostscript-runpath.patch		\
   gnu/packages/patches/gitolite-openssh-6.8-compat.patch	\
@@ -503,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		\
@@ -526,6 +528,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/python2-pygobject-2-gi-info-type-error-domain.patch \
   gnu/packages/patches/qt4-ldflags.patch			\
   gnu/packages/patches/qt4-tests.patch				\
+  gnu/packages/patches/qt5-conflicting-typedefs.patch		\
   gnu/packages/patches/qt5-runpath.patch			\
   gnu/packages/patches/ratpoison-shell.patch			\
   gnu/packages/patches/readline-link-ncurses.patch		\
@@ -580,8 +583,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/audio.scm b/gnu/packages/audio.scm
index 572155b386..6cba704b6d 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -520,7 +520,18 @@ synchronous execution of all clients, and low latency operation.")
     (arguments
      `(#:tests? #f  ; no check target
        #:configure-flags '("--dbus"
-                           "--alsa")))
+                           "--alsa")
+       #:phases
+       (modify-phases %standard-phases
+         (add-before
+          'configure 'set-linkflags
+          (lambda _
+            ;; Add $libdir to the RUNPATH of all the binaries.
+            (substitute* "wscript"
+              ((".*CFLAGS.*-Wall.*" m)
+               (string-append m
+                              "    conf.env.append_unique('LINKFLAGS',"
+                              "'-Wl,-rpath=" %output "/lib')\n"))))))))
     (inputs
      `(("alsa-lib" ,alsa-lib)
        ("dbus" ,dbus)
@@ -702,7 +713,16 @@ implementation of the Open Sound Control (OSC) protocol.")
               (base32
                "0aj2plkx56iar8vzjbq2l7hi7sp0ml99m0h44rgwai2x4vqkk2j2"))))
     (build-system waf-build-system)
-    (arguments `(#:tests? #f)) ; no check target
+    (arguments
+     `(#:tests? #f ; no check target
+       #:phases
+       (modify-phases %standard-phases
+         (add-before
+          'configure 'set-ldflags
+          (lambda* (#:key outputs #:allow-other-keys)
+            (setenv "LDFLAGS"
+                    (string-append "-Wl,-rpath="
+                                   (assoc-ref outputs "out") "/lib")))))))
     ;; required by lilv-0.pc
     (propagated-inputs
      `(("serd" ,serd)
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/cmake.scm b/gnu/packages/cmake.scm
index 1fb9241596..6f8b9f67e3 100644
--- a/gnu/packages/cmake.scm
+++ b/gnu/packages/cmake.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
+;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -35,7 +36,7 @@
 (define-public cmake
   (package
     (name "cmake")
-    (version "3.1.3")
+    (version "3.2.2")
     (source (origin
              (method url-fetch)
              (uri (string-append
@@ -43,11 +44,12 @@
                    (version-major+minor version)
                    "/cmake-" version ".tar.gz"))
              (sha256
-              (base32 "1l662p9lscbzx9s85y86cynb9fn1rb2alqg4584wqq9gibxd7x25"))
+              (base32 "0y3w83al0vh9ll7fnqm3nx7l8hsl85k8iv9abxb791q36rp4xsdd"))
              (patches (list (search-patch "cmake-fix-tests.patch")))))
     (build-system gnu-build-system)
     (arguments
      `(#:test-target "test"
+       #:parallel-tests? #f ; 3 test from RunCMake fails
        #:phases (alist-cons-before
                  'configure 'patch-bin-sh
                  (lambda _
@@ -66,7 +68,8 @@
                          "Utilities/cmbzip2/Makefile-libbz2_so"
                          "Utilities/Release/release_cmake.cmake"
                          "Utilities/cmlibarchive/libarchive/archive_write_set_format_shar.c"
-                         "Tests/CMakeLists.txt")
+                         "Tests/CMakeLists.txt"
+                         "Tests/RunCMake/File_Generate/RunCMakeTest.cmake")
                      (("/bin/sh") (which "sh"))))
                  (alist-cons-before
                   'configure 'set-paths
@@ -74,7 +77,9 @@
                     ;; Help cmake's bootstrap process to find system libraries
                     (begin
                       (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
-                      (setenv "CMAKE_INCLUDE_PATH" (getenv "CPATH"))))
+                      (setenv "CMAKE_INCLUDE_PATH" (getenv "CPATH"))
+                      ;; Get verbose output from failed tests
+                      (setenv "CTEST_OUTPUT_ON_FAILURE" "TRUE")))
                   (alist-replace
                    'configure
                    (lambda* (#:key outputs #:allow-other-keys)
@@ -83,6 +88,7 @@
                                "./configure"
                                (string-append "--prefix=" out)
                                "--system-libs"
+                               "--no-system-jsoncpp" ; not packaged yet
                                ;; By default, the man pages and other docs land
                                ;; in PREFIX/man and PREFIX/doc, but we want them
                                ;; in share/{man,doc}.  Note that unlike
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/databases.scm b/gnu/packages/databases.scm
index aa0aa0d49f..5daf7ecba1 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -191,8 +191,6 @@ Language.")
           'configure 'pre-configure
           (lambda _
             (setenv "CONFIG_SHELL" (which "sh"))
-            ;; XXX: libstdc++.so lacks RUNPATH for libgcc_s.so.
-            (setenv "LDFLAGS" "-lgcc_s")
             #t))
          (add-after
           'install 'post-install
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index e712e43b1f..957917bf0b 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
@@ -304,37 +307,43 @@ Go.  It also includes runtime support libraries for these languages.")
   (package (inherit gcc-4.7)
     (version "4.8.4")
     (source (origin
-             (method url-fetch)
-             (uri (string-append "mirror://gnu/gcc/gcc-"
-                                 version "/gcc-" version ".tar.bz2"))
-             (sha256
-              (base32
-               "15c6gwm6dzsaagamxkak5smdkf1rdfbqqjs9jdbrp3lbg4ism02a"))
-             (patches (list (search-patch "gcc-arm-link-spec-fix.patch")))))))
+              (method url-fetch)
+              (uri (string-append "mirror://gnu/gcc/gcc-"
+                                  version "/gcc-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "15c6gwm6dzsaagamxkak5smdkf1rdfbqqjs9jdbrp3lbg4ism02a"))
+
+              ;; ARM 'link' spec issue reported at
+              ;; <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65711> and
+              ;; <https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01387.html>.
+              (patches (list (search-patch "gcc-arm-link-spec-fix.patch")))))))
 
 (define-public gcc-4.9
-  (package (inherit gcc-4.7)
+  (package (inherit gcc-4.8)
     (version "4.9.2")
     (source (origin
-             (method url-fetch)
-             (uri (string-append "mirror://gnu/gcc/gcc-"
-                                 version "/gcc-" version ".tar.bz2"))
-             (sha256
-              (base32
-               "1pbjp4blk2ycaa6r3jmw4ky5f1s9ji3klbqgv8zs2sl5jn1cj810"))
-             (patches (list (search-patch "gcc-arm-link-spec-fix.patch")))))))
+              (method url-fetch)
+              (uri (string-append "mirror://gnu/gcc/gcc-"
+                                  version "/gcc-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "1pbjp4blk2ycaa6r3jmw4ky5f1s9ji3klbqgv8zs2sl5jn1cj810"))
+              (patches (map search-patch
+                            '("gcc-arm-link-spec-fix.patch"
+                              "gcc-libvtv-runpath.patch")))))))
 
 (define-public gcc-5.1
-  (package (inherit gcc-4.7)
+  (package (inherit gcc-4.9)
     (version "5.1.0")
     (source (origin
-             (method url-fetch)
-             (uri (string-append "mirror://gnu/gcc/gcc-"
-                                 version "/gcc-" version ".tar.bz2"))
-             (sha256
-              (base32
-               "1bd5vj4px3s8nlakbgrh38ynxq4s654m6nxz7lrj03mvkkwgvnmp"))
-             (patches (list (search-patch "gcc-arm-link-spec-fix.patch")))))))
+              (method url-fetch)
+              (uri (string-append "mirror://gnu/gcc/gcc-"
+                                  version "/gcc-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "1bd5vj4px3s8nlakbgrh38ynxq4s654m6nxz7lrj03mvkkwgvnmp"))
+              (patches (origin-patches (package-source gcc-4.9)))))))
 
 (define* (custom-gcc gcc name languages #:key (separate-lib-output? #t))
   "Return a custom version of GCC that supports LANGUAGES."
@@ -435,7 +444,18 @@ Go.  It also includes runtime support libraries for these languages.")
                   (string-append jvm "/lib/tools.jar")))
                (chmod target #o755)
                #t))
-           ,phases))))))
+           (alist-cons-after
+            'install 'remove-broken-or-conflicting-files
+            (lambda _
+              (let ((out (assoc-ref %outputs "out")))
+                (for-each
+                 delete-file
+                 (append (find-files (string-append out "/lib/jvm/jre/lib")
+                                     "libjawt.so")
+                         (find-files (string-append out "/bin")
+                                     ".*(c\\+\\+|cpp|g\\+\\+|gcc.*)"))))
+              #t)
+            ,phases)))))))
 
 (define ecj-bootstrap-4.8
   (origin
diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index e640f83756..afda76d792 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -21,11 +21,13 @@
 
 (define-module (gnu packages gl)
   #:use-module (ice-9 match)
+  #:use-module (guix build utils)
   #:use-module ((guix licenses) #:prefix l:)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
   #:use-module (guix packages)
+  #:use-module (guix utils)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages flex)
@@ -37,6 +39,7 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages guile)
+  #:use-module (gnu packages video)
   #:use-module (gnu packages xdisorg))
 
 (define-public glu
@@ -159,18 +162,35 @@ Polygon meshes, and Extruded polygon meshes")
 also known as DXTn or DXTC) for Mesa.")
     (license l:expat)))
 
+;;; Mesa needs LibVA headers to build its Gallium-based VA API implementation;
+;;; LibVA itself depends on Mesa.  We use the following to solve the circular
+;;; dependency.
+(define libva-without-mesa
+  ;; Delay to work around circular import problem.
+  (delay
+    (package
+      (inherit libva)
+      (name "libva-without-mesa")
+      (inputs (alist-delete "mesa" (package-inputs libva)))
+      (arguments
+       (strip-keyword-arguments
+        '(#:make-flags)
+        (substitute-keyword-arguments (package-arguments libva)
+          ((#:configure-flags flags)
+           '(list "--disable-glx" "--disable-egl"))))))))
+
 (define-public mesa
   (package
     (name "mesa")
-    (version "10.4.0")
+    (version "10.5.4")
     (source
       (origin
         (method url-fetch)
         (uri (string-append "ftp://ftp.freedesktop.org/pub/mesa/"
-                            version "/MesaLib-" version ".tar.bz2"))
+                            version "/mesa-" version ".tar.xz"))
         (sha256
          (base32
-          "069j4ck51hc70gryhw3z0rkyhhl0bnhbks4xg1wqqw56l7rxz9wq"))))
+          "00v89jna7m6r2w1yrnx09isc97r2bd1hkn4jib445n1078zp47mm"))))
     (build-system gnu-build-system)
     (propagated-inputs
       `(("glproto" ,glproto)
@@ -181,23 +201,21 @@ also known as DXTn or DXTC) for Mesa.")
         ("libxfixes" ,libxfixes)
         ("libxshmfence" ,libxshmfence)
         ("libxxf86vm" ,libxxf86vm)))
+    ;; TODO: Add vdpau.
     (inputs
       `(("udev" ,eudev)
         ("dri2proto" ,dri2proto)
         ("dri3proto" ,dri3proto)
         ("presentproto" ,presentproto)
         ("expat" ,expat)
+        ("libva" ,(force libva-without-mesa))
         ("libxml2" ,libxml2)
-        ;; TODO: Add 'libva'
         ;; TODO: Add 'libxml2-python' for OpenGL ES 1.1 and 2.0 support
+        ("libxvmc" ,libxvmc)
         ("makedepend" ,makedepend)
         ("s2tc" ,s2tc)))
     (native-inputs
-      `(("pkg-config" ,pkg-config)
-        ("gettext" ,gnu-gettext)
-        ("flex" ,flex)
-        ("bison" ,bison)
-        ("python" ,python-2))) ; incompatible with Python 3 (print syntax)
+      `(("pkg-config" ,pkg-config)))
     (arguments
      `(#:configure-flags
        '(;; drop r300 from default gallium drivers, as it requires llvm
@@ -219,51 +237,42 @@ also known as DXTn or DXTC) for Mesa.")
              (_
               '("--with-dri-drivers=nouveau,r200,radeon,swrast"))))
        #:phases (alist-cons-after
-                 'unpack 'add-missing-m4-files
+                 'unpack 'patch-create_test_cases
                  (lambda _
-                   ;; When these files are missing, make tries to rebuild
-                   ;; several parts of the build system.
-                   (zero? (system* "touch" "--date=@0"
-                                   "m4/libtool.m4" "m4/ltoptions.m4"
-                                   "m4/ltsugar.m4" "m4/ltversion.m4"
-                                   "m4/lt~obsolete.m4")))
-                 (alist-cons-after
-                  'unpack 'patch-create_test_cases
-                  (lambda _
-                    (substitute* "src/glsl/tests/lower_jumps/create_test_cases.py"
-                      (("/usr/bin/env bash") (which "bash"))))
-                  (alist-cons-before
-                   'build 'fix-dlopen-libnames
-                   (lambda* (#:key inputs outputs #:allow-other-keys)
-                     (let ((s2tc (assoc-ref inputs "s2tc"))
-                           (udev (assoc-ref inputs "udev"))
-                           (out (assoc-ref outputs "out")))
-                       ;; Remain agnostic to .so.X.Y.Z versions while doing
-                       ;; the substitutions so we're future-safe.
-                       (substitute*
-                           '("src/gallium/auxiliary/util/u_format_s3tc.c"
-                             "src/mesa/main/texcompress_s3tc.c")
-                         (("\"libtxc_dxtn\\.so")
-                          (string-append "\"" s2tc "/lib/libtxc_dxtn.so")))
-                       (substitute* "src/gallium/targets/egl-static/egl_st.c"
-                         (("\"libglapi\"")
-                          (string-append "\"" out "/lib/libglapi\"")))
-                       (substitute* "src/loader/loader.c"
-                         (("dlopen\\(\"libudev\\.so")
-                          (string-append "dlopen(\"" udev "/lib/libudev.so")))
-                       (substitute* "src/glx/dri_common.c"
-                         (("dlopen\\(\"libGL\\.so")
-                          (string-append "dlopen(\"" out "/lib/libGL.so")))
-                       (substitute* "src/egl/drivers/dri2/egl_dri2.c"
-                         (("\"libglapi\\.so")
-                          (string-append "\"" out "/lib/libglapi.so")))
-                       (substitute* "src/gbm/main/backend.c"
-                         ;; No need to patch the gbm_gallium_drm.so reference;
-                         ;; it's never installed since Mesa removed its
-                         ;; egl_gallium support.
-                         (("\"gbm_dri\\.so")
-                          (string-append "\"" out "/lib/dri/gbm_dri.so")))))
-                   %standard-phases)))))
+                   (substitute* "src/glsl/tests/lower_jumps/create_test_cases.py"
+                     (("/usr/bin/env bash") (which "bash"))))
+                 (alist-cons-before
+                  'build 'fix-dlopen-libnames
+                  (lambda* (#:key inputs outputs #:allow-other-keys)
+                    (let ((s2tc (assoc-ref inputs "s2tc"))
+                          (udev (assoc-ref inputs "udev"))
+                          (out (assoc-ref outputs "out")))
+                      ;; Remain agnostic to .so.X.Y.Z versions while doing
+                      ;; the substitutions so we're future-safe.
+                      (substitute*
+                          '("src/gallium/auxiliary/util/u_format_s3tc.c"
+                            "src/mesa/main/texcompress_s3tc.c")
+                        (("\"libtxc_dxtn\\.so")
+                         (string-append "\"" s2tc "/lib/libtxc_dxtn.so")))
+                      (substitute* "src/gallium/targets/egl-static/egl_st.c"
+                        (("\"libglapi\"")
+                         (string-append "\"" out "/lib/libglapi\"")))
+                      (substitute* "src/loader/loader.c"
+                        (("dlopen\\(\"libudev\\.so")
+                         (string-append "dlopen(\"" udev "/lib/libudev.so")))
+                      (substitute* "src/glx/dri_common.c"
+                        (("dlopen\\(\"libGL\\.so")
+                         (string-append "dlopen(\"" out "/lib/libGL.so")))
+                      (substitute* "src/egl/drivers/dri2/egl_dri2.c"
+                        (("\"libglapi\\.so")
+                         (string-append "\"" out "/lib/libglapi.so")))
+                      (substitute* "src/gbm/main/backend.c"
+                        ;; No need to patch the gbm_gallium_drm.so reference;
+                        ;; it's never installed since Mesa removed its
+                        ;; egl_gallium support.
+                        (("\"gbm_dri\\.so")
+                         (string-append "\"" out "/lib/dri/gbm_dri.so")))))
+                  %standard-phases))))
     (home-page "http://mesa3d.org/")
     (synopsis "OpenGL implementation")
     (description "Mesa is a free implementation of the OpenGL specification -
diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index 0f7ba863e8..8a5a3099bf 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -230,13 +230,21 @@ functions which were removed.")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://download.drobilla.net/ganv-"
-                                  version
-                                  ".tar.bz2"))
+                                  version ".tar.bz2"))
               (sha256
                (base32
                 "0g7s5mp14qgbfjdql0k1s8464r21g47ssn5dws6jazsnw6njhl0l"))))
     (build-system waf-build-system)
-    (arguments `(#:tests? #f)) ; no check target
+    (arguments
+     `(#:phases (alist-cons-before
+                 'configure 'set-ldflags
+                 (lambda* (#:key outputs #:allow-other-keys)
+                   ;; Allow 'bin/ganv_bench' to find libganv-1.so.
+                   (setenv "LDFLAGS"
+                           (string-append "-Wl,-rpath="
+                                          (assoc-ref outputs "out") "/lib")))
+                 %standard-phases)
+       #:tests? #f)) ; no check target
     (inputs
      `(("gtk" ,gtk+-2)
        ("gtkmm" ,gtkmm-2)))
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/cmake-fix-tests.patch b/gnu/packages/patches/cmake-fix-tests.patch
index 5327f3749a..f59e2cd625 100644
--- a/gnu/packages/patches/cmake-fix-tests.patch
+++ b/gnu/packages/patches/cmake-fix-tests.patch
@@ -1,6 +1,23 @@
---- a/Tests/CMakeLists.txt	2013-03-20 22:57:13.000000000 +0100
-+++ b/Tests/CMakeLists.txt	2013-03-20 22:58:02.000000000 +0100
-@@ -1706,16 +1706,17 @@
+--- cmake-3.2.2.orig/Tests/CMakeLists.txt	2015-04-14 01:09:00.000000000 +0800
++++ cmake-3.2.2/Tests/CMakeLists.txt	2015-04-28 15:02:34.913039742 +0800
+@@ -342,10 +342,12 @@
+   endif()
+ 
+   # run test for BundleUtilities on supported platforms/compilers
+-  if(MSVC OR
+-     MINGW OR
+-     CMAKE_SYSTEM_NAME MATCHES "Linux" OR
+-     CMAKE_SYSTEM_NAME MATCHES "Darwin")
++#  if(MSVC OR
++#     MINGW OR
++#     CMAKE_SYSTEM_NAME MATCHES "Linux" OR
++#     CMAKE_SYSTEM_NAME MATCHES "Darwin")
++# This test fails on Guix: skip it.
++  if(FALSE)
+   if(NOT "${CMAKE_GENERATOR}" STREQUAL "Watcom WMake")
+ 
+     add_test(BundleUtilities ${CMAKE_CTEST_COMMAND}
+@@ -2257,16 +2259,17 @@
      PASS_REGULAR_EXPRESSION "Could not find executable"
      FAIL_REGULAR_EXPRESSION "SegFault")
  
@@ -27,19 +44,4 @@
 +#    PASS_REGULAR_EXPRESSION "Upload\\.xml")
  
    configure_file(
-     "${CMake_SOURCE_DIR}/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in"
---- a/Utilities/cmcurl/CMakeLists.txt	2013-03-20 22:57:13.000000000 +0100
-+++ b/Utilities/cmcurl/CMakeLists.txt	2013-03-20 23:08:41.000000000 +0100
-@@ -729,8 +729,9 @@
- ADD_EXECUTABLE(LIBCURL Testing/curltest.c)
- TARGET_LINK_LIBRARIES(LIBCURL cmcurl ${CMAKE_DL_LIBS})
- 
--IF(CMAKE_CURL_TEST_URL)
--  ADD_TEST(curl LIBCURL ${CMAKE_CURL_TEST_URL})
--ENDIF(CMAKE_CURL_TEST_URL)
-+# This test requires network connectivity: skip it.
-+#IF(CMAKE_CURL_TEST_URL)
-+#  ADD_TEST(curl LIBCURL ${CMAKE_CURL_TEST_URL})
-+#ENDIF(CMAKE_CURL_TEST_URL)
- 
- INSTALL(FILES COPYING DESTINATION ${CMake_DOC_DEST}/cmcurl)
+     "${CMake_SOURCE_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake.in"
diff --git a/gnu/packages/patches/gcc-libvtv-runpath.patch b/gnu/packages/patches/gcc-libvtv-runpath.patch
new file mode 100644
index 0000000000..df74363c83
--- /dev/null
+++ b/gnu/packages/patches/gcc-libvtv-runpath.patch
@@ -0,0 +1,15 @@
+GCC 4.9 and later have libvtv and, just like libstdc++ (see
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32354), it doesn't
+have $libdir in its RUNPATH, but it NEEDs libgcc_s.  This patch
+fixes that.
+
+--- gcc-4.9.2/libvtv/Makefile.in	2014-10-30 09:28:58.000000000 +0100
++++ gcc-4.9.2/libvtv/Makefile.in	2015-04-30 09:51:04.161129705 +0200
+@@ -15,6 +15,7 @@
+ 
+ @SET_MAKE@
+ 
++AM_LDFLAGS = -Wl,-rpath=$(libdir)
+ 
+ VPATH = @srcdir@
+ pkgdatadir = $(datadir)/@PACKAGE@
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/patches/qt5-conflicting-typedefs.patch b/gnu/packages/patches/qt5-conflicting-typedefs.patch
new file mode 100644
index 0000000000..751452c2db
--- /dev/null
+++ b/gnu/packages/patches/qt5-conflicting-typedefs.patch
@@ -0,0 +1,70 @@
+See <https://bugreports.qt.io/browse/QTBUG-45205>.
+
+diff --git a/qtwebengine/src/core/chromium_gpu_helper.cpp b/qtwebengine/src/core/chromium_gpu_helper.cpp
+index c7c97e6..ef574ec 100644
+--- a/qtwebengine/src/core/chromium_gpu_helper.cpp
++++ b/qtwebengine/src/core/chromium_gpu_helper.cpp
+@@ -40,13 +40,15 @@
+ 
+ #include "chromium_gpu_helper.h"
+ 
+-#include "content/common/gpu/gpu_channel_manager.h"
+-#include "content/common/gpu/sync_point_manager.h"
+-#include "content/gpu/gpu_child_thread.h"
++// Including gpu/command_buffer headers before content/gpu headers makes sure that
++// guards are defined to prevent duplicate definition errors with forward declared
++// GL typedefs cascading through content header includes.
+ #include "gpu/command_buffer/service/mailbox_manager.h"
+ #include "gpu/command_buffer/service/texture_manager.h"
+ 
+-#include <QtGlobal> // We need this for the Q_OS_QNX define.
++#include "content/common/gpu/gpu_channel_manager.h"
++#include "content/common/gpu/sync_point_manager.h"
++#include "content/gpu/gpu_child_thread.h"
+ 
+ #ifdef Q_OS_QNX
+ #include "content/common/gpu/stream_texture_qnx.h"
+diff --git a/qtwebengine/src/core/gl_surface_qt.cpp b/qtwebengine/src/core/gl_surface_qt.cpp
+index 4fe2f21..5a27aa9 100644
+--- a/qtwebengine/src/core/gl_surface_qt.cpp
++++ b/qtwebengine/src/core/gl_surface_qt.cpp
+@@ -49,8 +49,6 @@
+ #include "base/logging.h"
+ #include "base/memory/scoped_ptr.h"
+ #include "content/common/gpu/image_transport_surface.h"
+-#include "content/common/gpu/gpu_channel_manager.h"
+-#include "content/common/gpu/gpu_command_buffer_stub.h"
+ #include "ui/gl/egl_util.h"
+ #include "ui/gl/gl_context.h"
+ #include "ui/gl/gl_implementation.h"
+@@ -544,7 +542,9 @@ GLSurface::CreateViewGLSurface(gfx::AcceleratedWidget window)
+ }  // namespace gfx
+ 
+ namespace content {
+-scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface(GpuChannelManager* manager, GpuCommandBufferStub* stub, const gfx::GLSurfaceHandle& handle)
++class GpuCommandBufferStub;
++class GpuChannelManager;
++scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface(GpuChannelManager*, GpuCommandBufferStub*, const gfx::GLSurfaceHandle&)
+ {
+     QT_NOT_USED
+     return scoped_refptr<gfx::GLSurface>();
+diff --git a/qtwebengine/src/3rdparty/chromium/gpu/command_buffer/common/gles2_cmd_format.h b/qtwebengine/src/3rdparty/chromium/gpu/command_buffer/common/gles2_cmd_format.h
+index 04a3dc3..506cf00 100644
+--- a/qtwebengine/src/3rdparty/chromium/gpu/command_buffer/common/gles2_cmd_format.h
++++ b/qtwebengine/src/3rdparty/chromium/gpu/command_buffer/common/gles2_cmd_format.h
+@@ -20,6 +20,7 @@
+ #include "gpu/command_buffer/common/cmd_buffer_common.h"
+ #include "gpu/command_buffer/common/gles2_cmd_ids.h"
+ 
++#ifndef GL_VERSION_1_5
+ // GL types are forward declared to avoid including the GL headers. The problem
+ // is determining which GL headers to include from code that is common to the
+ // client and service sides (GLES2 or one of several GL implementations).
+@@ -47,6 +48,7 @@ typedef signed long long int GLsizeiptr;
+ typedef khronos_intptr_t GLintptr;
+ typedef khronos_ssize_t  GLsizeiptr;
+ #endif
++#endif
+ 
+ namespace gpu {
+ namespace gles2 {
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/gnu/packages/polkit.scm b/gnu/packages/polkit.scm
index 572d52404b..be7302ed49 100644
--- a/gnu/packages/polkit.scm
+++ b/gnu/packages/polkit.scm
@@ -86,7 +86,12 @@ for unprivileged applications.")
     (native-inputs
       `(("pkg-config", pkg-config)))
     (arguments
-      `(#:tests? #f)) ; there is a test subdirectory, but no test target
+     `(#:configure-flags (list (string-append "-DCMAKE_INSTALL_RPATH="
+                                              (assoc-ref %outputs "out")
+                                              "/lib:"
+                                              (assoc-ref %outputs "out")
+                                              "/lib64"))
+       #:tests? #f)) ; there is a test subdirectory, but no test target
     (home-page "http://api.kde.org/kdesupport-api/polkit-qt-1-apidocs/")
     (synopsis "Qt frontend to the polkit library")
     (description "Polkit-qt is a library that lets developers use the
diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 8de1ffe398..3bc3145e8d 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -104,7 +104,8 @@ X11 (yet).")
              (sha256
               (base32
                "0q6qzakq8xihw91xv310qi3vyylq7x2bzdkjgy8sqxii2lgbjzhv"))
-             (patches (list (search-patch "qt5-runpath.patch")))
+             (patches (list (search-patch "qt5-conflicting-typedefs.patch")
+                            (search-patch "qt5-runpath.patch")))
              (snippet
               '(begin
                  ;; Remove broken symlinks.
diff --git a/gnu/packages/rdf.scm b/gnu/packages/rdf.scm
index 96a52fd93a..f26b021e50 100644
--- a/gnu/packages/rdf.scm
+++ b/gnu/packages/rdf.scm
@@ -243,7 +243,16 @@ and triple stores.")
               (base32
                "1gxbzqsm212wmn8qkdd3lbl6wbv7fwmaf9qh2nxa4yxjbr7mylb4"))))
     (build-system waf-build-system)
-    (arguments `(#:tests? #f)) ; no check target
+    (arguments
+     `(#:tests? #f ; no check target
+       #:phases
+       (modify-phases %standard-phases
+         (add-before
+          'configure 'set-ldflags
+          (lambda* (#:key outputs #:allow-other-keys)
+            (setenv "LDFLAGS"
+                    (string-append "-Wl,-rpath="
+                                   (assoc-ref outputs "out") "/lib")))))))
     (home-page "http://drobilla.net/software/serd/")
     (synopsis "Library for RDF syntax supporting Turtle and NTriples")
     (description
@@ -268,7 +277,16 @@ ideal (e.g. in LV2 implementations or embedded applications).")
               (base32
                "0rq7vafdv4vsxi6xk9zf5shr59w3kppdhqbj78185rz5gp9kh1dx"))))
     (build-system waf-build-system)
-    (arguments `(#:tests? #f)) ; no check target
+    (arguments
+     `(#:tests? #f ; no check target
+       #:phases
+       (modify-phases %standard-phases
+         (add-before
+          'configure 'set-ldflags
+          (lambda* (#:key outputs #:allow-other-keys)
+            (setenv "LDFLAGS"
+                    (string-append "-Wl,-rpath="
+                                   (assoc-ref outputs "out") "/lib")))))))
     (inputs
      `(("serd" ,serd)))
     (native-inputs
diff --git a/gnu/packages/wxwidgets.scm b/gnu/packages/wxwidgets.scm
index 1f80130198..ee270ff105 100644
--- a/gnu/packages/wxwidgets.scm
+++ b/gnu/packages/wxwidgets.scm
@@ -62,6 +62,9 @@
     (arguments
      '(#:configure-flags
        '("--with-regex=sys" "--with-libmspack" "--with-sdl")
+       #:make-flags
+       (list (string-append "LDFLAGS=-Wl,-rpath="
+                            (assoc-ref %outputs "out") "/lib"))
        ;; No 'check' target.
        #:tests? #f))
     (home-page "https://www.wxwidgets.org/")
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/guix/packages.scm b/guix/packages.scm
index 0e4cce17e1..a979f31a32 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -95,6 +95,7 @@
             package-grafts
 
             %supported-systems
+            %hydra-supported-systems
             supported-package?
 
             &package-error
@@ -210,6 +211,11 @@ corresponds to the arguments expected by `set-path-environment-variable'."
   ;; expect all packages to build successfully here.
   '("x86_64-linux" "i686-linux" "armhf-linux" "mips64el-linux"))
 
+(define %hydra-supported-systems
+  ;; This is the list of system types for which build slaves are available.
+  (delete "armhf-linux" %supported-systems))
+
+
 ;; A package.
 (define-record-type* <package>
   package make-package
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")