mirror of
https://gitlab.com/nonguix/nonguix.git
synced 2024-12-23 23:34:52 +01:00
nonguix: Extend patchelf-plan syntax with optional path.
Makes it possible to define entries like the following in the patchelf-plan: ("the-binary" ("glibc" ("nss" "/lib/nss"))) * nonguix/build/binary-build-system.scm (maybe-make-rpath, make-rpath): New functions and use them. Signed-off-by: Jonathan Brielmaier <jonathan.brielmaier@web.de>
This commit is contained in:
parent
8f8bdc8ec6
commit
a0079cf1bd
1 changed files with 18 additions and 7 deletions
|
@ -97,6 +97,19 @@ The PATCHELF-PLAN elements are lists of:
|
||||||
Both executables and dynamic libraries are accepted.
|
Both executables and dynamic libraries are accepted.
|
||||||
The inputs are optional when the file is an executable."
|
The inputs are optional when the file is an executable."
|
||||||
(define (binary-patch binary interpreter runpath)
|
(define (binary-patch binary interpreter runpath)
|
||||||
|
|
||||||
|
(define* (maybe-make-rpath entries name #:optional (extra-path "/lib"))
|
||||||
|
(let ((entry (assoc-ref entries name)))
|
||||||
|
(if entry
|
||||||
|
(string-append entry extra-path)
|
||||||
|
#f)))
|
||||||
|
|
||||||
|
(define* (make-rpath name #:optional (extra-path "/lib"))
|
||||||
|
(or (maybe-make-rpath outputs name extra-path)
|
||||||
|
(maybe-make-rpath inputs name extra-path)
|
||||||
|
(error (format #f "`~a' not found among the inputs nor the outputs."
|
||||||
|
input-or-output))))
|
||||||
|
|
||||||
(unless (string-contains binary ".so")
|
(unless (string-contains binary ".so")
|
||||||
;; Use `system*' and not `invoke' since this may raise an error if
|
;; Use `system*' and not `invoke' since this may raise an error if
|
||||||
;; library does not end with .so.
|
;; library does not end with .so.
|
||||||
|
@ -104,13 +117,11 @@ The inputs are optional when the file is an executable."
|
||||||
(when runpath
|
(when runpath
|
||||||
(let ((rpath (string-join
|
(let ((rpath (string-join
|
||||||
(map
|
(map
|
||||||
(lambda (input-or-output)
|
(match-lambda
|
||||||
(cond
|
((name extra-path)
|
||||||
((assoc-ref outputs input-or-output)
|
(make-rpath name extra-path))
|
||||||
(string-append (assoc-ref outputs input-or-output) "/lib"))
|
(name
|
||||||
((assoc-ref inputs input-or-output)
|
(make-rpath name)))
|
||||||
(string-append (assoc-ref inputs input-or-output) "/lib"))
|
|
||||||
(else (error (format #f "`~a' not found among the inputs nor the outputs." input-or-output)))))
|
|
||||||
runpath)
|
runpath)
|
||||||
":")))
|
":")))
|
||||||
(invoke "patchelf" "--set-rpath" rpath binary)))
|
(invoke "patchelf" "--set-rpath" rpath binary)))
|
||||||
|
|
Loading…
Reference in a new issue