app-admin/keepassxc: Make ccache usage optional
authorLars Wendler <polynomial-c@gentoo.org>
Wed, 8 Jan 2020 08:10:52 +0000 (09:10 +0100)
committerLars Wendler <polynomial-c@gentoo.org>
Wed, 8 Jan 2020 08:11:17 +0000 (09:11 +0100)
Closes: https://bugs.gentoo.org/704560
Package-Manager: Portage-2.3.84, Repoman-2.3.20
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
app-admin/keepassxc/files/keepassxc-2.5.2-ccache_switch.patch [new file with mode: 0644]
app-admin/keepassxc/keepassxc-2.5.1.ebuild
app-admin/keepassxc/keepassxc-2.5.2.ebuild
app-admin/keepassxc/keepassxc-9999.ebuild
app-admin/keepassxc/metadata.xml

diff --git a/app-admin/keepassxc/files/keepassxc-2.5.2-ccache_switch.patch b/app-admin/keepassxc/files/keepassxc-2.5.2-ccache_switch.patch
new file mode 100644 (file)
index 0000000..57d8b3d
--- /dev/null
@@ -0,0 +1,59 @@
+From ae471bea14c8e05bcf368168649399b116a69992 Mon Sep 17 00:00:00 2001
+From: Lars Wendler <polynomial-c@gentoo.org>
+Date: Tue, 7 Jan 2020 17:44:08 -0500
+Subject: [PATCH] CMakeLists.txt: Do not unconditionally use ccache
+
+This causes build failures in Gentoo because we don't allow access to ccache files if ccache is not enabled for build.
+
+Fix this by adding a WITH_CCACHE cmake option and change behavior so that cmake fails if WITH_CCACHE is enabled but ccache program cannot be found.
+
+Gentoo-bug: https://bugs.gentoo.org/704560
+Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
+---
+ CMakeLists.txt | 19 ++++++++++++-------
+ 1 file changed, 12 insertions(+), 7 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c2f9b5bfe..1c5746c59 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -27,13 +27,6 @@ string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+-# Use the Compiler Cache (ccache) if it is installed
+-# (install with: sudo apt get ccache)
+-find_program (CCACHE_FOUND ccache)
+-if (CCACHE_FOUND)
+-    set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
+-endif (CCACHE_FOUND)
+-
+ # Support Visual Studio Code
+ include(CMakeToolsHelpers OPTIONAL)
+ include(FeatureSummary)
+@@ -48,6 +41,7 @@ option(WITH_DEV_BUILD "Use only for development. Disables/warns about deprecated
+ option(WITH_ASAN "Enable address sanitizer checks (Linux / macOS only)" OFF)
+ option(WITH_COVERAGE "Use to build with coverage tests (GCC only)." OFF)
+ option(WITH_APP_BUNDLE "Enable Application Bundle for macOS" ON)
++option(WITH_CCACHE "Use ccache for build" OFF)
+ set(WITH_XC_ALL OFF CACHE BOOL "Build in all available plugins")
+@@ -65,6 +59,17 @@ if(APPLE)
+     option(WITH_XC_TOUCHID "Include TouchID support for macOS." OFF)
+ endif()
++if(WITH_CCACHE)
++    # Use the Compiler Cache (ccache) program
++    # (install with: sudo apt get ccache)
++    find_program (CCACHE_FOUND ccache)
++    if(CCACHE_FOUND)
++        set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
++    else()
++        message(FATAL_ERROR "ccache requested but cannot be found.")
++    endif()
++endif()
++
+ if(WITH_XC_ALL)
+     # Enable all options (except update check)
+     set(WITH_XC_AUTOTYPE ON)
index 344be63f074173aea0ba75bf321ee22c6dde94f8..c3a08042f8f1ad47856670c9239fd45b464f3050 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -24,7 +24,7 @@ fi
 
 LICENSE="LGPL-2.1 GPL-2 GPL-3"
 SLOT="0"
-IUSE="autotype browser debug keeshare +network test yubikey"
+IUSE="autotype browser ccache debug keeshare +network test yubikey"
 
 RDEPEND="
        app-crypt/argon2:=
@@ -55,7 +55,9 @@ DEPEND="
        dev-qt/linguist-tools:5
        dev-qt/qttest:5
 "
-
+BDEPEND="
+       ccache? ( dev-util/ccache )
+"
 # Not a runtime dependency but still needed (see bug #667092)
 PDEPEND="
        x11-misc/xsel
@@ -63,6 +65,10 @@ PDEPEND="
 
 RESTRICT="!test? ( test )"
 
+PATCHES=(
+       "${FILESDIR}/${PN}-2.5.2-ccache_switch.patch"
+)
+
 src_prepare() {
         use test || \
                sed -e "/^find_package(Qt5Test/d" -i CMakeLists.txt || die
@@ -72,6 +78,7 @@ src_prepare() {
 
 src_configure() {
        local mycmakeargs=(
+               -DWITH_CCACHE="$(usex ccache)"
                -DWITH_GUI_TESTS=OFF
                -DWITH_TESTS="$(usex test)"
                -DWITH_XC_AUTOTYPE="$(usex autotype)"
@@ -88,15 +95,3 @@ src_configure() {
        fi
        cmake_src_configure
 }
-
-pkg_preinst() {
-       xdg_pkg_preinst
-}
-
-pkg_postinst() {
-       xdg_pkg_postinst
-}
-
-pkg_postrm() {
-       xdg_pkg_postrm
-}
index f4d70198a23952947e92b7dce2871c2038839730..c3a08042f8f1ad47856670c9239fd45b464f3050 100644 (file)
@@ -24,7 +24,7 @@ fi
 
 LICENSE="LGPL-2.1 GPL-2 GPL-3"
 SLOT="0"
-IUSE="autotype browser debug keeshare +network test yubikey"
+IUSE="autotype browser ccache debug keeshare +network test yubikey"
 
 RDEPEND="
        app-crypt/argon2:=
@@ -55,7 +55,9 @@ DEPEND="
        dev-qt/linguist-tools:5
        dev-qt/qttest:5
 "
-
+BDEPEND="
+       ccache? ( dev-util/ccache )
+"
 # Not a runtime dependency but still needed (see bug #667092)
 PDEPEND="
        x11-misc/xsel
@@ -63,6 +65,10 @@ PDEPEND="
 
 RESTRICT="!test? ( test )"
 
+PATCHES=(
+       "${FILESDIR}/${PN}-2.5.2-ccache_switch.patch"
+)
+
 src_prepare() {
         use test || \
                sed -e "/^find_package(Qt5Test/d" -i CMakeLists.txt || die
@@ -72,6 +78,7 @@ src_prepare() {
 
 src_configure() {
        local mycmakeargs=(
+               -DWITH_CCACHE="$(usex ccache)"
                -DWITH_GUI_TESTS=OFF
                -DWITH_TESTS="$(usex test)"
                -DWITH_XC_AUTOTYPE="$(usex autotype)"
index f4d70198a23952947e92b7dce2871c2038839730..949cb61dc8aa22f2e9a7e9f9245f428c92148da9 100644 (file)
@@ -24,7 +24,7 @@ fi
 
 LICENSE="LGPL-2.1 GPL-2 GPL-3"
 SLOT="0"
-IUSE="autotype browser debug keeshare +network test yubikey"
+IUSE="autotype browser ccache debug keeshare +network test yubikey"
 
 RDEPEND="
        app-crypt/argon2:=
@@ -55,7 +55,9 @@ DEPEND="
        dev-qt/linguist-tools:5
        dev-qt/qttest:5
 "
-
+BDEPEND="
+       ccache? ( dev-util/ccache )
+"
 # Not a runtime dependency but still needed (see bug #667092)
 PDEPEND="
        x11-misc/xsel
@@ -72,6 +74,7 @@ src_prepare() {
 
 src_configure() {
        local mycmakeargs=(
+               -DWITH_CCACHE="$(usex ccache)"
                -DWITH_GUI_TESTS=OFF
                -DWITH_TESTS="$(usex test)"
                -DWITH_XC_AUTOTYPE="$(usex autotype)"
index d9b95402e41b54886153ef367466bac820300101..0445305ebe5961401edc08abccb0c21a210635ef 100644 (file)
@@ -8,6 +8,7 @@
   <use>
     <flag name="autotype">Add support to autotype the passwords into other applications</flag>
     <flag name="browser">Enables browser plugin support</flag>
+    <flag name="ccache">Use <pkg>dev-util/ccache</pkg> to build keepassxc</flag>
     <flag name="keeshare">Enable KeeShare sharing integration</flag>
     <flag name="network">Enable network support</flag>
     <flag name="yubikey">Enable database unlocking via YubiKey.</flag>