summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Melki <christian.melki@t2data.com>2021-05-07 15:51:33 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2021-05-21 15:54:43 +0200
commit206ca4c09894a74c449bc7161de77e5f71ba5f6b (patch)
tree86a1eb71ebd793fa2a2c60e54312acc876324342
parentdea41c30f468197dda4c44f600e958d19dc5adc7 (diff)
downloadptxdist-206ca4c09894a74c449bc7161de77e5f71ba5f6b.tar.gz
ptxdist-206ca4c09894a74c449bc7161de77e5f71ba5f6b.tar.xz
scripts/pkg-config-wrapper: Try to clear up multiple pkgconfig libdir flow.
Ideally only one libdir should be available as the pkg-config path. Packages need to be cleaned up before that can happen. Signed-off-by: Christian Melki <christian.melki@t2data.com> Message-Id: <20210507135133.4842-1-christian.melki@t2data.com> [mol: merge rel_*paths and abs_*paths] Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rwxr-xr-xscripts/pkg-config-wrapper22
1 files changed, 14 insertions, 8 deletions
diff --git a/scripts/pkg-config-wrapper b/scripts/pkg-config-wrapper
index d86fa7c68..36b9415dd 100755
--- a/scripts/pkg-config-wrapper
+++ b/scripts/pkg-config-wrapper
@@ -16,10 +16,16 @@ else
exit 1
fi
-declare -a libdir system_path system_incpath
-libdir=( $(find ${prefix} -maxdepth 3 -type d -name pkgconfig) )
-system_libpath=( "${libdir[@]/%//../../lib}" "${libdir[@]/%//../lib}" "/usr/lib" "/lib" )
-system_incpath=( "${libdir[@]/%//../../include}" "${libdir[@]/%//../include}" "/usr/include" "/include" )
+declare -a libdirs libpaths incpaths
+# try to find all our pkgconfig paths.
+libdirs=( $(find ${prefix} -maxdepth 3 -type d -name pkgconfig) )
+for libdir in "${libdirs[@]}"; do
+ lib="$(basename $(dirname ${libdir}))"
+ libpaths+=( "${libdir[@]/%//../../${lib}}" "${libdir[@]/%//../${lib}}" )
+ incpaths+=( "${libdir[@]/%//../../include}" "${libdir[@]/%//../include}" )
+ libpaths+=( "/usr/${lib}" "/${lib}" )
+done
+incpaths+=( "/usr/include" "/include" )
orig_IFS="${IFS}"
IFS=":"
@@ -30,12 +36,12 @@ unset PKG_CONFIG_SYSROOT_DIR
# they may include /usr/{lib,include} which is never correct
unset PKG_CONFIG_ALLOW_SYSTEM_CFLAGS
unset PKG_CONFIG_ALLOW_SYSTEM_LIBS
-# default pkg-config searchs
-export PKG_CONFIG_LIBDIR="${libdir[*]}"
+# default pkg-config search path
+export PKG_CONFIG_LIBDIR="${libdirs[*]}"
# default search path that will be dropped from --libs
-export PKG_CONFIG_SYSTEM_LIBRARY_PATH="${system_libpath[*]}"
+export PKG_CONFIG_SYSTEM_LIBRARY_PATH="${libpaths[*]}"
# default search path that will be dropped from --cflags
-export PKG_CONFIG_SYSTEM_INCLUDE_PATH="${system_incpath[*]}"
+export PKG_CONFIG_SYSTEM_INCLUDE_PATH="${incpaths[*]}"
IFS="${orig_IFS}"
for ((i = 1; i <= ${#}; i++)); do