summarylogtreecommitdiffstats
path: root/trojita-gpgme.patch
blob: bfbd9ee012e1effd9a16ee84afbfd7cdf6a6b549 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
From e8393376969caf27b0c976d01645edd023c14df2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jkt@kde.org>
Date: Sat, 17 Dec 2016 13:26:56 +0100
Subject: Support both vanilla gpgme and KDE Frameworks gpgmepp

KF5Gpgmepp has been merged into GPGME (since 1.7.0) and will not see
any further releases with KDE Applications. We still care about older
distros (and that means older gpgme, and therefore a need for extra
bindings).

Stuff is a bit more complicated because 1.7.x is not thread-safe by
default. Given that gpgme upstream start making their releases pretty
often this fall, it seems safe to go with 1.8.0.

Change-Id: Ia2f05bd8ed2a894435ca328a886325366ba41622
Inspired-By: Heiko Becker <heirecka@exherbo.org>
Inspired-By: Andreas Sturmlechner <andreas.sturmlechner@gmail.com>
Fixed-By: Caspar Schutijser <caspar@schutijser.com>
---
 CMakeLists.txt | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3e129c1..3346142 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,7 +51,8 @@ trojita_option(WITH_ZLIB "Build with zlib library" AUTO)
 trojita_option(WITH_SHARED_PLUGINS "Enable shared dynamic plugins" ON)
 trojita_option(BUILD_TESTING "Build tests" ON)
 trojita_option(WITH_MIMETIC "Build with client-side MIME parsing" AUTO)
-trojita_option(WITH_GPGMEPP "Build with the GpgME++ library for cryptography" AUTO)
+trojita_option(WITH_GPGMEPP "Use GpgME's native C++ bindings" AUTO)
+trojita_option(WITH_KF5_GPGMEPP "Use legacy discontinued GpgME++ library from KDE frameworks" AUTO)
 
 if(WIN32)
     trojita_option(WITH_NSIS "Build Windows NSIS installer" AUTO "WITH_DESKTOP")
@@ -84,8 +85,13 @@ trojita_plugin_option(WITH_QTKEYCHAIN_PLUGIN "Build Qtkeychain password plugin"
 trojita_find_package(Git "" "" "" "")
 
 trojita_find_package(Mimetic "" "http://www.codesink.org/mimetic_mime_library.html" "C++ MIME Library" "Required for client-side MIME parsing" WITH_MIMETIC)
-trojita_find_package(KF5Gpgmepp "" "https://quickgit.kde.org/?p=gpgmepp.git" "C++ bindings for gpgme" "Needed for encrypted/signed e-mails" WITH_GPGMEPP)
-trojita_option(WITH_CRYPTO_MESSAGES "Enable support for encrypted messages" AUTO "WITH_MIMETIC;WITH_GPGMEPP")
+trojita_find_package(Gpgmepp "1.8.0" "https://gnupg.org/related_software/gpgme/index.html" "C++/Qt bindings for gpgme" "Needed for encrypted/signed e-mails" WITH_GPGMEPP)
+if(NOT WITH_GPGMEPP)
+    trojita_find_package(KF5Gpgmepp "" "https://commits.kde.org/gpgmepp?path=/" "C++ bindings for gpgme" "Needed for encrypted/signed e-mails" WITH_KF5_GPGMEPP)
+    trojita_option(WITH_CRYPTO_MESSAGES "Enable support for encrypted messages" AUTO "WITH_MIMETIC;WITH_KF5_GPGMEPP")
+else()
+    trojita_option(WITH_CRYPTO_MESSAGES "Enable support for encrypted messages" AUTO "WITH_MIMETIC;WITH_GPGMEPP")
+endif()
 
 if(WIN32)
     trojita_find_package(MakeNSIS "" "http://nsis.sourceforge.net" "Nullsoft Scriptable Install System" "Needed for building Windows installer" WITH_NSIS)
@@ -197,7 +203,7 @@ else()
   set(TROJITA_HAVE_MIMETIC False)
 endif()
 
-if(WITH_GPGMEPP)
+if(WITH_GPGMEPP OR WITH_KF5_GPGMEPP)
   set(TROJITA_HAVE_GPGMEPP True)
 else()
   set(TROJITA_HAVE_GPGMEPP False)
@@ -315,12 +321,10 @@ if(WITH_MIMETIC)
     )
 endif()
 if(WITH_CRYPTO_MESSAGES)
-  if(WITH_GPGMEPP)
     set(libCryptography_SOURCES
         ${libCryptography_SOURCES}
         ${path_Cryptography}/GpgMe++.cpp
     )
-  endif()
 endif()
 
 if(WITH_ZLIB)
@@ -614,13 +618,15 @@ if(WITH_MIMETIC)
     set_property(TARGET Cryptography APPEND PROPERTY INCLUDE_DIRECTORIES ${MIMETIC_INCLUDE_DIRS})
 endif()
 if(WITH_CRYPTO_MESSAGES)
-  if(WITH_GPGMEPP)
-    if (WIN32)
-      target_link_libraries(Cryptography KF5::Gpgmepp KF5::QGpgme)
-    else()
-      target_link_libraries(Cryptography KF5::Gpgmepp-pthread KF5::QGpgme)
+    if(WITH_GPGMEPP)
+        target_link_libraries(Cryptography Gpgmepp QGpgme)
+    elseif(WITH_KF5_GPGMEPP)
+        if(WIN32)
+            target_link_libraries(Cryptography KF5::Gpgmepp KF5::QGpgme)
+        else()
+            target_link_libraries(Cryptography KF5::Gpgmepp-pthread KF5::QGpgme)
+        endif()
     endif()
-  endif()
 endif()
 
 ## ClearText password plugin
-- 
cgit v0.11.2