summary refs log tree commit diff
path: root/pkgs/build-support/wrapper-common
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-05-17 17:12:39 +0200
committersternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-05-18 00:13:27 +0200
commitb11d65c8508542efbd161c5922d51b55b431fe90 (patch)
tree7c4dc09faed674d9a487dbab5d3d096cb8568110 /pkgs/build-support/wrapper-common
parent20acd4c4f14040485f40e55c0a76c186aa8ca4f3 (diff)
downloadnixpkgs-b11d65c8508542efbd161c5922d51b55b431fe90.tar
nixpkgs-b11d65c8508542efbd161c5922d51b55b431fe90.tar.gz
nixpkgs-b11d65c8508542efbd161c5922d51b55b431fe90.tar.bz2
nixpkgs-b11d65c8508542efbd161c5922d51b55b431fe90.tar.lz
nixpkgs-b11d65c8508542efbd161c5922d51b55b431fe90.tar.xz
nixpkgs-b11d65c8508542efbd161c5922d51b55b431fe90.tar.zst
nixpkgs-b11d65c8508542efbd161c5922d51b55b431fe90.zip
pkg-config-wrapper: mangle PKG_CONFIG_PATH{,_FOR_BUILD} correctly
Previously, mangleVarList would be used which would concatenate the
variables using a space as a separator. Paths are however separated by
`:` in PKG_CONFIG_PATH leading to entries being broken.

This is fixed by introducing mangleVarListGeneric which allows us to
specify the desired separator.

Reproducer for the issue prior to this change:

    $ nix-shell -A pkgsLLVM.wayland
    [nix-shell] $ pkg-config --libs expat
    Package expat was not found in the pkg-config search path.
    Perhaps you should add the directory containing `expat.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'expat' found
    $ printf 'Host: %s\nBuild: %s' $PKG_CONFIG_PATH $PKG_CONFIG_PATH_FOR_BUILD
    Host: /nix/store/5h308a4ab8w7prcp8iflh5pnl78mayi2-expat-2.2.10-x86_64-unknown-linux-gnu-dev/lib/pkgconfig:/nix/store/z3y9ska2h4l1map25m195iq577g7g3gz-libxml2-x86_64-unknown-linux-gnu-2.9.12-dev/lib/pkgconfig:/nix/store/lbz5m1s0r7zn0cxvl21czfspli6ribzb-zlib-1.2.11-x86_64-unknown-linux-gnu-dev/lib/pkgconfig:/nix/store/rfhvp8r8n3ygpzh8j0l34lk8hwwi3z0h-libffi-3.3-x86_64-unknown-linux-gnu-dev/lib/pkgconfig
    Build: /nix/store/dw11ywy7qwfz53qisz0dggbgix88jah2-wayland-1.19.0-bin/lib/pkgconfig

strace reveals the issue:

    stat("/nix/store/dw11ywy7qwfz53qisz0dggbgix88jah2-wayland-1.19.0-bin/lib/pkgconfig /nix/store/5h308a4ab8w7prcp8iflh5pnl78mayi2-expat-2.2.10-x86_64-unknown-linux-gnu-dev/lib/pkgconfig/expat-uninstalled.pc", 0x7fff49829fa0) = -1 ENOENT (No such file or directory)

In the pkg-config wrapper $PKG_CONFIG_PATH_FOR_BUILD and
$PKG_CONFIG_PATH are concatenated with a space which leads to two paths
being messed up. This issue likely only affects native cross
compilation.
Diffstat (limited to 'pkgs/build-support/wrapper-common')
-rw-r--r--pkgs/build-support/wrapper-common/utils.bash10
1 files changed, 8 insertions, 2 deletions
diff --git a/pkgs/build-support/wrapper-common/utils.bash b/pkgs/build-support/wrapper-common/utils.bash
index 66b7c3f3e83..f773270f7de 100644
--- a/pkgs/build-support/wrapper-common/utils.bash
+++ b/pkgs/build-support/wrapper-common/utils.bash
@@ -13,7 +13,9 @@ accumulateRoles() {
     fi
 }
 
-mangleVarList() {
+mangleVarListGeneric() {
+    local sep="$1"
+    shift
     local var="$1"
     shift
     local -a role_suffixes=("$@")
@@ -25,11 +27,15 @@ mangleVarList() {
     for suffix in "${role_suffixes[@]}"; do
         local inputVar="${var}${suffix}"
         if [ -v "$inputVar" ]; then
-            export ${outputVar}+="${!outputVar:+ }${!inputVar}"
+            export ${outputVar}+="${!outputVar:+$sep}${!inputVar}"
         fi
     done
 }
 
+mangleVarList() {
+    mangleVarListGeneric " " "$@"
+}
+
 mangleVarBool() {
     local var="$1"
     shift