From 2732aadda6629a126748da20cf45651599dd80d1 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Tue, 26 Sep 2017 15:19:55 +0200 Subject: [PATCH] Fix building GnomeKeyring and KWallet password backend plugins Also remove KDE/GNOME integration options and instead always build the plugins when necessary dependencies are found. --- BUILDING.md | 16 ------------- CMakeLists.txt | 24 ++++++++----------- src/plugins/CMakeLists.txt | 23 +++++++----------- .../GnomeKeyringPasswords/CMakeLists.txt | 2 +- .../gnomekeyringpasswordbackend.h | 2 +- src/plugins/KWalletPasswords/CMakeLists.txt | 2 +- .../KWalletPasswords/kwalletpasswordbackend.h | 2 +- tests/autotests/CMakeLists.txt | 15 +++++++----- tests/autotests/passwordbackendtest.cpp | 2 +- 9 files changed, 32 insertions(+), 56 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 879a15cdd..30060068d 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -33,11 +33,9 @@ Linux / Unix To build KWallet plugin, you need: - KF5 KWallet - - set KDE_INTEGRATION build flag To build Gnome-Keyring plugin, you need - libgnome-keyring-dev installed - - set GNOME_INTEGRATION build flag For debug build, gdb is required by qmake. @@ -107,20 +105,6 @@ Available Defines example: $ export NO_X11="true" - KDE_INTEGRATION Enable KDE integration. - Currently it enables building of KWallet Password plugin, - which provides support for storing passwords in KWallet. - - example: - $ export KDE_INTEGRATION="true" - - GNOME_INTEGRATION Enable Gnome integration. - Currently it enables building of Gnome-Keyring Password plugin, - which provides support for storing passwords in Gnome-Keyring. - - example: - $ export GNOME_INTEGRATION="true" - USE_LIBPATH By default, /usr/lib/ is used for libFalkon and /usr/lib/falkon for plugins. You can change it by setting this define. diff --git a/CMakeLists.txt b/CMakeLists.txt index c73dfa4f9..66d566126 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,20 +36,6 @@ option(NO_SYSTEM_DATAPATH "TODO" OFF) if (NO_SYSTEM_DATAPATH) add_definitions(-DNO_SYSTEM_DATAPATH) endif() -option(KDE_INTEGRATION "TODO" OFF) -if (KDE_INTEGRATION) - set(KF5_MIN_VERSION "5.27.0") - find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS Wallet) - add_definitions(-DKDE_INTEGRATION) -endif() -option(GNOME_INTEGRATION "TODO" OFF) -if (GNOME_INTEGRATION) - find_package(PkgConfig) - if (PKG_CONFIG_FOUND) - pkg_check_modules(GNOME_KEYRING gnome-keyring-1) - endif() - add_definitions(-DGNOME_INTEGRATION) -endif() option(NO_X11 "TODO" OFF) if (NO_X11) add_definitions(-DNO_X11) @@ -98,6 +84,16 @@ if (WIN32) # TODO set var for LIBS += User32.lib Ole32.lib Shell32.lib ShlWapi.lib Gdi32.lib ComCtl32.lib ? endif() +# Optional: GnomeKeyring +find_package(PkgConfig) +if (PKG_CONFIG_FOUND) + pkg_check_modules(GNOME_KEYRING gnome-keyring-1) +endif() + +# Optional: KWallet +set(KF5_MIN_VERSION "5.27.0") +find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS Wallet) + # Git revision if (EXISTS "${CMAKE_SOURCE_DIR}/.git") find_package(Git QUIET) diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index be8ba44a1..1719a32c9 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -6,28 +6,21 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/plugins") add_subdirectory(AutoScroll) add_subdirectory(FlashCookieManager) - -# GnomeKeyringPasswords only with GNOME_INTEGRATION and gnome-keyring pkg-config -if (GNOME_INTEGRATION AND GNOME_KEYRING_FOUND) - add_subdirectory(GnomeKeyringPasswords) -endif() - add_subdirectory(GreaseMonkey) add_subdirectory(ImageFinder) - -# KWalletPasswords only with KDE_INTEGRATION and KWallet framework -if (KDE_INTEGRATION AND KF5Wallet_FOUND) - add_subdirectory(KWalletPasswords) -endif() - add_subdirectory(MouseGestures) add_subdirectory(PIM) add_subdirectory(StatusBarIcons) add_subdirectory(TabManager) -# TestPlugin only in debug build +if (GNOME_KEYRING_FOUND) + add_subdirectory(GnomeKeyringPasswords) +endif() + +if (KF5Wallet_FOUND) + add_subdirectory(KWalletPasswords) +endif() + if (CMAKE_BUILD_TYPE STREQUAL "Debug") add_subdirectory(TestPlugin) endif() - -# Not ported to cmake, for lack of a testcase: addSubdir($$(FALKON_PLUGINS_SRCDIR)) diff --git a/src/plugins/GnomeKeyringPasswords/CMakeLists.txt b/src/plugins/GnomeKeyringPasswords/CMakeLists.txt index 810ebcbf1..e876cc9f8 100644 --- a/src/plugins/GnomeKeyringPasswords/CMakeLists.txt +++ b/src/plugins/GnomeKeyringPasswords/CMakeLists.txt @@ -1,4 +1,4 @@ -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GNOME_KEYRING_CFLAGS}") +add_definitions(${GNOME_KEYRING_CFLAGS} ${GNOME_KEYRING_CFLAGS_OTHER}) set( GnomeKeyringPasswords_SRCS gnomekeyringplugin.cpp diff --git a/src/plugins/GnomeKeyringPasswords/gnomekeyringpasswordbackend.h b/src/plugins/GnomeKeyringPasswords/gnomekeyringpasswordbackend.h index 62a7dd481..68a1c81f1 100644 --- a/src/plugins/GnomeKeyringPasswords/gnomekeyringpasswordbackend.h +++ b/src/plugins/GnomeKeyringPasswords/gnomekeyringpasswordbackend.h @@ -23,7 +23,7 @@ #include "passwordbackends/passwordbackend.h" #include "passwordmanager.h" -class GnomeKeyringPasswordBackend : public PasswordBackend +class FALKON_EXPORT GnomeKeyringPasswordBackend : public PasswordBackend { public: explicit GnomeKeyringPasswordBackend(); diff --git a/src/plugins/KWalletPasswords/CMakeLists.txt b/src/plugins/KWalletPasswords/CMakeLists.txt index 6b503afa8..5d74ebc98 100644 --- a/src/plugins/KWalletPasswords/CMakeLists.txt +++ b/src/plugins/KWalletPasswords/CMakeLists.txt @@ -10,5 +10,5 @@ qt5_add_resources(RSCS ${KWalletPasswords_RSCS}) add_library(KWalletPasswords MODULE ${KWalletPasswords_SRCS} ${RSCS}) install(TARGETS KWalletPasswords DESTINATION ${KDE_INSTALL_PLUGINDIR}) -target_link_libraries(KWalletPasswords KF5::KWallet) +target_link_libraries(KWalletPasswords FalkonPrivate KF5::Wallet) diff --git a/src/plugins/KWalletPasswords/kwalletpasswordbackend.h b/src/plugins/KWalletPasswords/kwalletpasswordbackend.h index 749a4535b..2752f0f5a 100644 --- a/src/plugins/KWalletPasswords/kwalletpasswordbackend.h +++ b/src/plugins/KWalletPasswords/kwalletpasswordbackend.h @@ -27,7 +27,7 @@ namespace KWallet { class Wallet; } -class KWalletPasswordBackend : public PasswordBackend +class FALKON_EXPORT KWalletPasswordBackend : public PasswordBackend { public: explicit KWalletPasswordBackend(); diff --git a/tests/autotests/CMakeLists.txt b/tests/autotests/CMakeLists.txt index b5f4bfe47..44a556cd6 100644 --- a/tests/autotests/CMakeLists.txt +++ b/tests/autotests/CMakeLists.txt @@ -1,13 +1,17 @@ set(autotests_EXTRA_LIBS ) -if (KDE_INTEGRATION AND KF5Wallet_FOUND) +if (KF5Wallet_FOUND) add_definitions(-DHAVE_KDE_PASSWORDS_PLUGIN) - set(autotests_EXTRA_LIBS ${autotests_EXTRA_LIBS} ${CMAKE_BINARY_DIR}/bin/plugins/libKWalletPasswords.so) + add_library(KWalletPasswordsPluginLib UNKNOWN IMPORTED) + set_property(TARGET KWalletPasswordsPluginLib PROPERTY IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/bin/plugins/KWalletPasswords.so) + set(autotests_EXTRA_LIBS ${autotests_EXTRA_LIBS} KWalletPasswordsPluginLib) endif() -if (GNOME_INTEGRATION AND GNOME_KEYRING_FOUND) +if (GNOME_KEYRING_FOUND) add_definitions(-DHAVE_GNOME_PASSWORDS_PLUGIN) - set(autotests_EXTRA_LIBS ${autotests_EXTRA_LIBS} ${CMAKE_BINARY_DIR}/bin/plugins/libGnomeKeyringPasswords.so) + add_library(GnomeKeyringPasswordsPluginLib UNKNOWN IMPORTED) + set_property(TARGET GnomeKeyringPasswordsPluginLib PROPERTY IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/bin/plugins/GnomeKeyringPasswords.so) + set(autotests_EXTRA_LIBS ${autotests_EXTRA_LIBS} GnomeKeyringPasswordsPluginLib) endif() set( autotests_SRCS @@ -20,5 +24,4 @@ set( autotests_SRCS ) add_executable(autotests ${autotests_SRCS}) -target_link_libraries(autotests FalkonPrivate Qt5::Test) - +target_link_libraries(autotests FalkonPrivate Qt5::Test ${autotests_EXTRA_LIBS}) diff --git a/tests/autotests/passwordbackendtest.cpp b/tests/autotests/passwordbackendtest.cpp index 889327d8c..e80efd8c1 100644 --- a/tests/autotests/passwordbackendtest.cpp +++ b/tests/autotests/passwordbackendtest.cpp @@ -274,7 +274,7 @@ void DatabaseEncryptedPasswordBackendTest::cleanup() #ifdef HAVE_KDE_PASSWORDS_PLUGIN // KWalletPassswordBackendTest -void KWalletPassswordBackendTest::init() +void KWalletPasswordBackendTest::init() { QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.DBus"), QStringLiteral("/org/freedesktop/DBus"),