summaryrefslogtreecommitdiffstats
path: root/scripts/pkg-config-wrapper
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2010-04-19 09:33:28 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2010-04-19 11:45:27 +0200
commit23ec8408d6c7dc52675b0b5df5c0dd84ca767ca6 (patch)
treeb0460eb4f8d306e9203644d663af1e04aa6f5d69 /scripts/pkg-config-wrapper
parent232175c41e3dbe94cfc2c75d53fc5f872222de76 (diff)
downloadptxdist-23ec8408d6c7dc52675b0b5df5c0dd84ca767ca6.tar.gz
ptxdist-23ec8408d6c7dc52675b0b5df5c0dd84ca767ca6.tar.xz
[pkg-config-wrapper] sanitize output and reactivate PTXDIST_PKG_CONFIG_VAR_NO_SYSROOT
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts/pkg-config-wrapper')
-rwxr-xr-xscripts/pkg-config-wrapper32
1 files changed, 10 insertions, 22 deletions
diff --git a/scripts/pkg-config-wrapper b/scripts/pkg-config-wrapper
index 4c18ab1cf..c1c18aa19 100755
--- a/scripts/pkg-config-wrapper
+++ b/scripts/pkg-config-wrapper
@@ -4,8 +4,6 @@ declare -a PKG_CONFIG_ARRAY
PKG_CONFIG_ARRAY=( $(type -a -P pkg-config) )
PKG_CONFIG="${PKG_CONFIG_ARRAY[1]}"
-exec "${PKG_CONFIG}" "${@}"
-
for ((i = 1; i <= ${#}; i++)); do
case "${!i}" in
--variable*)
@@ -17,27 +15,17 @@ for ((i = 1; i <= ${#}; i++)); do
esac
done
+args=("-e" "s:/lib/pkgconfig/../..::g")
-if [ -n "${found_var}" ]; then
- #
- # if someone asks for a variable, if it looks like a path
- # (starting with /) prefix it with sysroot
- #
- if [ -n "${PTXDIST_PKG_CONFIG_VAR_NO_SYSROOT}" ]; then
- exec "${PKG_CONFIG}" "${@}"
- else
- "${PKG_CONFIG}" "${@}" | sed -e "s~^/~${SYSROOT}/~"
- check_pipe_status
- fi
-else
+if [ -n "${PTXDIST_PKG_CONFIG_VAR_NO_SYSROOT}" -a \
+ -n "${found_var}" ]; then
#
- # 1) protect already given sysroot
- # 2) add sysroot symbol to all absolute paths
- # 3) replace sysroot sign to sysroot path
+ # remove sysroot for variables that return a path
#
- "${PKG_CONFIG}" "${@}" |
- sed -e "s~\-L/*${SYSROOT}/*~-L=/~g; s~\-I/*${SYSROOT}/*~-I=/~g;" \
- -e "s~\-L/~-L=/~g; s~\-I/~-I=/~g;" \
- -e "s~\-L\=~-L${SYSROOT}~g; s~\-I\=~-I${SYSROOT}~g;"
- check_pipe_status
+ args[${#args[@]}]="-e"
+ args[${#args[@]}]="s~^${SYSROOT}/~/~"
fi
+
+"${PKG_CONFIG}" "${@}" | sed "${args[@]}"
+check_pipe_status
+