From 535117078c85eed797afe0d2d2af180c9b362d7f Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 25 Sep 2014 14:37:06 +0200 Subject: [PATCH] xbps-src: create a -pkg-config wrapper when cross compiling. This wrapper sets the env vars required for proper cross compiling, rather than always setting them. --- common/environment/configure/pkg-config.sh | 6 ------ common/hooks/pre-configure/02-script-wrapper.sh | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/common/environment/configure/pkg-config.sh b/common/environment/configure/pkg-config.sh index 5799a4106a4..88510caef6e 100644 --- a/common/environment/configure/pkg-config.sh +++ b/common/environment/configure/pkg-config.sh @@ -6,10 +6,4 @@ if [ -z "$CHROOT_READY" ]; then PKG_CONFIG_PATH="${XBPS_MASTERDIR}/usr/lib/pkgconfig:${XBPS_MASTERDIR}/usr/share/pkgconfig" fi -if [ "$CROSS_BUILD" ]; then - PKG_CONFIG_SYSROOT_DIR="$XBPS_CROSS_BASE" - PKG_CONFIG_PATH="$XBPS_CROSS_BASE/lib/pkgconfig:$XBPS_CROSS_BASE/usr/share/pkgconfig" - PKG_CONFIG_LIBDIR="$XBPS_CROSS_BASE/lib/pkgconfig" -fi - set +a diff --git a/common/hooks/pre-configure/02-script-wrapper.sh b/common/hooks/pre-configure/02-script-wrapper.sh index 2055a79a24e..865934ea05a 100644 --- a/common/hooks/pre-configure/02-script-wrapper.sh +++ b/common/hooks/pre-configure/02-script-wrapper.sh @@ -62,12 +62,28 @@ _EOF chmod 755 ${WRAPPERDIR}/${wrapper} } +pkgconfig_wrapper() { + if [ ! -x /usr/bin/pkg-config ]; then + return 0 + fi + cat >>${WRAPPERDIR}/${XBPS_CROSS_TRIPLET}-pkg-config<<_EOF +#!/bin/sh + +export PKG_CONFIG_SYSROOT_DIR="$XBPS_CROSS_BASE" +export PKG_CONFIG_PATH="$XBPS_CROSS_BASE/lib/pkgconfig:$XBPS_CROSS_BASE/usr/share/pkgconfig" +export PKG_CONFIG_LIBDIR="$XBPS_CROSS_BASE/lib/pkgconfig" +exec /usr/bin/pkg-config "\$@" +_EOF + chmod 755 ${WRAPPERDIR}/${XBPS_CROSS_TRIPLET}-pkg-config +} + hook() { [ -z "$CROSS_BUILD" ] && return 0 mkdir -p ${WRAPPERDIR} # create wrapers + pkgconfig_wrapper generic_wrapper icu-config generic_wrapper libgcrypt-config generic_wrapper freetype-config