summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-12-04 00:29:19 +0100
committerLudovic Courtès <ludo@gnu.org>2013-12-04 00:29:19 +0100
commitdeed349b4a36d2feac200eb42190c8fb5e7c83c5 (patch)
tree1c40bd90c90e2197477306c24cc05fb153a27798
parent799dcdc48fb548932e1a878d22d54f5975ffc5e4 (diff)
downloadguix-deed349b4a36d2feac200eb42190c8fb5e7c83c5.tar.gz
gnu: libssh: Add $libdir to RUNPATH of libssh_threads.so.
* gnu/packages/ssh.scm (libssh)[arguments]: Add #:phases, #:modules, and
  #:imported-modules.
  [native-inputs]: New field.
-rw-r--r--gnu/packages/ssh.scm39
1 files changed, 35 insertions, 4 deletions
diff --git a/gnu/packages/ssh.scm b/gnu/packages/ssh.scm
index 0a344521dc..5c07835895 100644
--- a/gnu/packages/ssh.scm
+++ b/gnu/packages/ssh.scm
@@ -23,6 +23,7 @@
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages groff)
   #:use-module (gnu packages openssl)
+  #:use-module (gnu packages patchelf)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
@@ -40,13 +41,43 @@
                (base32
                 "1w6s217vjq0w3v5i0c5ql6m0ki1yz05g9snah3azxfkl9k4schpd"))))
     (build-system cmake-build-system)
-    (arguments '(#:configure-flags '("-DWITH_GCRYPT=ON")
+    (arguments
+     '(#:configure-flags '("-DWITH_GCRYPT=ON"
 
-                 ;; TODO: Add 'CMockery' and '-DWITH_TESTING=ON' for the test
-                 ;; suite.
-                 #:tests? #f))
+                                     ;; Leave a valid RUNPATH upon install.
+                                     "-DCMAKE_SKIP_BUILD_RPATH=ON")
+
+       ;; TODO: Add 'CMockery' and '-DWITH_TESTING=ON' for the test suite.
+       #:tests? #f
+
+       #:modules ((guix build cmake-build-system)
+                  (guix build utils)
+                  (guix build rpath))
+       #:imported-modules ((guix build gnu-build-system)
+                           (guix build cmake-build-system)
+                           (guix build utils)
+                           (guix build rpath))
+
+       #:phases (alist-cons-after
+                 'install 'augment-runpath
+                 (lambda* (#:key outputs #:allow-other-keys)
+                   ;; libssh_threads.so NEEDs libssh.so, so add $libdir to its
+                   ;; RUNPATH.
+                   (define (dereference file)
+                     (let ((target (false-if-exception (readlink file))))
+                       (if target
+                           (dereference target)
+                           file)))
+
+                   (let* ((out (assoc-ref outputs "out"))
+                          (lib (string-append out "/lib")))
+                     (with-directory-excursion lib
+                       (augment-rpath (dereference "libssh_threads.so")
+                                      lib))))
+                 %standard-phases)))
     (inputs `(("zlib" ,zlib)
               ("libgcrypt" ,libgcrypt)))
+    (native-inputs `(("patchelf" ,patchelf)))
     (synopsis "SSH client library")
     (description
      "libssh is a C library implementing the SSHv2 and SSHv1 protocol for