]> granicus.if.org Git - neomutt/commitdiff
build: add autocrypt option
authorRichard Russon <rich@flatcap.org>
Sun, 4 Aug 2019 18:00:34 +0000 (19:00 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 19 Aug 2019 23:14:27 +0000 (00:14 +0100)
Makefile.autosetup
auto.def
autocrypt/autocrypt.c [new file with mode: 0644]
version.c

index d4a7e7045153384dc20d066fe58f8f0a1f7f2654..0dab42461409a02fcca8ded906c29612f93b75f8 100644 (file)
@@ -92,6 +92,16 @@ NEOMUTTOBJS+=        monitor.o
 CLEANFILES+=   $(NEOMUTT) $(NEOMUTTOBJS)
 ALLOBJS+=      $(NEOMUTTOBJS)
 
+###############################################################################
+# libautocrypt
+@if USE_AUTOCRYPT
+LIBAUTOCRYPT=  libautocrypt.a
+LIBAUTOCRYPTOBJS=      autocrypt/autocrypt.o
+CLEANFILES+=   $(LIBAUTOCRYPT) $(LIBAUTOCRYPTOBJS)
+MUTTLIBS+=     $(LIBAUTOCRYPT)
+ALLOBJS+=      $(LIBAUTOCRYPTOBJS)
+@endif
+
 ###############################################################################
 # libpop
 LIBPOP=        libpop.a
@@ -313,6 +323,13 @@ $(LIBADDRESS): $(PWD)/address $(LIBADDRESSOBJS)
 $(PWD)/address:
        $(MKDIR_P) $(PWD)/address
 
+# libautocrypt
+$(LIBAUTOCRYPT): $(PWD)/autocrypt $(LIBAUTOCRYPTOBJS)
+       $(AR) cr $@ $(LIBAUTOCRYPTOBJS)
+       $(RANLIB) $@
+$(PWD)/autocrypt:
+       $(MKDIR_P) $(PWD)/autocrypt
+
 # libemail
 $(LIBEMAIL): $(PWD)/email $(LIBEMAILOBJS)
        $(AR) cr $@ $(LIBEMAILOBJS)
index 95e55c05bb144d7d61093142d3214684d823ca6a..3d02a01973f6153d4b4b296e3b70ff69e91d07f8 100644 (file)
--- a/auto.def
+++ b/auto.def
@@ -59,6 +59,8 @@ options {
   # SASL (IMAP and POP auth)
   sasl=0                    => "Use the SASL network security library"
   with-sasl:path            => "Location of the SASL network security library"
+  # AutoCrypt
+  autocrypt=0               => "Enable AutoCrypt support (requires gpgme and sqlite)"
 # Lua
   lua=0                     => "Enable Lua scripting support"
   with-lua:path             => "Location of Lua"
@@ -90,6 +92,9 @@ options {
 # libunwind
   backtrace=0               => "Enable backtrace support with libunwind"
   with-backtrace:path       => "Location of libunwind"
+# sqlite
+  sqlite=0                  => "Enable SQLite support"
+  with-sqlite:path          => "Location of sqlite"
 # System
   with-sysroot:path         => "Target system root"
 # Testing
@@ -109,9 +114,9 @@ options {
 if {1} {
   # Keep sorted, please.
   foreach opt {
-    bdb backtrace coverage doc everything fmemopen full-doc gdbm gnutls gpgme
+    autocrypt bdb backtrace coverage doc everything fmemopen full-doc gdbm gnutls gpgme
     gss homespool idn idn2 inotify kyotocabinet lmdb locales-fix lua mixmaster
-    nls notmuch pkgconf pgp qdbm sasl smime ssl testing tokyocabinet
+    nls notmuch pkgconf pgp qdbm sasl smime sqlite ssl testing tokyocabinet
   } {
     define want-$opt [opt-bool $opt]
   }
@@ -121,7 +126,7 @@ if {1} {
   # a shortcut for "--opt --with-opt=/usr".
   foreach opt {
     bdb gdbm gnutls gpgme gss homespool idn idn2 kyotocabinet lmdb lua mixmaster
-    ncurses nls notmuch qdbm sasl slang ssl tokyocabinet
+    ncurses nls notmuch qdbm sasl slang sqlite ssl tokyocabinet
   } {
     if {[opt-val with-$opt] ne {}} {
       define want-$opt 1
@@ -394,6 +399,14 @@ if {[get-define want-doc]} {
 }
 if {[get-define want-full-doc]} {define MAKEDOC_FULL}
 
+###############################################################################
+# AutoCrypt
+if {[get-define want-autocrypt]} {
+  define USE_AUTOCRYPT
+  define want-sqlite 1
+  define want-gpgme 1
+}
+
 ###############################################################################
 # GPGME
 if {[get-define want-gpgme]} {
@@ -422,8 +435,14 @@ if {[get-define want-gpgme]} {
     if {[scan $gpgme_version "%d.%d.%d" gpgme_maj gpgme_min gpgme_patch] != 3} {
       user-error "Could not parse GPGMe version $gpgme_version"
     }
-    if {$gpgme_maj < 1 || $gpgme_min < 4} {
-      user-error "Found GPGME version $gpgme_version, need 1.4.0"
+    if {[get-define want-autocrypt]} {
+      if {$gpgme_maj < 1 || $gpgme_min < 8} {
+        user-error "Found GPGME version $gpgme_version, need 1.8.0 for AutoCrypt"
+      }
+    } else {
+      if {$gpgme_maj < 1 || $gpgme_min < 4} {
+        user-error "Found GPGME version $gpgme_version, need 1.4.0"
+      }
     }
     define GPGME_VERSION_NUMBER [format "0x%02x%02x%02x" $gpgme_maj $gpgme_min $gpgme_patch]
 
@@ -611,6 +630,16 @@ if {[get-define want-nls]} {
  }
 }
 
+###############################################################################
+# SQLite Support
+if {[get-define want-sqlite]} {
+  if {![check-inc-and-lib sqlite [opt-val with-sqlite $prefix] \
+                          sqlite3.h sqlite3_open sqlite3]} {
+    user-error "Unable to find SQLite"
+  }
+  define USE_SQLITE
+}
+
 ###############################################################################
 # fmemopen(3)
 if {[get-define want-fmemopen]} {
diff --git a/autocrypt/autocrypt.c b/autocrypt/autocrypt.c
new file mode 100644 (file)
index 0000000..d5d6fe2
--- /dev/null
@@ -0,0 +1,4 @@
+
+#include "config.h"
+
+int dummy = 0;
index 36090955d073937c54b64141ce24c16a16a552c1..62964c16f42597910ae4f052e09d03c87dc357f3 100644 (file)
--- a/version.c
+++ b/version.c
@@ -142,6 +142,11 @@ static struct CompileOptions comp_opts_default[] = {
 };
 
 static struct CompileOptions comp_opts[] = {
+#ifdef USE_AUTOCRYPT
+  { "autocrypt", 1 },
+#else
+  { "autocrypt", 0 },
+#endif
 #ifdef HAVE_BKGDSET
   { "bkgdset", 1 },
 #else
@@ -267,6 +272,11 @@ static struct CompileOptions comp_opts[] = {
 #else
   { "smime", 0 },
 #endif
+#ifdef USE_SQLITE
+  { "sqlite", 1 },
+#else
+  { "sqlite", 0 },
+#endif
 #ifdef HAVE_START_COLOR
   { "start_color", 1 },
 #else