Skip to content

Commit

Permalink
config/functions: factor out pkg-config setup into functions
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Reichl <hias@horus.com>
  • Loading branch information
HiassofT authored and adamg committed Apr 14, 2019
1 parent bcd6369 commit c67dce6
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions config/functions
Expand Up @@ -161,6 +161,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
Expand Down Expand Up @@ -242,12 +260,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
Expand Down Expand Up @@ -294,12 +307,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
Expand Down

0 comments on commit c67dce6

Please sign in to comment.