summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorEric Bavier <bavier@member.fsf.org>2014-04-08 23:08:30 -0500
committerEric Bavier <bavier@member.fsf.org>2014-04-08 23:10:42 -0500
commit57e544e8f7f0c907bb1ea3b4432a9a3d3da57365 (patch)
tree8c62cbe711f31f03e626e699b7e9b1ea71d328ac /gnu
parentcb3da2339a372bc71e2c678c826bbda0825f27e4 (diff)
downloadguix-57e544e8f7f0c907bb1ea3b4432a9a3d3da57365.tar.gz
gnu: lapack: Augment library rpath
* gnu/packages/maths.scm (lapack) [arguments]: New post-installation
  phase to augment the rpath of installed libraries.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/maths.scm30
1 files changed, 29 insertions, 1 deletions
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 351036159a..68c326752c 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -28,6 +28,7 @@
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages curl)
+  #:use-module (gnu packages elf)
   #:use-module (gnu packages fltk)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gettext)
@@ -185,12 +186,18 @@ output in text, PostScript, PDF or HTML.")
         "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
     (build-system cmake-build-system)
     (home-page "http://www.netlib.org/lapack/")
+    (native-inputs `(("patchelf" ,patchelf))) ;for augment-rpath
     (inputs `(("fortran" ,gfortran-4.8)
               ("python" ,python-2)))
     (arguments
      `(#:modules ((guix build cmake-build-system)
                   (guix build utils)
+                  (guix build rpath)
                   (srfi srfi-1))
+       #:imported-modules ((guix build cmake-build-system)
+                           (guix build gnu-build-system)
+                           (guix build utils)
+                           (guix build rpath))
        #:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
        #:phases (alist-cons-before
                  'check 'patch-python
@@ -198,7 +205,28 @@ output in text, PostScript, PDF or HTML.")
                    (let ((python (assoc-ref inputs "python")))
                      (substitute* "lapack_testing.py"
                        (("/usr/bin/env python") python))))
-                 %standard-phases)))
+                 (alist-cons-after
+                  'strip 'add-libs-to-runpath
+                  (lambda* (#:key inputs outputs #:allow-other-keys)
+                    (let* ((out     (assoc-ref outputs "out"))
+                           (fortran (assoc-ref inputs "fortran"))
+                           (libc    (assoc-ref inputs "libc"))
+                           (rpaths  `(,(string-append fortran "/lib64")
+                                      ,(string-append fortran "/lib")
+                                      ,(string-append libc "/lib")
+                                      ,(string-append out "/lib"))))
+                      ;; Set RUNPATH for all libraries
+                      (with-directory-excursion out
+                        (for-each
+                         (lambda (lib)
+                           (let ((lib-rpaths (file-rpath lib)))
+                             (for-each
+                              (lambda (dir)
+                                (or (member dir lib-rpaths)
+                                    (augment-rpath lib dir)))
+                              rpaths)))
+                         (find-files "lib" ".*so$")))))
+                  %standard-phases))))
     (synopsis "Library for numerical linear algebra")
     (description
      "LAPACK is a Fortran 90 library for solving the most commonly occurring