Improve dbus cross compilation

Building QtDBus on Linux host for QNX target had two issues:
* Configure check failed, because dbus-1 library was not linked in,
  if target platform doesn't support pkg-config.
* Host tools were not built, because pkg-config was not used to locate
  dbus headers on the host.

Task-number: QTBUG-37324
Change-Id: I71d8309599fd40ef2dd8c9e3b44b93a7482019f1
Reviewed-by: Rolf Eike Beer <eb@emlix.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
bb10
Bernd Weimer 2014-07-09 11:58:44 +02:00
parent 553325abfd
commit ec703836b3
6 changed files with 24 additions and 7 deletions

10
configure vendored
View File

@ -4584,11 +4584,19 @@ if [ "$CFG_DBUS" != "no" ]; then
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then
QT_CFLAGS_DBUS=`$PKG_CONFIG --cflags dbus-1 2>/dev/null`
QT_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null`
else
QT_LIBS_DBUS="-ldbus-1"
fi
if compileTest unix/dbus "D-Bus" $QT_CFLAGS_DBUS $QT_LIBS_DBUS; then
[ "$CFG_DBUS" = "auto" ] && CFG_DBUS=yes
QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
QMakeVar set QT_LIBS_DBUS "$QT_LIBS_DBUS"
QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
# Try find correct host configuration for dbus tools when cross-compiling
if [ "$QT_CROSS_COMPILE" = "yes" ] && env -i PATH="$PATH" \
pkg-config --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then
QT_CFLAGS_DBUS=`env -i PATH="$PATH" pkg-config --cflags dbus-1 2>/dev/null`
fi
QMakeVar set QT_HOST_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
else
if [ "$CFG_DBUS" = "auto" ]; then
CFG_DBUS=no

View File

@ -15,7 +15,7 @@ MODULE_PRIVATE_INCLUDES = \
load(qt_module)
QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
QMAKE_CXXFLAGS += $$QT_HOST_CFLAGS_DBUS
SOURCES = \
../../dbus/qdbusintrospection.cpp \

View File

@ -3,7 +3,7 @@ QT = core-private
force_bootstrap: QT += bootstrap_dbus-private
else: QT += dbus-private
DEFINES += QT_NO_CAST_FROM_ASCII
QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
QMAKE_CXXFLAGS += $$QT_HOST_CFLAGS_DBUS
include(../moc/moc.pri)

View File

@ -3,7 +3,7 @@ QT = core-private
force_bootstrap: QT += bootstrap_dbus-private
else: QT += dbus-private
DEFINES += QT_NO_CAST_FROM_ASCII
QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
QMAKE_CXXFLAGS += $$QT_HOST_CFLAGS_DBUS
SOURCES = qdbusxml2cpp.cpp

View File

@ -1008,6 +1008,8 @@ void Configure::parseCmdLine()
sybaseLibs = configCmdLine.at(i);
} else if (configCmdLine.at(i).startsWith("DBUS_PATH=")) {
dbusPath = QDir::fromNativeSeparators(configCmdLine.at(i).section("=", 1));
} else if (configCmdLine.at(i).startsWith("DBUS_HOST_PATH=")) {
dbusHostPath = QDir::fromNativeSeparators(configCmdLine.at(i).section("=", 1));
} else if (configCmdLine.at(i).startsWith("MYSQL_PATH=")) {
mysqlPath = QDir::fromNativeSeparators(configCmdLine.at(i).section("=", 1));
} else if (configCmdLine.at(i).startsWith("ZLIB_LIBS=")) {
@ -2938,9 +2940,15 @@ void Configure::generateOutputVars()
qmakeVars += QString("OPENSSL_LIBS += -L%1/lib").arg(opensslPath);
}
}
if (dictionary[ "DBUS" ] != "no" && !dbusPath.isEmpty()) {
qmakeVars += QString("QT_CFLAGS_DBUS = -I%1/include").arg(dbusPath);
qmakeVars += QString("QT_LIBS_DBUS = -L%1/lib").arg(dbusPath);
if (dictionary[ "DBUS" ] != "no") {
if (!dbusPath.isEmpty()) {
qmakeVars += QString("QT_CFLAGS_DBUS = -I%1/include").arg(dbusPath);
qmakeVars += QString("QT_LIBS_DBUS = -L%1/lib").arg(dbusPath);
if (dbusHostPath.isEmpty())
qmakeVars += QString("QT_HOST_CFLAGS_DBUS = -I%1/include").arg(dbusPath);
}
if (!dbusHostPath.isEmpty())
qmakeVars += QString("QT_HOST_CFLAGS_DBUS = -I%1/include").arg(dbusHostPath);
}
if (dictionary[ "SQL_MYSQL" ] != "no" && !mysqlPath.isEmpty()) {
qmakeVars += QString("QT_CFLAGS_MYSQL = -I%1/include").arg(mysqlPath);

View File

@ -140,6 +140,7 @@ private:
QString opensslLibsRelease;
QString opensslPath;
QString dbusPath;
QString dbusHostPath;
QString mysqlPath;
QString psqlLibs;
QString zlibLibs;