From 26778f221b0eda26eb3bd4a2801bfaca99f37c41 Mon Sep 17 00:00:00 2001 From: John Kehayias Date: Tue, 4 Feb 2025 21:33:30 -0500 Subject: [PATCH] nonguix: chromium-binary-build: Extend wrapper-plan syntax. This commit is similar to a0079cf1bd8ef707ab9e15a0e249cbd34f157ae4 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. --- nonguix/build-system/chromium-binary.scm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/nonguix/build-system/chromium-binary.scm b/nonguix/build-system/chromium-binary.scm index 874acda..fa22cd9 100644 --- a/nonguix/build-system/chromium-binary.scm +++ b/nonguix/build-system/chromium-binary.scm @@ -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