aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gpg-error-config-new.in34
-rwxr-xr-xsrc/gpg-error-config-test.sh2
2 files changed, 34 insertions, 2 deletions
diff --git a/src/gpg-error-config-new.in b/src/gpg-error-config-new.in
index 3b31a68..8bf92cf 100644
--- a/src/gpg-error-config-new.in
+++ b/src/gpg-error-config-new.in
@@ -395,6 +395,29 @@ all_required_config_files () {
PKG_LIST=$(list_only_once $all_list)
}
+#
+# Modify -I or -L by PKG_CONFIG_SYSROOT_DIR variable
+#
+sysroot () {
+ _opt="$1"
+ _result=""
+ shift
+
+ while [ $# -gt 0 ]; do
+ if [ $1 = $_opt ]; then
+ _result="$_result${_result:+ }$_opt"
+ shift
+ _result="$_result $PKG_CONFIG_SYSROOT_DIR$1"
+ elif expr "$1" : "^$_opt" >/dev/null; then
+ _result="$_result${_result:+ }$_opt$PKG_CONFIG_SYSROOT_DIR$(expr "$1" : "^$_opt\(.*\)")"
+ else
+ _result="$_result${_result:+ }$1"
+ fi
+ shift
+ done
+ echo "$_result"
+}
+
#### end of functions for this script
myname=${0##*/}
@@ -446,6 +469,13 @@ mtlibs=""
delimiter=" "
output=""
+VAR_list=VAR_pc_sysrootdir
+if [ -z "$PKG_CONFIG_SYSROOT_DIR" ]; then
+ VAR_pc_sysrootdir="/"
+else
+ VAR_pc_sysrootdir="$PKG_CONFIG_SYSROOT_DIR"
+fi
+
while test $# -gt 0; do
case $1 in
--prefix)
@@ -524,14 +554,14 @@ done
if [ -z "$want_var" -a -z "$want_attr" ]; then
if [ -n "$want_cflags" ]; then
- output="$output${output:+ }$(list_only_once $cflags)"
+ output="$output${output:+ }$(sysroot -I $(list_only_once $cflags))"
# Backward compatibility to old gpg-error-config
if [ $mt = yes -a -n "$mtcflags" ]; then
output="$output${output:+ }$mtcflags"
fi
fi
if [ -n "$want_libs" ]; then
- output="$output${output:+ }$(list_only_once_for_libs $libs)"
+ output="$output${output:+ }$(sysroot -L $(list_only_once_for_libs $libs))"
# Backward compatibility to old gpg-error-config
if [ $mt = yes -a -n "$mtlibs" ]; then
output="$output${output:+ }$mtlibs"
diff --git a/src/gpg-error-config-test.sh b/src/gpg-error-config-test.sh
index 0501c8d..527e118 100755
--- a/src/gpg-error-config-test.sh
+++ b/src/gpg-error-config-test.sh
@@ -7,6 +7,8 @@ export PKG_CONFIG_PATH
if [ "$1" = --old-new ]; then
PKG_CONFIG_CMD=./gpg-error-config-old
else
+ PKG_CONFIG_SYSROOT_DIR="/var/example-target"
+ export PKG_CONFIG_SYSROOT_DIR
PKG_CONFIG_CMD="pkg-config gpg-error"
if ! $PKG_CONFIG_CMD --exists >/dev/null; then
exit 77 # Skip tests