summaryrefslogtreecommitdiffstats
path: root/mkspecs
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2016-11-05 01:52:00 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2016-11-05 01:53:17 +0100
commite79ceb97340699ed806aa021e1bda4b63fa6f3fe (patch)
tree7e9ff3f64e026562eb76b523aa6be615d466598b /mkspecs
parent825bb10d9bf40587828e4e589b199a9ffec255ce (diff)
parenta21ffd44b3a13a9ef64a56e67f6e267292f0a8e2 (diff)
Merge remote-tracking branch 'gerrit/5.8' into dev
Diffstat (limited to 'mkspecs')
-rw-r--r--mkspecs/features/qt_functions.prf62
1 files changed, 49 insertions, 13 deletions
diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf
index 0f43af10ed..c00fdb73f8 100644
--- a/mkspecs/features/qt_functions.prf
+++ b/mkspecs/features/qt_functions.prf
@@ -237,17 +237,58 @@ defineTest(qtAddTargetEnv) {
defineReplace(pkgConfigExecutable) {
isEmpty(PKG_CONFIG) {
- !isEmpty(QMAKE_PKG_CONFIG): \
+ !isEmpty(QMAKE_PKG_CONFIG) {
+ # Assumed to be properly sysrootified.
PKG_CONFIG = $$QMAKE_PKG_CONFIG
- else: \
+ export(PKG_CONFIG)
+ } else {
PKG_CONFIG = pkg-config
+ !cross_compile {
+ export(PKG_CONFIG)
+ } else {
+ # Cross compiling, ensure that pkg-config is set up sanely.
+ sysroot = $$[QT_SYSROOT]
+
+ pkgConfigLibdir = $$(PKG_CONFIG_LIBDIR)
+ isEmpty(pkgConfigLibdir) {
+ isEmpty(sysroot) {
+ warning("Cross compiling without sysroot. Disabling pkg-config.")
+ return()
+ }
+ !exists("$$sysroot/usr/lib/pkgconfig") {
+ warning("Disabling pkg-config since PKG_CONFIG_LIBDIR is not set and the")
+ warning("host's .pc files would be used (even if you set PKG_CONFIG_PATH).")
+ warning("Set this variable to the directory that contains target .pc files")
+ warning("for pkg-config to function correctly when cross-compiling.")
+ return()
+ }
+
+ pkgConfigLibdir = $$system_path($$sysroot/usr/lib/pkgconfig)$$QMAKE_DIRLIST_SEP$$system_path($$sysroot/usr/share/pkgconfig)
+ !isEmpty(GCC_MACHINE_DUMP): \
+ pkgConfigLibdir = "$$pkgConfigLibdir$$QMAKE_DIRLIST_SEP$$system_path($$sysroot/usr/lib/$$GCC_MACHINE_DUMP/pkgconfig)"
+ message("PKG_CONFIG_LIBDIR automatically set to $$pkgConfigLibdir")
+ }
+ pkgConfigSysrootDir = $$(PKG_CONFIG_SYSROOT_DIR)
+ isEmpty(pkgConfigSysrootDir) {
+ isEmpty(sysroot) {
+ warning("Disabling pkg-config since PKG_CONFIG_SYSROOT_DIR is not set.")
+ warning("Set this variable to your sysroot for pkg-config to function")
+ warning("correctly when cross-compiling.")
+ return()
+ }
- sysroot.name = PKG_CONFIG_SYSROOT_DIR
- sysroot.value = $$PKG_CONFIG_SYSROOT_DIR
- libdir.name = PKG_CONFIG_LIBDIR
- libdir.value = $$PKG_CONFIG_LIBDIR
- QT_TOOL_NAME = pkg-config
- qtAddToolEnv(PKG_CONFIG, sysroot libdir, SYS)
+ pkgConfigSysrootDir = $$sysroot
+ message("PKG_CONFIG_SYSROOT_DIR automatically set to $$pkgConfigSysrootDir")
+ }
+
+ sysroot.name = PKG_CONFIG_SYSROOT_DIR
+ sysroot.value = $$pkgConfigSysrootDir
+ libdir.name = PKG_CONFIG_LIBDIR
+ libdir.value = $$pkgConfigLibdir
+ QT_TOOL_NAME = pkg-config
+ qtAddToolEnv(PKG_CONFIG, sysroot libdir, SYS)
+ }
+ }
}
equals(QMAKE_HOST.os, Windows): \
@@ -259,11 +300,6 @@ defineReplace(pkgConfigExecutable) {
}
defineTest(packagesExist) {
- !qtConfig(pkg-config) {
- warning("pkg-config disabled, can't check package existence")
- return(false)
- }
-
# 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.