diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2009-04-03 21:02:46 +0000 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2009-04-03 21:02:46 +0000 |
commit | 5c5fbd8bdabb2e14f597dcd33e6bfcf51010cebe (patch) | |
tree | 0bd16cc09eedefaa54375dbfcaf6471278789f55 /scripts/pkg-config-wrapper | |
parent | 110ec50db6660a6736044bb072151f65dc8b07d0 (diff) | |
download | ptxdist-5c5fbd8bdabb2e14f597dcd33e6bfcf51010cebe.tar.gz ptxdist-5c5fbd8bdabb2e14f597dcd33e6bfcf51010cebe.tar.xz |
[pkg-config-wrapper] add option to disable sysroot prefix during --variable
there are two use case for pkg-config --variable:
- retrieve path used it while compiling
- retrieve path and use it during runtime
this patch adds a variable to specify the wrapper's behaviour, by
default the sysroot is prefixed, if PTXDIST_PKG_CONFIG_VAR_NO_SYSROOT isn't
empty the plain variable (w/o sysroot) is printed.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
git-svn-id: https://svn.pengutronix.de/svn/ptxdist/trunks/ptxdist-trunk@10214 33e552b5-05e3-0310-8538-816dae2090ed
Diffstat (limited to 'scripts/pkg-config-wrapper')
-rwxr-xr-x | scripts/pkg-config-wrapper | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/scripts/pkg-config-wrapper b/scripts/pkg-config-wrapper index 90420ed09..3d07dfbbb 100755 --- a/scripts/pkg-config-wrapper +++ b/scripts/pkg-config-wrapper @@ -12,13 +12,13 @@ check_pipe_status() { } if test -z "${SYSROOT}"; then - ( - echo - echo - echo "pkg-config: missing \$SYSROOT environment variable" - echo - echo - ) >&2 + cat >&2 <<EOF + + +pkg-config: missing \$SYSROOT environment variable" + + +EOF exit 1 fi @@ -26,12 +26,12 @@ export PKG_CONFIG_LIBDIR="${SYSROOT}/lib/pkgconfig:${SYSROOT}/usr/lib/pkgconfig" export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 unset PKG_CONFIG_PATH - -found_var=false +unset found_var for ((i = 1; i <= ${#}; i++)); do case "${!i}" in --variable*) found_var=true + break ;; *) ;; @@ -39,23 +39,26 @@ for ((i = 1; i <= ${#}; i++)); do done -if ${found_var}; then -# -# if someone asks for a variable, if it looks like a path (starting with /) -# prefix it with sysroot -# - "${PKG_CONFIG}" "${@}" | - sed -e "s~^/~${SYSROOT}/~" +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 -# -# 1) protect already given sysroot -# 2) add sysroot symbol to all absolute paths -# 3) replace sysroot sign to sysroot path -# - ${PKG_CONFIG} "${@}" | + # + # 1) protect already given sysroot + # 2) add sysroot symbol to all absolute paths + # 3) replace sysroot sign to sysroot 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 fi - -check_pipe_status |