diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2013-05-08 23:24:05 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2013-05-08 23:45:02 +0200 |
| commit | 3309e3a103d7dfe62364346977e139e3519eb580 (patch) | |
| tree | 3702f9843c0ce866f91c6996b7d8cc96a1e88c15 /gnu | |
| parent | e789d9a80bd2758012743d56a53e98746201ac9a (diff) | |
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.scm | 28 | ||||
| -rw-r--r-- | gnu/packages/samba.scm | 26 |
2 files changed, 10 insertions, 44 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 23d18909a3a..800b08c373e 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm | |||
| @@ -66,34 +66,16 @@ | |||
| 66 | 66 | ||
| 67 | #:modules ((guix build gnu-build-system) | 67 | #:modules ((guix build gnu-build-system) |
| 68 | (guix build utils) | 68 | (guix build utils) |
| 69 | (ice-9 popen) | 69 | (guix build rpath) |
| 70 | (ice-9 rdelim) | ||
| 71 | (srfi srfi-26)) | 70 | (srfi srfi-26)) |
| 71 | #:imported-modules ((guix build gnu-build-system) | ||
| 72 | (guix build utils) | ||
| 73 | (guix build rpath)) | ||
| 72 | 74 | ||
| 73 | #:phases | 75 | #:phases |
| 74 | (alist-cons-after | 76 | (alist-cons-after |
| 75 | 'strip 'add-lib-to-runpath | 77 | 'strip 'add-lib-to-runpath |
| 76 | (lambda* (#:key outputs #:allow-other-keys) | 78 | (lambda* (#:key outputs #:allow-other-keys) |
| 77 | ;; XXX: copied from Samba; TODO: factorize in a module | ||
| 78 | |||
| 79 | (define (file-rpath file) | ||
| 80 | ;; Return the RPATH of FILE. | ||
| 81 | (let* ((p (open-pipe* OPEN_READ "patchelf" | ||
| 82 | "--print-rpath" file)) | ||
| 83 | (l (read-line p))) | ||
| 84 | (and (zero? (close-pipe p)) l))) | ||
| 85 | |||
| 86 | (define (augment-rpath file dir) | ||
| 87 | ;; Add DIR to the RPATH of FILE. | ||
| 88 | (let* ((rpath (file-rpath file)) | ||
| 89 | (rpath* (if rpath | ||
| 90 | (string-append dir ":" rpath) | ||
| 91 | dir))) | ||
| 92 | (format #t "~a: changing RPATH from `~a' to `~a'~%" | ||
| 93 | file (or rpath "") rpath*) | ||
| 94 | (zero? (system* "patchelf" "--set-rpath" | ||
| 95 | rpath* file)))) | ||
| 96 | |||
| 97 | (let* ((out (assoc-ref outputs "out")) | 79 | (let* ((out (assoc-ref outputs "out")) |
| 98 | (lib (string-append out "/lib"))) | 80 | (lib (string-append out "/lib"))) |
| 99 | ;; Add LIB to the RUNPATH of all the executables. | 81 | ;; Add LIB to the RUNPATH of all the executables. |
| @@ -107,7 +89,7 @@ | |||
| 107 | ("openssl" ,openssl) | 89 | ("openssl" ,openssl) |
| 108 | ("readline" ,readline) | 90 | ("readline" ,readline) |
| 109 | ("zlib" ,zlib) | 91 | ("zlib" ,zlib) |
| 110 | ("patchelf" ,patchelf))) | 92 | ("patchelf" ,patchelf))) ; for (guix build rpath) |
| 111 | (native-search-paths | 93 | (native-search-paths |
| 112 | (list (search-path-specification | 94 | (list (search-path-specification |
| 113 | (variable "PYTHONPATH") | 95 | (variable "PYTHONPATH") |
diff --git a/gnu/packages/samba.scm b/gnu/packages/samba.scm index 93c9f70a50c..b016442908a 100644 --- a/gnu/packages/samba.scm +++ b/gnu/packages/samba.scm | |||
| @@ -111,24 +111,6 @@ anywhere.") | |||
| 111 | (alist-cons-after | 111 | (alist-cons-after |
| 112 | 'strip 'add-lib-to-runpath | 112 | 'strip 'add-lib-to-runpath |
| 113 | (lambda* (#:key outputs #:allow-other-keys) | 113 | (lambda* (#:key outputs #:allow-other-keys) |
| 114 | (define (file-rpath file) | ||
| 115 | ;; Return the RPATH of FILE. | ||
| 116 | (let* ((p (open-pipe* OPEN_READ "patchelf" | ||
| 117 | "--print-rpath" file)) | ||
| 118 | (l (read-line p))) | ||
| 119 | (and (zero? (close-pipe p)) l))) | ||
| 120 | |||
| 121 | (define (augment-rpath file dir) | ||
| 122 | ;; Add DIR to the RPATH of FILE. | ||
| 123 | (let* ((rpath (file-rpath file)) | ||
| 124 | (rpath* (if rpath | ||
| 125 | (string-append dir ":" rpath) | ||
| 126 | dir))) | ||
| 127 | (format #t "~a: changing RPATH from `~a' to `~a'~%" | ||
| 128 | file (or rpath "") rpath*) | ||
| 129 | (zero? (system* "patchelf" "--set-rpath" | ||
| 130 | rpath* file)))) | ||
| 131 | |||
| 132 | (let* ((out (assoc-ref outputs "out")) | 114 | (let* ((out (assoc-ref outputs "out")) |
| 133 | (lib (string-append out "/lib"))) | 115 | (lib (string-append out "/lib"))) |
| 134 | ;; Add LIB to the RUNPATH of all the executables. | 116 | ;; Add LIB to the RUNPATH of all the executables. |
| @@ -140,9 +122,11 @@ anywhere.") | |||
| 140 | 122 | ||
| 141 | #:modules ((guix build gnu-build-system) | 123 | #:modules ((guix build gnu-build-system) |
| 142 | (guix build utils) | 124 | (guix build utils) |
| 143 | (ice-9 popen) | 125 | (guix build rpath) |
| 144 | (ice-9 rdelim) | ||
| 145 | (srfi srfi-26)) | 126 | (srfi srfi-26)) |
| 127 | #:imported-modules ((guix build gnu-build-system) | ||
| 128 | (guix build utils) | ||
| 129 | (guix build rpath)) | ||
| 146 | 130 | ||
| 147 | ;; This flag is required to allow for "make test". | 131 | ;; This flag is required to allow for "make test". |
| 148 | #:configure-flags '("--enable-socket-wrapper") | 132 | #:configure-flags '("--enable-socket-wrapper") |
| @@ -163,7 +147,7 @@ anywhere.") | |||
| 163 | ("openldap" ,openldap) | 147 | ("openldap" ,openldap) |
| 164 | ("linux-pam" ,linux-pam) | 148 | ("linux-pam" ,linux-pam) |
| 165 | ("readline" ,readline) | 149 | ("readline" ,readline) |
| 166 | ("patchelf" ,patchelf))) | 150 | ("patchelf" ,patchelf))) ; for (guix build rpath) |
| 167 | (native-inputs ; for the test suite | 151 | (native-inputs ; for the test suite |
| 168 | `(("perl" ,perl) | 152 | `(("perl" ,perl) |
| 169 | ("python" ,python))) | 153 | ("python" ,python))) |
