diff --git a/config/functions b/config/functions index 5384cb9486..6d7b3e7f2c 100644 --- a/config/functions +++ b/config/functions @@ -175,6 +175,24 @@ flag_enabled() { fi } +setup_pkg_config_target() { + export PKG_CONFIG="$TOOLCHAIN/bin/pkg-config" + export PKG_CONFIG_PATH="" + export PKG_CONFIG_LIBDIR="$SYSROOT_PREFIX/usr/lib/pkgconfig:$SYSROOT_PREFIX/usr/share/pkgconfig" + export PKG_CONFIG_SYSROOT_DIR="$SYSROOT_PREFIX" + export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 + export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 +} + +setup_pkg_config_host() { + export PKG_CONFIG="$TOOLCHAIN/bin/pkg-config" + export PKG_CONFIG_PATH="" + export PKG_CONFIG_LIBDIR="$TOOLCHAIN/lib/pkgconfig:$TOOLCHAIN/share/pkgconfig" + export PKG_CONFIG_SYSROOT_DIR="" + unset PKG_CONFIG_ALLOW_SYSTEM_CFLAGS + unset PKG_CONFIG_ALLOW_SYSTEM_LIBS +} + setup_toolchain() { if [ "$LTO_SUPPORT" = "yes" ]; then if flag_enabled "lto-parallel" "no"; then @@ -256,12 +274,7 @@ setup_toolchain() { export CFLAGS="$TARGET_CFLAGS" export CXXFLAGS="$TARGET_CXXFLAGS" export LDFLAGS="$TARGET_LDFLAGS" - export PKG_CONFIG="$TOOLCHAIN/bin/pkg-config" - export PKG_CONFIG_PATH="" - export PKG_CONFIG_LIBDIR="$SYSROOT_PREFIX/usr/lib/pkgconfig:$SYSROOT_PREFIX/usr/share/pkgconfig" - export PKG_CONFIG_SYSROOT_DIR="$SYSROOT_PREFIX" - export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 - export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 + setup_pkg_config_target export CMAKE_CONF=$TOOLCHAIN/etc/cmake-$TARGET_NAME.conf export CMAKE="cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF -DCMAKE_INSTALL_PREFIX=/usr" if [ ! -f $CMAKE_CONF ] ; then @@ -308,12 +321,7 @@ setup_toolchain() { export CFLAGS="$HOST_CFLAGS" export CXXFLAGS="$HOST_CXXFLAGS" export LDFLAGS="$HOST_LDFLAGS" - export PKG_CONFIG="$TOOLCHAIN/bin/pkg-config" - export PKG_CONFIG_PATH="" - export PKG_CONFIG_LIBDIR="$TOOLCHAIN/lib/pkgconfig:$TOOLCHAIN/share/pkgconfig" - export PKG_CONFIG_SYSROOT_DIR="" - unset PKG_CONFIG_ALLOW_SYSTEM_CFLAGS - unset PKG_CONFIG_ALLOW_SYSTEM_LIBS + setup_pkg_config_host export CMAKE_CONF=$TOOLCHAIN/etc/cmake-$HOST_NAME.conf export CMAKE="cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF -DCMAKE_INSTALL_PREFIX=$TOOLCHAIN" if [ ! -f $CMAKE_CONF ] ; then