summaryrefslogtreecommitdiffstats
path: root/scripts/pkg-config-wrapper
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2012-06-14 23:01:07 +0200
committerMarc Kleine-Budde <mkl@pengutronix.de>2012-06-14 23:05:37 +0200
commit0a29e2164a07680a6459cd3b663d99032aa08d3c (patch)
treedfb62a8c10e8cc3aa872a6b78403246aef7d3501 /scripts/pkg-config-wrapper
parent1597f565d60569e246952f74d5657540b95c49b6 (diff)
downloadptxdist-0a29e2164a07680a6459cd3b663d99032aa08d3c.tar.gz
ptxdist-0a29e2164a07680a6459cd3b663d99032aa08d3c.tar.xz
pkg-config-wrapper: remove not needed -I $SYSROOT/include from output
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'scripts/pkg-config-wrapper')
-rwxr-xr-xscripts/pkg-config-wrapper18
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/pkg-config-wrapper b/scripts/pkg-config-wrapper
index 77863199b..bfd4e4893 100755
--- a/scripts/pkg-config-wrapper
+++ b/scripts/pkg-config-wrapper
@@ -34,6 +34,24 @@ if [ -n "${PTXDIST_PKG_CONFIG_VAR_NO_SYSROOT}" -a \
#
args[${#args[@]}]="-e"
args[${#args[@]}]="s~^${SYSROOT}/~/~"
+else
+ declare -a sysroot_prefix
+ #
+ # this shell/sed magic removes "-I$SYSROOT/include" from
+ # pkg-config's output
+ #
+
+ #
+ # transform from PATH to array: /foo:/bar -> /foo /bar
+ #
+ sysroot_prefix=( ${PTXDIST_PATH_SYSROOT_PREFIX//:/ } )
+
+ #
+ # make sed expression: -e s~-I/foo/include\(\s\|$\)~~
+ # remove whitespace
+ #
+ sysroot_prefix=( ${sysroot_prefix[@]/%//include\\(\\s\\|$\\)~~} )
+ args=( ${args[@]} ${sysroot_prefix[@]/#/-e s~-I} -e "s~\s\+~ ~g" -e "s~^\s\+$~~")
fi
"${PKG_CONFIG}" "${@}" | sed "${args[@]}"