aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Komissarov <ABBAPOH@gmail.com>2019-05-09 09:54:42 +0200
committerIvan Komissarov <ABBAPOH@gmail.com>2019-05-27 09:56:49 +0000
commit79695499bbdd0eb804dd7e15d571481ae47d6f25 (patch)
treed7e56b5fa171bba96446620ef711cca56bf88906
parent8c7b2115e6e2641c1c41d2082c087ea3d0fc101f (diff)
Add pkgconfig.sysroot property
By default, pkg-config uses qbs.sysroot property which is not desirable in some cases - for example, on macOS, even build for current system is sysrooted to the SDK folder within XCode installation. pkg-config installed with brew resides in /usr/local and can't be found within an SDK dir. For that reason, it make sense to override it manually Change-Id: Ibf779fd1bf0e87189abb2eab23d4e9e153fcca17 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--doc/reference/items/probe/pkgconfig-probe.qdoc20
-rw-r--r--doc/reference/modules/pkgconfig-module.qdoc23
-rw-r--r--share/qbs/module-providers/__fallback/fallback.qbs1
-rw-r--r--share/qbs/modules/pkgconfig/pkgconfig.qbs5
4 files changed, 49 insertions, 0 deletions
diff --git a/doc/reference/items/probe/pkgconfig-probe.qdoc b/doc/reference/items/probe/pkgconfig-probe.qdoc
index 1de84263e..7bdaf4e19 100644
--- a/doc/reference/items/probe/pkgconfig-probe.qdoc
+++ b/doc/reference/items/probe/pkgconfig-probe.qdoc
@@ -59,6 +59,20 @@
*/
/*!
+ \qmlproperty string PkgConfigProbe::sysroot
+
+ This property sets the value of the \c PKG_CONFIG_SYSROOT_DIR environment variable passed to
+ the \c pkg-config binary. This variable modifies -I and -L flags to use the directories located
+ in target sysroot.
+
+ This property is useful when cross-compiling packages that use \c pkg-config to determine CFLAGS
+ and LDFLAGS. For example, if \c sysroot is set to \c /var/target, a \c -I/usr/include/libfoo
+ will become \c -I/var/target/usr/include/libfoo.
+
+ \defaultvalue \c qbs.sysroot
+*/
+
+/*!
\qmlproperty string PkgConfigProbe::executable
The name of or the path to the pkg-config executable.
@@ -125,6 +139,9 @@
List of full, non-sysrooted paths where pkg-config should search for .pc files. This overrides
the built-in path (which is usually /usr/lib/pkgconfig).
+ This property sets the value of the \c PKG_CONFIG_LIBDIR environment variable passed to
+ the \c pkg-config binary.
+
\nodefaultvalue
*/
@@ -178,6 +195,9 @@
This output property contains the list of library paths that should be passed to a linker when
using requested package.
+ This property sets the value of the PKG_CONFIG_LIBDIR environment variable passed to
+ the \c pkg-config binary.
+
\nodefaultvalue
*/
diff --git a/doc/reference/modules/pkgconfig-module.qdoc b/doc/reference/modules/pkgconfig-module.qdoc
index 898349628..f30308895 100644
--- a/doc/reference/modules/pkgconfig-module.qdoc
+++ b/doc/reference/modules/pkgconfig-module.qdoc
@@ -67,3 +67,26 @@
\defaultvalue \c false
*/
+
+/*!
+ \qmlproperty path pkgconfig::sysroot
+
+ This property controls the value of the \l{PkgConfigProbe::sysroot}{PkgConfigProbe.sysroot}
+ property.
+
+ Set this property if you need to overwrite the default search sysroot path used by
+ \c pkg-config.
+
+ This can be useful if \c pkg-config files are located in the directory other than qbs.sysroot.
+ This is the case on macOS platform - all XCode profiles are sysrooted to the SDK
+ directory, but \c pkg-config is typically intalled using Brew and resides in the
+ \c /usr/local directory.
+
+ Setting this property to \c undefined or empty (\c "") value will use pkg-config's default
+ search paths:
+ \code
+ qbs build modules.pkgconfig.sysroot:undefined
+ \endcode
+
+ \defaultvalue \c "" on macOS, \c qbs.sysroot on other platforms
+*/
diff --git a/share/qbs/module-providers/__fallback/fallback.qbs b/share/qbs/module-providers/__fallback/fallback.qbs
index e23851951..632d1aa7a 100644
--- a/share/qbs/module-providers/__fallback/fallback.qbs
+++ b/share/qbs/module-providers/__fallback/fallback.qbs
@@ -50,6 +50,7 @@ Module {
Probes.PkgConfigProbe {
id: pkgConfigProbe
condition: pkgconfig.present
+ sysroot: pkgconfig.sysroot
name: theName
executable: pkgconfig.executableFilePath
libDirs: pkgconfig.libDirs
diff --git a/share/qbs/modules/pkgconfig/pkgconfig.qbs b/share/qbs/modules/pkgconfig/pkgconfig.qbs
index 92e0bfb25..ec4b59188 100644
--- a/share/qbs/modules/pkgconfig/pkgconfig.qbs
+++ b/share/qbs/modules/pkgconfig/pkgconfig.qbs
@@ -47,6 +47,11 @@ Module {
names: "pkg-config"
}
+ property path sysroot: {
+ if (qbs.targetOS.contains("macos"))
+ return "";
+ return qbs.sysroot;
+ }
property string executableFilePath: pkgconfigProbe.filePath
property stringList libDirs
property bool staticMode: false