diff options
-rw-r--r-- | application-manager.pro | 3 | ||||
-rw-r--r-- | config.tests/libdbus/libdbus.pro | 8 | ||||
-rw-r--r-- | config.tests/libdbus/main.cpp | 49 | ||||
-rw-r--r-- | doc/installation.qdoc | 2 | ||||
-rw-r--r-- | qmake-features/am-config.prf | 2 | ||||
-rw-r--r-- | src/manager-lib/manager-lib.pro | 2 | ||||
-rw-r--r-- | src/manager-lib/nativeruntime.cpp | 13 |
7 files changed, 14 insertions, 65 deletions
diff --git a/application-manager.pro b/application-manager.pro index 4e78221a..b32cb8bb 100644 --- a/application-manager.pro +++ b/application-manager.pro @@ -13,7 +13,6 @@ else:contains(QT_BUILD_PARTS, "examples"):CONFIG += enable-examples load(configure) qtCompileTest(libarchive) qtCompileTest(libyaml) -qtCompileTest(libdbus) qtHaveModule(compositor)|if(qtHaveModule(waylandcompositor):qtHaveModule(waylandcompositor-private)) { CONFIG += am_compatible_compositor @@ -21,7 +20,6 @@ qtHaveModule(compositor)|if(qtHaveModule(waylandcompositor):qtHaveModule(wayland force-single-process:force-multi-process:error("You cannot both specify force-single-process and force-multi-process") force-multi-process:!headless:!am_compatible_compositor:error("You forced multi-process mode, but the QtCompositor module is not available") -force-multi-process:!config_libdbus:error("You forced multi-process mode, but libdbus-1 (>= 1.6) is not available") if(linux|force-libcrypto) { !if(contains(QT_CONFIG,"openssl")|contains(QT_CONFIG,"openssl-linked")):error("Qt was built without OpenSSL support.") @@ -110,7 +108,6 @@ OTHER_FILES += \ header.*[^~] \ LICENSE.*[^~] \ config.tests/libarchive/* \ - config.tests/libdbus/* \ config.tests/libyaml/* \ GCOV_EXCLUDE = /usr/* \ diff --git a/config.tests/libdbus/libdbus.pro b/config.tests/libdbus/libdbus.pro deleted file mode 100644 index d83ca093..00000000 --- a/config.tests/libdbus/libdbus.pro +++ /dev/null @@ -1,8 +0,0 @@ -TARGET = libdbus -CONFIG -= qt -CONFIG += console - -SOURCES += main.cpp - -PKGCONFIG += "'dbus-1 >= 1.6'" -CONFIG += link_pkgconfig diff --git a/config.tests/libdbus/main.cpp b/config.tests/libdbus/main.cpp deleted file mode 100644 index 77ddc7f4..00000000 --- a/config.tests/libdbus/main.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Pelagicore Application Manager. -** -** $QT_BEGIN_LICENSE:LGPL-QTAS$ -** Commercial License Usage -** Licensees holding valid commercial Qt Automotive Suite licenses may use -** this file in accordance with the commercial license agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and The Qt Company. For -** licensing terms and conditions see https://www.qt.io/terms-conditions. -** For further information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -** SPDX-License-Identifier: LGPL-3.0 -** -****************************************************************************/ - -#include <dbus/dbus.h> - -int main() -{ - int major, minor, micro; - dbus_get_version(&major, &minor, µ); - return 0; -} diff --git a/doc/installation.qdoc b/doc/installation.qdoc index 9ee7f78b..f882a583 100644 --- a/doc/installation.qdoc +++ b/doc/installation.qdoc @@ -75,7 +75,7 @@ to single-process mode, if certain dependencies are not available: \list \li You are building for \b Linux. \li The \b QtWayland module is available. -\li \b libdbus 1.6 or higher is available. +\li The \b QtDBus module is available. \endlist You can force the build mode though via the respective \c -config options \c force-multi-process and diff --git a/qmake-features/am-config.prf b/qmake-features/am-config.prf index 5b475d32..f2495d66 100644 --- a/qmake-features/am-config.prf +++ b/qmake-features/am-config.prf @@ -17,7 +17,7 @@ headless:DEFINES *= AM_HEADLESS linux:!disable-libbacktrace:if(enable-libbacktrace|CONFIG(debug, debug|release)):DEFINES *= AM_USE_LIBBACKTRACE !force-single-process { - linux:config_libdbus { + linux { headless|qtHaveModule(compositor)|if(qtHaveModule(waylandcompositor):qtHaveModule(waylandcompositor-private)) { CONFIG *= auto-multi-process } diff --git a/src/manager-lib/manager-lib.pro b/src/manager-lib/manager-lib.pro index 1ff00427..d80c2037 100644 --- a/src/manager-lib/manager-lib.pro +++ b/src/manager-lib/manager-lib.pro @@ -17,7 +17,7 @@ QT_FOR_PRIVATE *= \ CONFIG *= static internal_module multi-process { - PKGCONFIG += "'dbus-1 >= 1.6'" + LIBS += -ldl } HEADERS += \ diff --git a/src/manager-lib/nativeruntime.cpp b/src/manager-lib/nativeruntime.cpp index a3e0da4d..839b5c98 100644 --- a/src/manager-lib/nativeruntime.cpp +++ b/src/manager-lib/nativeruntime.cpp @@ -70,14 +70,23 @@ QT_BEGIN_NAMESPACE_AM #if defined(AM_MULTI_PROCESS) QT_END_NAMESPACE_AM -# include <dbus/dbus.h> +# include <dlfcn.h> # include <sys/socket.h> QT_BEGIN_NAMESPACE_AM static qint64 getDBusPeerPid(const QDBusConnection &conn) { + typedef bool (*am_dbus_connection_get_socket_t)(void *, int *); + static am_dbus_connection_get_socket_t am_dbus_connection_get_socket = nullptr; + + if (!am_dbus_connection_get_socket) + am_dbus_connection_get_socket = (am_dbus_connection_get_socket_t) dlsym(RTLD_DEFAULT, "dbus_connection_get_socket"); + + if (!am_dbus_connection_get_socket) + qFatal("ERROR: could not resolve 'dbus_connection_get_socket' from libdbus-1"); + int socketFd = -1; - if (dbus_connection_get_socket(static_cast<DBusConnection *>(conn.internalPointer()), &socketFd)) { + if (am_dbus_connection_get_socket(conn.internalPointer(), &socketFd)) { struct ucred ucred; socklen_t ucredSize = sizeof(struct ucred); if (getsockopt(socketFd, SOL_SOCKET, SO_PEERCRED, &ucred, &ucredSize) == 0) |