summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-05-08 23:24:05 +0200
committerLudovic Courtès <ludo@gnu.org>2013-05-08 23:45:02 +0200
commit3309e3a103d7dfe62364346977e139e3519eb580 (patch)
tree3702f9843c0ce866f91c6996b7d8cc96a1e88c15 /gnu
parente789d9a80bd2758012743d56a53e98746201ac9a (diff)
downloadguix-3309e3a103d7dfe62364346977e139e3519eb580.tar.gz
Add (guix build rpath).
* guix/build/rpath.scm: New file.
* Makefile.am (MODULES): Add it.
* gnu/packages/python.scm (python): Use it; remove local copy of
  the *rpath* procedures.
* gnu/packages/samba.scm (samba): Likewise.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/python.scm28
-rw-r--r--gnu/packages/samba.scm26
2 files changed, 10 insertions, 44 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 23d18909a3..800b08c373 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -66,34 +66,16 @@
 
         #:modules ((guix build gnu-build-system)
                    (guix build utils)
-                   (ice-9 popen)
-                   (ice-9 rdelim)
+                   (guix build rpath)
                    (srfi srfi-26))
+        #:imported-modules ((guix build gnu-build-system)
+                            (guix build utils)
+                            (guix build rpath))
 
         #:phases
         (alist-cons-after
          'strip 'add-lib-to-runpath
          (lambda* (#:key outputs #:allow-other-keys)
-           ;; XXX: copied from Samba; TODO: factorize in a module
-
-           (define (file-rpath file)
-             ;; Return the RPATH of FILE.
-             (let* ((p (open-pipe* OPEN_READ "patchelf"
-                                   "--print-rpath" file))
-                    (l (read-line p)))
-               (and (zero? (close-pipe p)) l)))
-
-           (define (augment-rpath file dir)
-             ;; Add DIR to the RPATH of FILE.
-             (let* ((rpath  (file-rpath file))
-                    (rpath* (if rpath
-                                (string-append dir ":" rpath)
-                                dir)))
-               (format #t "~a: changing RPATH from `~a' to `~a'~%"
-                       file (or rpath "") rpath*)
-               (zero? (system* "patchelf" "--set-rpath"
-                               rpath* file))))
-
            (let* ((out (assoc-ref outputs "out"))
                   (lib (string-append out "/lib")))
              ;; Add LIB to the RUNPATH of all the executables.
@@ -107,7 +89,7 @@
        ("openssl" ,openssl)
        ("readline" ,readline)
        ("zlib" ,zlib)
-       ("patchelf" ,patchelf)))
+       ("patchelf" ,patchelf)))                   ; for (guix build rpath)
     (native-search-paths
      (list (search-path-specification
             (variable "PYTHONPATH")
diff --git a/gnu/packages/samba.scm b/gnu/packages/samba.scm
index 93c9f70a50..b016442908 100644
--- a/gnu/packages/samba.scm
+++ b/gnu/packages/samba.scm
@@ -111,24 +111,6 @@ anywhere.")
                  (alist-cons-after
                   'strip 'add-lib-to-runpath
                   (lambda* (#:key outputs #:allow-other-keys)
-                    (define (file-rpath file)
-                      ;; Return the RPATH of FILE.
-                      (let* ((p (open-pipe* OPEN_READ "patchelf"
-                                            "--print-rpath" file))
-                             (l (read-line p)))
-                        (and (zero? (close-pipe p)) l)))
-
-                    (define (augment-rpath file dir)
-                      ;; Add DIR to the RPATH of FILE.
-                      (let* ((rpath  (file-rpath file))
-                             (rpath* (if rpath
-                                         (string-append dir ":" rpath)
-                                         dir)))
-                        (format #t "~a: changing RPATH from `~a' to `~a'~%"
-                                file (or rpath "") rpath*)
-                        (zero? (system* "patchelf" "--set-rpath"
-                                        rpath* file))))
-
                     (let* ((out (assoc-ref outputs "out"))
                            (lib (string-append out "/lib")))
                       ;; Add LIB to the RUNPATH of all the executables.
@@ -140,9 +122,11 @@ anywhere.")
 
        #:modules ((guix build gnu-build-system)
                   (guix build utils)
-                  (ice-9 popen)
-                  (ice-9 rdelim)
+                  (guix build rpath)
                   (srfi srfi-26))
+       #:imported-modules ((guix build gnu-build-system)
+                           (guix build utils)
+                           (guix build rpath))
 
        ;; This flag is required to allow for "make test".
        #:configure-flags '("--enable-socket-wrapper")
@@ -163,7 +147,7 @@ anywhere.")
        ("openldap" ,openldap)
        ("linux-pam" ,linux-pam)
        ("readline" ,readline)
-       ("patchelf" ,patchelf)))
+       ("patchelf" ,patchelf)))                   ; for (guix build rpath)
     (native-inputs                                ; for the test suite
      `(("perl" ,perl)
        ("python" ,python)))