Add make variable to select os-provided sqlite3 library ENGINE-229
authorDamiano Boppart <damiano@pep-security.net>
Thu, 24 Aug 2017 15:05:08 +0200
branchENGINE-229
changeset 19972c10033e2ade
parent 1996 8626dd29b73c
child 1998 1daacad12396
child 2002 6b465132be58
Add make variable to select os-provided sqlite3 library
build-config/common.conf
src/Makefile
src/pEp_internal.h
     1.1 --- a/build-config/common.conf	Thu Aug 24 11:46:42 2017 +0200
     1.2 +++ b/build-config/common.conf	Thu Aug 24 15:05:08 2017 +0200
     1.3 @@ -55,6 +55,10 @@
     1.4  # libetpan include search flag
     1.5  ETPAN_INC=-I$(PREFIX)/include
     1.6  
     1.7 +######### sqlite3 #########
     1.8 +# If empty (or undefined), compile sqlite3 from the sources shipped with the pEp distribution. Otherwise, use an sqlite3 implementation found in the OS's include/library paths.
     1.9 +SQLITE3_FROM_OS=placeholder
    1.10 +
    1.11  ######### OpenPGP #########
    1.12  # Path of GPG binary
    1.13  GPG_CMD=gpg
     2.1 --- a/src/Makefile	Thu Aug 24 11:46:42 2017 +0200
     2.2 +++ b/src/Makefile	Thu Aug 24 15:05:08 2017 +0200
     2.3 @@ -8,6 +8,7 @@
     2.4  CFLAGS+= $(ETPAN_INC) -I../asn.1 -DSYSTEM_DB=\"$(SYSTEM_DB)\" $(EXTRA_MACROS)
     2.5  LDFLAGS+= $(ETPAN_LIB) -L../asn.1 -shared
     2.6  LDLIBS+= -lc -letpan -lasn1
     2.7 +NO_SOURCE=
     2.8  
     2.9  ifeq ($(BUILD_ON),Darwin)
    2.10      ifeq ($(BUILD_FOR),Darwin)
    2.11 @@ -28,13 +29,18 @@
    2.12      $(error I don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
    2.13  endif
    2.14  
    2.15 +ifdef SQLITE3_FROM_OS
    2.16 +    NO_SOURCE+= sqlite3.c
    2.17 +    CFLAGS+= -DSQLITE3_FROM_OS
    2.18 +endif
    2.19 +
    2.20  ifeq ($(OPENPGP),GPG)
    2.21 -    NO_SOURCE=pgp_netpgp.c
    2.22 +    NO_SOURCE+= pgp_netpgp.c
    2.23      CFLAGS+= -DUSE_GPG $(GPGME_INC) -DLIBGPGME=\"$(LIBGPGME)\"
    2.24      LDFLAGS+= $(GPGME_LIB)
    2.25      # No extra LDLIBS are needed here, because GPGME is dynamically loaded
    2.26  else ifeq ($(OPENPGP),NETPGP)
    2.27 -    NO_SOURCE=pgp_gpg.c
    2.28 +    NO_SOURCE+= pgp_gpg.c
    2.29      CFLAGS+= -DUSE_NETPGP $(NETGPG_INC)
    2.30      LDFLAGS+= $(NETGPG_LIB)
    2.31      LDLIBS+= -lnetpgp -lcurl
    2.32 @@ -42,7 +48,7 @@
    2.33      $(error Unknown OpenPGP library: $(OPENPGP))
    2.34  endif
    2.35  
    2.36 -ALL_SOURCE=$(subst $(NO_SOURCE),,$(wildcard *.c))
    2.37 +ALL_SOURCE=$(filter-out $(NO_SOURCE),$(wildcard *.c))
    2.38  DEPENDS=$(subst .c,.d,$(ALL_SOURCE))
    2.39  ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE))
    2.40  
     3.1 --- a/src/pEp_internal.h	Thu Aug 24 11:46:42 2017 +0200
     3.2 +++ b/src/pEp_internal.h	Thu Aug 24 15:05:08 2017 +0200
     3.3 @@ -56,7 +56,11 @@
     3.4  #include <stdio.h>
     3.5  #include <ctype.h>
     3.6  
     3.7 +#ifdef SQLITE3_FROM_OS
     3.8 +#include <sqlite3.h>
     3.9 +#else
    3.10  #include "sqlite3.h"
    3.11 +#endif
    3.12  
    3.13  #define _EXPORT_PEP_ENGINE_DLL
    3.14  #include "pEpEngine.h"