From a0d1b996093cbf4e2b59885004a1cb57d743757b Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Wed, 19 Oct 2011 15:36:33 +0200 Subject: Make pkg-config cross-compile aware Introduce PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_LIBDIR for cross-compilation environments Change-Id: I859d55f125b18d6bdef0f1dfaeb43721b85d22f5 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/link_pkgconfig.prf | 3 +-- mkspecs/features/qt_functions.prf | 23 +++++++++++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'mkspecs') diff --git a/mkspecs/features/link_pkgconfig.prf b/mkspecs/features/link_pkgconfig.prf index 91683f6392..20b3e10550 100644 --- a/mkspecs/features/link_pkgconfig.prf +++ b/mkspecs/features/link_pkgconfig.prf @@ -1,5 +1,4 @@ -# handle pkg-config files -isEmpty(PKG_CONFIG):PKG_CONFIG = pkg-config # keep consistent with qt_functions.prf too! +PKG_CONFIG = $$pkgConfigExecutable() for(PKGCONFIG_LIB, $$list($$unique(PKGCONFIG))) { # don't proceed if the .pro asks for a package we don't have! diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index 09b1b8a34b..ca38f31569 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -192,14 +192,33 @@ defineTest(qtPrepareTool) { export($$1) } +defineReplace(pkgConfigExecutable) { + isEmpty(PKG_CONFIG) { + PKG_CONFIG = pkg-config + + !isEmpty(PKG_CONFIG_SYSROOT_DIR) { + win32:isEmpty(MINGW_IN_SHELL):PKG_CONFIG = set PKG_CONFIG_SYSROOT_DIR=$$PKG_CONFIG_SYSROOT_DIR& $$PKG_CONFIG + else:PKG_CONFIG = PKG_CONFIG_SYSROOT_DIR=\"$$PKG_CONFIG_SYSROOT_DIR\" $$PKG_CONFIG + } + + !isEmpty(PKG_CONFIG_LIBDIR) { + win32:isEmpty(MINGW_IN_SHELL):PKG_CONFIG = set PKG_CONFIG_LIBDIR=$$PKG_CONFIG_LIBDIR& $$PKG_CONFIG + else:PKG_CONFIG = PKG_CONFIG_LIBDIR=\"$$PKG_CONFIG_LIBDIR\" $$PKG_CONFIG + } + } + + return($$PKG_CONFIG) +} + defineTest(packagesExist) { # this can't be done in global scope here because qt_functions is loaded # before the .pro is parsed, so if the .pro set PKG_CONFIG, we wouldn't know it # yet. oops. - isEmpty(PKG_CONFIG):PKG_CONFIG = pkg-config # keep consistent with link_pkgconfig.prf! too + + pkg_config = $$pkgConfigExecutable() for(package, ARGS) { - !system($$PKG_CONFIG --exists $$package):return(false) + !system($$pkg_config --exists $$package):return(false) } return(true) -- cgit v1.2.3