nonguix: chromium-binary-build: Extend wrapper-plan syntax.

This commit is similar to a0079cf1bd which
allowed patchelf-plan to take entries with an optional path.  Here,
wrapper-plan is extended to allow for additional syntax (not just a list of
strings) similar to patchelf-plan.  Now, entries can be a list, with the first
the string for the file to be patched and the second a list which is added to
the patchelf-plan.

This allows, for example, to patch RPATH to effectively have $ORIGIN for
binaries that need it, with an entry like `("bin/binary" (("out"
"/lib/Binary")))` common for some chromium-based packages.  See followup
commits for these changes to reduce LD_LIBRARY_PATH wrapping in some packages.

* nonguix/build-system/chromium-binary.scm (build-patchelf-plan): Handle
entries in wrapper-plan which are a list so that the cdr is added to
patchelf-plan for the car.
(chromium-binary-build): Update doc string for this change and some basics
which were not documented.
This commit is contained in:
John Kehayias 2025-02-04 21:33:30 -05:00
parent 1df7887148
commit 26778f221b
No known key found for this signature in database
GPG Key ID: 499097AE5EA815D9

View File

@ -54,7 +54,12 @@
#~(let ((patchelf-inputs
(list #$@(map car inputs))))
(map (lambda (file)
(cons file (list patchelf-inputs)))
;; Either an entry in WRAPPER-PLAN is just a string which can be
;; used directly, or it is a list where the second element is a
;; list of additional inputs for patchelf-plan.
(if (list? file)
(cons (car file) (list (append patchelf-inputs (cadr file))))
(cons file (list patchelf-inputs))))
#$wrapper-plan)))
(define* (lower name
@ -163,7 +168,13 @@
(substitutable? #t)
allowed-references
disallowed-references)
"Build SOURCE using binary-build-system."
"Build SOURCE using binary-build-system. WRAPPER-PLAN is a list of strings for
files which patchelf will add the INPUTS (which implicitly includes the base
packages needed for chromium-based binaries) to RPATH and wrap with needed
environment variables. Optionally, an entry can be a list with the first
entry the file to be patched and the second a list of additional inputs for
patchelf, like PATCHELF-PLAN in binary-build-system. PATCHELF-PLAN itself is
ignored if WRAPPER-PLAN is not '()."
(define builder
(with-imported-modules imported-modules
#~(begin