1.1 --- a/.hgignore Fri Oct 27 16:05:34 2017 +0200
1.2 +++ b/.hgignore Mon Oct 30 17:35:33 2017 +0100
1.3 @@ -5,6 +5,7 @@
1.4 .*xcuserdata/
1.5 ^build/
1.6 ^local.conf
1.7 +^test_home/
1.8
1.9 syntax: glob
1.10 *.orig
2.1 --- a/Makefile Fri Oct 27 16:05:34 2017 +0200
2.2 +++ b/Makefile Mon Oct 30 17:35:33 2017 +0100
2.3 @@ -5,10 +5,22 @@
2.4
2.5 HERE_REL := $(notdir $(CURDIR))
2.6
2.7 -include Makefile.conf
2.8 +include default.conf
2.9 +
2.10 +ifneq ($(wildcard local.conf),)
2.11 + $(info ================================================)
2.12 + $(info Overrides in \`local.conf\` are used.)
2.13 + $(info ================================================)
2.14 +endif
2.15 +
2.16 +ifdef BUILD_CONFIG
2.17 + $(info ================================================)
2.18 + $(info Overrides in \`$(BUILD_CONFIG)\` are used.)
2.19 + $(info ================================================)
2.20 +endif
2.21
2.22 .PHONY: all
2.23 -all: _override_info
2.24 +all:
2.25 $(MAKE) -C asn.1 generate
2.26 $(MAKE) -C asn.1
2.27 $(MAKE) -C sync
2.28 @@ -20,17 +32,18 @@
2.29 $(MAKE) -C asn.1 install
2.30
2.31 .PHONY: uninstall
2.32 -uninstall: _override_info
2.33 +uninstall:
2.34 $(MAKE) -C src uninstall
2.35 $(MAKE) -C asn.1 uninstall
2.36
2.37 .PHONY: clean
2.38 -clean: _override_info
2.39 +clean:
2.40 $(MAKE) -C src clean
2.41 $(MAKE) -C test clean
2.42 $(MAKE) -C db clean
2.43 $(MAKE) -C sync clean
2.44 $(MAKE) -C asn.1 clean
2.45 + rm -rf test_home
2.46
2.47 .PHONY: test
2.48 test: all
2.49 @@ -46,24 +59,5 @@
2.50 cd .. ; COPYFILE_DISABLE=true tar cjf pEpEngine.tar.bz2 "$(HERE_REL)"
2.51
2.52 .PHONY: db
2.53 -db: _override_info
2.54 +db:
2.55 $(MAKE) -C db db
2.56 -
2.57 -.PHONY: _override_info
2.58 -_override_info: _local_conf_info _build_config_info
2.59 -
2.60 -.PHONY: _local_conf_info
2.61 -_local_conf_info:
2.62 -ifneq ($(wildcard local.conf),)
2.63 - @echo "================================================"
2.64 - @echo "Overrides in \`local.conf\` are used."
2.65 - @echo "================================================"
2.66 -endif
2.67 -
2.68 -.PHONY: _build_config_info
2.69 -_build_config_info:
2.70 -ifdef BUILD_CONFIG
2.71 - @echo "================================================"
2.72 - @echo "Overrides in \`$(BUILD_CONFIG)\` are used."
2.73 - @echo "================================================"
2.74 -endif
3.1 --- a/Makefile.conf Fri Oct 27 16:05:34 2017 +0200
3.2 +++ b/Makefile.conf Mon Oct 30 17:35:33 2017 +0100
3.3 @@ -3,232 +3,107 @@
3.4 # This file may be used under the terms of the GNU General Public License version 3
3.5 # see LICENSE.txt
3.6
3.7 -# This file gives an overview over all the parameters that can be easily customized for a build.
3.8 -# There are three ways in which you can customize your build:
3.9 -# 1) Edit the variable assignments in this file
3.10 -# 2) Create `local.conf` and fill it with variable assignments.
3.11 -# These `local.conf` takes precedence over the assignments below.
3.12 -# 3) Set the environment variable `BUILD_CONFIG` to an absolute path.
3.13 -# The variable assignments found at the path indicated by `BUILD_CONFIG` take precedence over the assignments below and the assignments in `local.conf`.
3.14 -# If nothing is changed according to these 3 methods, a default configuration for your platform will be used for the build.
3.15 -
3.16 -HERE:=$(dir $(lastword $(MAKEFILE_LIST)))
3.17
3.18 ######### General #########
3.19 # To use (only) system libraries, set all the *_INC and *_LIB variables to the empty string.
3.20 # All the *_INC and *_LIB variables are command line flags, not paths.
3.21 # Thus, all *_INC variables' values must start with "-I", and all *_LIB variables' values must start with "-L".
3.22
3.23 -BUILD_ON:=$(shell uname)
3.24 +#BUILD_ON:=$(shell uname)
3.25
3.26 # This variable specifies the platform that the engine should be cross-compiled for.
3.27 -BUILD_FOR=$(BUILD_ON)
3.28 -
3.29 -# Cross-compiling is currently not supported.
3.30 -# Maybe you can hack something with `local.conf`.
3.31 -ifneq ($(BUILD_ON),$(BUILD_FOR))
3.32 - $(error I don't know how to build for $(BUILD_FOR) on $(BUILD_ON).)
3.33 -endif
3.34 +#BUILD_FOR=$(BUILD_ON)
3.35
3.36 # Installation path prefix for libraries and binaries, except for system.db
3.37 -PREFIX=$(HOME)
3.38 +#PREFIX=$(HOME)
3.39
3.40 # Installation path for system.db
3.41 -SYSTEM_DB=/usr/local/share/pEp/system.db
3.42 +#SYSTEM_DB=/usr/local/share/pEp/system.db
3.43
3.44 # Filename of the pEpEngine library
3.45 -ifeq ($(BUILD_FOR),Linux)
3.46 - TARGET=libpEpEngine.so
3.47 -else ifeq ($(BUILD_FOR),Darwin)
3.48 - TARGET=libpEpEngine.dylib
3.49 -endif
3.50 -
3.51 -# If empty, create a release build.
3.52 -# Otherwise, create a debug build.
3.53 -# This variable is ineffective in your local.conf file.
3.54 -DEBUG=YES
3.55 -
3.56 -# If empty, suppress compiler warnings.
3.57 -# Otherwise, print warnings.
3.58 -# This variable is ineffective in your local.conf file.
3.59 -WARN=placeholder
3.60 +#TARGET=libpEpEngine.so
3.61
3.62
3.63 ######### C and C++ #########
3.64 -TARGET_ARCH=
3.65 +#TARGET_ARCH=
3.66 +
3.67 # The following two variables will be appended to.
3.68 # You can thus not set them to a fixed value here.
3.69 -ifeq ($(BUILD_FOR),Linux)
3.70 - LDFLAGS=
3.71 -else ifeq ($(BUILD_FOR),Darwin)
3.72 - # "-bind_at_load" helps find symbol resolution errors faster
3.73 - LDFLAGS=-bind_at_load
3.74 -endif
3.75 +#LDFLAGS=
3.76
3.77 -LDLIBS=
3.78 +#LDLIBS=
3.79
3.80
3.81 ######### C #########
3.82 -ifeq ($(BUILD_FOR),Linux)
3.83 - CC=gcc -std=c99 -pthread
3.84 -else ifeq ($(BUILD_FOR),Darwin)
3.85 - # clang issues a warning when "-pthread" is used for linking.
3.86 - # So, include it in CFLAGS, and not in CC
3.87 - CC=clang -std=c99
3.88 -endif
3.89 +#CC=
3.90
3.91 -ifeq ($(BUILD_FOR),Linux)
3.92 - CFLAGS=-fPIC -fstrict-aliasing -fdiagnostics-color=always
3.93 -else ifeq ($(BUILD_FOR),Darwin)
3.94 - CFLAGS=-pthread -fPIC -fstrict-aliasing -fcolor-diagnostics
3.95 -endif
3.96 -
3.97 -CPPFLAGS=
3.98 +#CFLAGS=-fPIC -fstrict-aliasing -fdiagnostics-color=always
3.99
3.100 -# The flag -DNDEBUG will always be removed from CFLAGS for compiling tests.
3.101 -# The tests do not work properly, if compiled with -DNDEBUG
3.102 -ifeq ($(BUILD_FOR),Linux)
3.103 - ifdef WARN
3.104 - CFLAGS+= -Wall -pedantic -Wstrict-aliasing=3
3.105 - else
3.106 - CFLAGS+= -w
3.107 - endif
3.108 - ifdef DEBUG
3.109 - CFLAGS+= -Og -ggdb -DDEBUG_ERRORSTACK
3.110 - else
3.111 - CFLAGS+= -O3 -DNDEBUG
3.112 - endif
3.113 -else ifeq ($(BUILD_FOR),Darwin)
3.114 - ifdef WARN
3.115 - # FIXME Remove 'no-extended-offsetof' after ENGINE-236 is closed.
3.116 - CFLAGS+= -Wall -pedantic -Wno-extended-offsetof
3.117 - else
3.118 - CFLAGS+= -w
3.119 - endif
3.120 - ifdef DEBUG
3.121 - CFLAGS+= -O0 -g -DDEBUG_ERRORSTACK
3.122 - else
3.123 - CFLAGS+= -O3 -DNDEBUG
3.124 - endif
3.125 -endif
3.126 +#CPPFLAGS=
3.127 +
3.128 +#CFLAGS+= -w -O3 -DNDEBUG
3.129
3.130 # Additional CFLAGS used for compiling ASN1C-generated code
3.131 -ifeq ($(BUILD_FOR),Linux)
3.132 - # The '_DEFAULT_SOURCE' feature test macro is required to suppress the warning
3.133 - # _BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE
3.134 - # otherwise printed during the compilation of every asn1c-generated C file.
3.135 - # It's a glibc specific warning, only present in few versions around ~2.19.
3.136 - # See https://lwn.net/Articles/590381/ for a discussion.
3.137 - CFLAGS_GENERATED=-D_DEFAULT_SOURCE
3.138 -else ifeq ($(BUILD_FOR),Darwin)
3.139 - CFLAGS_GENERATED=
3.140 -endif
3.141 +#CFLAGS_GENERATED=-D_DEFAULT_SOURCE
3.142
3.143
3.144 ######### C++ #########
3.145 -ifeq ($(BUILD_FOR),Linux)
3.146 - CXX=g++ -std=gnu++11 -pthread
3.147 -else ifeq ($(BUILD_FOR),Darwin)
3.148 - # clang issues a warning when "-pthread" is used for linking. So, include it in CXXFLAGS, and not in CXX
3.149 - CXX=clang -std=c++11
3.150 -endif
3.151 +#CXX=g++ -std=gnu++11 -pthread
3.152
3.153 -# The flag -DNDEBUG will always be removed from CXXFLAGS for compiling tests.
3.154 -# The tests do not work properly, if compiled with -DNDEBUG
3.155 -ifeq ($(BUILD_FOR),Linux)
3.156 - CXXFLAGS=-fdiagnostics-color=always -I../src -I../asn.1 $(ETPAN_INC)
3.157 - ifdef WARN
3.158 - CXXFLAGS+=
3.159 - else
3.160 - CXXFLAGS+= -w
3.161 - endif
3.162 - ifdef DEBUG
3.163 - CXXFLAGS+= -Og -ggdb
3.164 - else
3.165 - CXXFLAGS+= -O3 -DNDEBUG
3.166 - endif
3.167 -else ifeq ($(BUILD_FOR),Darwin)
3.168 - CXXFLAGS=-pthread -fcolor-diagnostics -I../src -I../asn.1 $(ETPAN_INC)
3.169 - ifdef WARN
3.170 - CXXFLAGS+=
3.171 - else
3.172 - CXXFLAGS+= -w
3.173 - endif
3.174 - ifdef DEBUG
3.175 - CXXFLAGS+= -O0 -g
3.176 - else
3.177 - CXXFLAGS+= -O3 -DNDEBUG
3.178 - endif
3.179 -endif
3.180 +#CXXFLAGS=-fdiagnostics-color=always -I../src -I../asn.1 $(ETPAN_INC) -w -O3 -DNDEBUG
3.181
3.182
3.183 ######### YML2 #########
3.184 -YML2_PATH=$(HOME)/yml2
3.185 -
3.186 -YML2_PROC=$(YML2_PATH)/yml2proc
3.187 +#YML2_PATH=$(HOME)/yml2
3.188
3.189 -YML2_OPTS=--encoding=utf8
3.190 +#YML2_PROC=$(YML2_PATH)/yml2proc
3.191
3.192 -export YML_PATH=$(YML2_PATH)
3.193 +#YML2_OPTS=--encoding=utf8
3.194 +
3.195
3.196 ######### asn1c #########
3.197 # asn1c binary
3.198 -ASN1C=asn1c
3.199 +#ASN1C=asn1c
3.200
3.201 # asn1c include search flag
3.202 -ASN1C_INC=
3.203 #ASN1C_INC=-I$(HOME)/include
3.204
3.205
3.206 ######### libetpan #########
3.207 # libetpan library search flag
3.208 -ETPAN_LIB=-L$(PREFIX)/lib
3.209 +#ETPAN_LIB=-L$(PREFIX)/lib
3.210
3.211 # libetpan include search flag
3.212 -ETPAN_INC=-I$(PREFIX)/include
3.213 +#ETPAN_INC=-I$(PREFIX)/include
3.214
3.215
3.216 ######### sqlite3 #########
3.217 # If empty (or undefined), compile sqlite3 from the sources shipped with the pEp distribution.
3.218 # Otherwise, use an sqlite3 implementation found in the OS's include/library paths.
3.219 -SQLITE3_FROM_OS=placeholder
3.220 +#SQLITE3_FROM_OS=placeholder
3.221
3.222
3.223 ######### OpenPGP #########
3.224 # Path of GPG binary
3.225 # gpgconf is not available for old version of GPG, for example GPG 2.0.30. Override this variable, if you compile the engine for such an old version.
3.226 -GPG_CMD:=$(shell gpgconf --list-components | awk -F: '/^gpg:/ { print $$3; exit 0; }')
3.227 +#GPG_CMD:=$(shell gpgconf --list-components | awk -F: '/^gpg:/ { print $$3; exit 0; }')
3.228
3.229 # Selects OpenPGP implementation. must be either `GPG` or `NETPGP`
3.230 -OPENPGP=GPG
3.231 +#OPENPGP=GPG
3.232
3.233 # Path of libGPGME binary
3.234 -ifeq ($(BUILD_FOR),Linux)
3.235 - LIBGPGME=libgpgme.so.11
3.236 -else ifeq ($(BUILD_FOR),Darwin)
3.237 - LIBGPGME=libgpgme.dylib
3.238 -endif
3.239 +#LIBGPGME=libgpgme.so.11
3.240
3.241 # libGPGME library search flag
3.242 -ifeq ($(BUILD_FOR),Linux)
3.243 - GPGME_LIB=
3.244 -else ifeq ($(BUILD_FOR),Darwin)
3.245 - GPGME_LIB=-L$(HOME)/lib
3.246 -endif
3.247 +#GPGME_LIB=
3.248
3.249 # libGPGME include search flag
3.250 -ifeq ($(BUILD_FOR),Linux)
3.251 - GPGME_INC=
3.252 -else ifeq ($(BUILD_FOR),Darwin)
3.253 - GPGME_INC=-I$(HOME)/include
3.254 -endif
3.255 +#GPGME_INC=
3.256
3.257 # NETPGP library search flag
3.258 -NETPGP_LIB=
3.259 #NETPGP_LIB=-L$(PREFIX)/lib
3.260
3.261 # libGPGME include search flag
3.262 -NETPGP_INC=
3.263 #NETPGP_INC=-I$(PREFIX)/include
3.264
3.265
3.266 @@ -238,17 +113,4 @@
3.267 # CRASHDUMP_DEFAULT_LINES - number of log lines to deliver for crashdumps
3.268 # Example:
3.269 # EXTRA_MACROS=-DDEFAULT_KEYSERVER=\"default-server.org\" -DCRASHDUMP_DEFAULT_LINES=23
3.270 -EXTRA_MACROS=
3.271 -
3.272 -
3.273 -######### Misc #########
3.274 -# FIXME Maybe include these variables here.
3.275 -# Check how they are used throughout the project before setting them here
3.276 -#LLDB_BIN
3.277 -
3.278 -
3.279 --include $(HERE)/local.conf
3.280 -
3.281 -ifdef BUILD_CONFIG
3.282 - -include $(BUILD_CONFIG)
3.283 -endif
3.284 +#EXTRA_MACROS=
4.1 --- a/asn.1/Makefile Fri Oct 27 16:05:34 2017 +0200
4.2 +++ b/asn.1/Makefile Mon Oct 30 17:35:33 2017 +0100
4.3 @@ -3,7 +3,7 @@
4.4 # This file may be used under the terms of the GNU General Public License version 3
4.5 # see LICENSE.txt
4.6
4.7 -include ../Makefile.conf
4.8 +include ../default.conf
4.9
4.10 ALL_SOURCE=$(wildcard *.c)
4.11 ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE))
5.1 --- a/db/Makefile Fri Oct 27 16:05:34 2017 +0200
5.2 +++ b/db/Makefile Mon Oct 30 17:35:33 2017 +0100
5.3 @@ -3,7 +3,7 @@
5.4 # This file may be used under the terms of the GNU General Public License version 3
5.5 # see LICENSE.txt
5.6
5.7 -include ../Makefile.conf
5.8 +include ../default.conf
5.9
5.10 .PHONY: db
5.11 db: system.db
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/default.conf Mon Oct 30 17:35:33 2017 +0100
6.3 @@ -0,0 +1,264 @@
6.4 +# Copyright 2017, pEp Foundation
6.5 +# This file is part of pEpEngine
6.6 +# This file may be used under the terms of the GNU General Public License version 3
6.7 +# see LICENSE.txt
6.8 +
6.9 +# This file sets all the make variables that allow you to customize a build.
6.10 +# There are 4 ways in which you can customize your build:
6.11 +# 1) Edit the variable assignments in this file (this is a tracked file, so your repository will be dirty)
6.12 +# 2) Edit the variable assignments in `Makefile.conf` (which is a tracked file, so your repository will be dirty)
6.13 +# 3) Create `local.conf` and fill it with variable assignments.
6.14 +# 4) Set the environment variable `BUILD_CONFIG` to an absolute path.
6.15 +# The variable assignments found in the make file at the path indicated by `BUILD_CONFIG` will be evaluated.
6.16 +# Customization options are applied in the order given above. Later variable assignments take precedence over earlier ones.
6.17 +# It is possible to use multiple variants simultaniously.
6.18 +# If nothing is changed according to these 4 methods, a default configuration for your platform (specified below) will be used for the build.
6.19 +
6.20 +
6.21 +######### Header #########
6.22 +HERE:=$(dir $(lastword $(MAKEFILE_LIST)))
6.23 +
6.24 +
6.25 +######### General #########
6.26 +# To use (only) system libraries, set all the *_INC and *_LIB variables to the empty string.
6.27 +# All the *_INC and *_LIB variables are command line flags, not paths.
6.28 +# Thus, all *_INC variables' values must start with "-I", and all *_LIB variables' values must start with "-L".
6.29 +
6.30 +BUILD_ON:=$(shell uname)
6.31 +
6.32 +# This variable specifies the platform that the engine should be cross-compiled for.
6.33 +BUILD_FOR=$(BUILD_ON)
6.34 +
6.35 +# Cross-compiling is currently not supported.
6.36 +# Maybe you can hack something with `local.conf`.
6.37 +ifneq ($(BUILD_ON),$(BUILD_FOR))
6.38 + $(error I don't know how to build for $(BUILD_FOR) on $(BUILD_ON).)
6.39 +endif
6.40 +
6.41 +# Installation path prefix for libraries and binaries, except for system.db
6.42 +PREFIX=$(HOME)
6.43 +
6.44 +# Installation path for system.db
6.45 +SYSTEM_DB=/usr/local/share/pEp/system.db
6.46 +
6.47 +# Filename of the pEpEngine library
6.48 +ifeq ($(BUILD_FOR),Linux)
6.49 + TARGET=libpEpEngine.so
6.50 +else ifeq ($(BUILD_FOR),Darwin)
6.51 + TARGET=libpEpEngine.dylib
6.52 +endif
6.53 +
6.54 +# If empty, create a release build.
6.55 +# Otherwise, create a debug build.
6.56 +# This variable is ineffective in your local.conf file.
6.57 +DEBUG=YES
6.58 +
6.59 +# If empty, suppress compiler warnings.
6.60 +# Otherwise, print warnings.
6.61 +# This variable is ineffective in your local.conf file.
6.62 +WARN=placeholder
6.63 +
6.64 +
6.65 +######### C and C++ #########
6.66 +TARGET_ARCH=
6.67 +# The following two variables will be appended to.
6.68 +# You can thus not set them to a fixed value here.
6.69 +ifeq ($(BUILD_FOR),Linux)
6.70 + LDFLAGS=
6.71 +else ifeq ($(BUILD_FOR),Darwin)
6.72 + # "-bind_at_load" helps find symbol resolution errors faster
6.73 + LDFLAGS=-bind_at_load
6.74 +endif
6.75 +
6.76 +LDLIBS=
6.77 +
6.78 +
6.79 +######### C #########
6.80 +ifeq ($(BUILD_FOR),Linux)
6.81 + CC=gcc -std=c99 -pthread
6.82 +else ifeq ($(BUILD_FOR),Darwin)
6.83 + # clang issues a warning when "-pthread" is used for linking.
6.84 + # So, include it in CFLAGS, and not in CC
6.85 + CC=clang -std=c99
6.86 +endif
6.87 +
6.88 +ifeq ($(BUILD_FOR),Linux)
6.89 + CFLAGS=-fPIC -fstrict-aliasing -fdiagnostics-color=always
6.90 +else ifeq ($(BUILD_FOR),Darwin)
6.91 + CFLAGS=-pthread -fPIC -fstrict-aliasing -fcolor-diagnostics
6.92 +endif
6.93 +
6.94 +CPPFLAGS=
6.95 +
6.96 +# The flag -DNDEBUG will always be removed from CFLAGS for compiling tests.
6.97 +# The tests do not work properly, if compiled with -DNDEBUG
6.98 +ifeq ($(BUILD_FOR),Linux)
6.99 + ifdef WARN
6.100 + CFLAGS+= -Wall -pedantic -Wstrict-aliasing=3
6.101 + else
6.102 + CFLAGS+= -w
6.103 + endif
6.104 + ifdef DEBUG
6.105 + CFLAGS+= -Og -ggdb -DDEBUG_ERRORSTACK
6.106 + else
6.107 + CFLAGS+= -O3 -DNDEBUG
6.108 + endif
6.109 +else ifeq ($(BUILD_FOR),Darwin)
6.110 + ifdef WARN
6.111 + # FIXME Remove 'no-extended-offsetof' after ENGINE-236 is closed.
6.112 + CFLAGS+= -Wall -pedantic -Wno-extended-offsetof
6.113 + else
6.114 + CFLAGS+= -w
6.115 + endif
6.116 + ifdef DEBUG
6.117 + CFLAGS+= -O0 -g -DDEBUG_ERRORSTACK
6.118 + else
6.119 + CFLAGS+= -O3 -DNDEBUG
6.120 + endif
6.121 +endif
6.122 +
6.123 +# Additional CFLAGS used for compiling ASN1C-generated code
6.124 +ifeq ($(BUILD_FOR),Linux)
6.125 + # The '_DEFAULT_SOURCE' feature test macro is required to suppress the warning
6.126 + # _BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE
6.127 + # otherwise printed during the compilation of every asn1c-generated C file.
6.128 + # It's a glibc specific warning, only present in few versions around ~2.19.
6.129 + # See https://lwn.net/Articles/590381/ for a discussion.
6.130 + CFLAGS_GENERATED=-D_DEFAULT_SOURCE
6.131 +else ifeq ($(BUILD_FOR),Darwin)
6.132 + CFLAGS_GENERATED=
6.133 +endif
6.134 +
6.135 +
6.136 +######### C++ #########
6.137 +ifeq ($(BUILD_FOR),Linux)
6.138 + CXX=g++ -std=gnu++11 -pthread
6.139 +else ifeq ($(BUILD_FOR),Darwin)
6.140 + # clang issues a warning when "-pthread" is used for linking. So, include it in CXXFLAGS, and not in CXX
6.141 + CXX=clang -std=c++11
6.142 +endif
6.143 +
6.144 +# The flag -DNDEBUG will always be removed from CXXFLAGS for compiling tests.
6.145 +# The tests do not work properly, if compiled with -DNDEBUG
6.146 +ifeq ($(BUILD_FOR),Linux)
6.147 + CXXFLAGS=-fdiagnostics-color=always -I../src -I../asn.1 $(ETPAN_INC)
6.148 + ifdef WARN
6.149 + CXXFLAGS+=
6.150 + else
6.151 + CXXFLAGS+= -w
6.152 + endif
6.153 + ifdef DEBUG
6.154 + CXXFLAGS+= -Og -ggdb
6.155 + else
6.156 + CXXFLAGS+= -O3 -DNDEBUG
6.157 + endif
6.158 +else ifeq ($(BUILD_FOR),Darwin)
6.159 + CXXFLAGS=-pthread -fcolor-diagnostics -I../src -I../asn.1 $(ETPAN_INC)
6.160 + ifdef WARN
6.161 + CXXFLAGS+=
6.162 + else
6.163 + CXXFLAGS+= -w
6.164 + endif
6.165 + ifdef DEBUG
6.166 + CXXFLAGS+= -O0 -g
6.167 + else
6.168 + CXXFLAGS+= -O3 -DNDEBUG
6.169 + endif
6.170 +endif
6.171 +
6.172 +
6.173 +######### YML2 #########
6.174 +YML2_PATH=$(HOME)/yml2
6.175 +
6.176 +YML2_PROC=$(YML2_PATH)/yml2proc
6.177 +
6.178 +YML2_OPTS=--encoding=utf8
6.179 +
6.180 +
6.181 +######### asn1c #########
6.182 +# asn1c binary
6.183 +ASN1C=asn1c
6.184 +
6.185 +# asn1c include search flag
6.186 +ASN1C_INC=
6.187 +#ASN1C_INC=-I$(HOME)/include
6.188 +
6.189 +
6.190 +######### libetpan #########
6.191 +# libetpan library search flag
6.192 +ETPAN_LIB=-L$(PREFIX)/lib
6.193 +
6.194 +# libetpan include search flag
6.195 +ETPAN_INC=-I$(PREFIX)/include
6.196 +
6.197 +
6.198 +######### sqlite3 #########
6.199 +# If empty (or undefined), compile sqlite3 from the sources shipped with the pEp distribution.
6.200 +# Otherwise, use an sqlite3 implementation found in the OS's include/library paths.
6.201 +SQLITE3_FROM_OS=placeholder
6.202 +
6.203 +
6.204 +######### OpenPGP #########
6.205 +# Path of GPG binary
6.206 +# gpgconf is not available for old version of GPG, for example GPG 2.0.30. Override this variable, if you compile the engine for such an old version.
6.207 +GPG_CMD:=$(shell gpgconf --list-components | awk -F: '/^gpg:/ { print $$3; exit 0; }')
6.208 +
6.209 +# Selects OpenPGP implementation. must be either `GPG` or `NETPGP`
6.210 +OPENPGP=GPG
6.211 +
6.212 +# Path of libGPGME binary
6.213 +ifeq ($(BUILD_FOR),Linux)
6.214 + LIBGPGME=libgpgme.so.11
6.215 +else ifeq ($(BUILD_FOR),Darwin)
6.216 + LIBGPGME=libgpgme.dylib
6.217 +endif
6.218 +
6.219 +# libGPGME library search flag
6.220 +ifeq ($(BUILD_FOR),Linux)
6.221 + GPGME_LIB=
6.222 +else ifeq ($(BUILD_FOR),Darwin)
6.223 + GPGME_LIB=-L$(HOME)/lib
6.224 +endif
6.225 +
6.226 +# libGPGME include search flag
6.227 +ifeq ($(BUILD_FOR),Linux)
6.228 + GPGME_INC=
6.229 +else ifeq ($(BUILD_FOR),Darwin)
6.230 + GPGME_INC=-I$(HOME)/include
6.231 +endif
6.232 +
6.233 +# NETPGP library search flag
6.234 +NETPGP_LIB=
6.235 +#NETPGP_LIB=-L$(PREFIX)/lib
6.236 +
6.237 +# libGPGME include search flag
6.238 +NETPGP_INC=
6.239 +#NETPGP_INC=-I$(PREFIX)/include
6.240 +
6.241 +
6.242 +######### Engine internals #########
6.243 +# C macros (not environment variables) that can be overridden:
6.244 +# DEFAULT_KEYSERVER - string with default keyserver
6.245 +# CRASHDUMP_DEFAULT_LINES - number of log lines to deliver for crashdumps
6.246 +# Example:
6.247 +# EXTRA_MACROS=-DDEFAULT_KEYSERVER=\"default-server.org\" -DCRASHDUMP_DEFAULT_LINES=23
6.248 +EXTRA_MACROS=
6.249 +
6.250 +
6.251 +######### Misc #########
6.252 +# FIXME Maybe include these variables here.
6.253 +# Check how they are used throughout the project before setting them here
6.254 +#LLDB_BIN
6.255 +
6.256 +
6.257 +######### Footer #########
6.258 +include $(HERE)/Makefile.conf
6.259 +
6.260 +-include $(HERE)/local.conf
6.261 +
6.262 +ifdef BUILD_CONFIG
6.263 + include $(BUILD_CONFIG)
6.264 +endif
6.265 +
6.266 +# YML_PATH is needed in the environment of every call to a program of the YML2 distribution
6.267 +export YML_PATH=$(YML2_PATH)
7.1 --- a/doc/build-debian.md Fri Oct 27 16:05:34 2017 +0200
7.2 +++ b/doc/build-debian.md Mon Oct 30 17:35:33 2017 +0100
7.3 @@ -64,30 +64,25 @@
7.4 mkdir ~/code/pep-engine/build
7.5 ~~~
7.6
7.7 -Note: Everything PLATFORM_OVERRIDE-related is currenty outdated. Do not rely on the documentation here!
7.8 +Edit the build configuration to your needs in `Makefile.conf`, or create a `local.conf` that sets any of the make variables documented in `Makefile.conf`. All the default values for the build configuration variables on each platform are documented in `default.conf`.
7.9 +
7.10 +If a dependency is not found in your system's default include or library paths, you will have to specify the according paths in a make variable. Typically, this has to be done at least for YML2, libetpan and asn1c.
7.11
7.12 -For an explanation of the mechanics of `PLATFORM_OVERRIDE`, see the inline comments in `Makefile.conf`.
7.13 -In this guide, the platform-specific configuration will be called `local`.
7.14 -The installation directory will be a subdirectory of the repository.
7.15 -This is useful for testing only.
7.16 +For a more detailed explanation of the mechanics of these build configuration files, and overriding defaults, see the comments in `default.conf`.
7.17 +
7.18 +Below is a sample `./local.conf` file, for orientation.
7.19
7.20 ~~~
7.21 -export PLATFORM_OVERRIDE=local
7.22 -~~~
7.23 -
7.24 -`./build-config/local.conf`:
7.25 -
7.26 -~~~
7.27 -PREFIX=$(HOME)/code/pep-engine/build
7.28 +PREFIX=$(HOME)/engine/build
7.29 SYSTEM_DB=$(PREFIX)/share/pEp/system.db
7.30
7.31 -YML2_PATH=$(HOME)/code/yml2
7.32 +YML2_PATH=$(HOME)/yml2
7.33
7.34 -ETPAN_LIB=-L$(HOME)/code/libetpan/build/lib
7.35 -ETPAN_INC=-I$(HOME)/code/libetpan/build/include
7.36 +ETPAN_LIB=-L$(HOME)/libetpan/build/lib
7.37 +ETPAN_INC=-I$(HOME)/libetpan/build/include
7.38
7.39 -ASN1C=$(HOME)/code/asn1c/build/bin/asn1c
7.40 -ASN1C_INC=-I$(HOME)/code/asn1c/build/share
7.41 +ASN1C=$(HOME)/asn1c/build/bin/asn1c
7.42 +ASN1C_INC=-I$(HOME)/asn1c/build/share/asn1c
7.43 ~~~
7.44
7.45 The engine is built as follows:
8.1 --- a/doc/build-macos.md Fri Oct 27 16:05:34 2017 +0200
8.2 +++ b/doc/build-macos.md Mon Oct 30 17:35:33 2017 +0100
8.3 @@ -76,21 +76,16 @@
8.4 mkdir ~/code/pep-engine/build
8.5 ~~~
8.6
8.7 -Note: Everything PLATFORM_OVERRIDE-related is currenty outdated. Do not rely on the documentation here!
8.8 +Edit the build configuration to your needs in `Makefile.conf`, or create a `local.conf` that sets any of the make variables documented in `Makefile.conf`. All the default values for the build configuration variables on each platform are documented in `default.conf`.
8.9 +
8.10 +If a dependency is not found in your system's default include or library paths, you will have to specify the according paths in a make variable. Typically, this has to be done at least for YML2, and libetpan.
8.11
8.12 -For an explanation of the mechanics of `PLATFORM_OVERRIDE`, see the inline comments in `Makefile.conf`.
8.13 -In this guide, the platform-specific configuration will be called `local`.
8.14 -The installation directory will be a subdirectory of the repository.
8.15 -This is useful for testing only.
8.16 +For a more detailed explanation of the mechanics of these build configuration files, and overriding defaults, see the comments in `default.conf`.
8.17 +
8.18 +Below is a sample `./local.conf` file, for orientation.
8.19
8.20 ~~~
8.21 -export PLATFORM_OVERRIDE=local
8.22 -~~~
8.23 -
8.24 -`./build-config/local.conf`:
8.25 -
8.26 -~~~
8.27 -PREFIX=$(HOME)/code/pep-engine/build
8.28 +PREFIX=$(HOME)/code/engine/build
8.29 SYSTEM_DB=$(PREFIX)/share/pEp/system.db
8.30
8.31 YML2_PATH=$(HOME)/code/yml2
8.32 @@ -98,8 +93,8 @@
8.33 ETPAN_LIB=-L$(HOME)/code/libetpan/build/lib
8.34 ETPAN_INC=-I$(HOME)/code/libetpan/build/include
8.35
8.36 -GPGME_LIB=-L$(HOME)/code/gpgme/build/lib
8.37 -GPGME_INC=-I$(HOME)/code/gpgme/build/include
8.38 +GPGME_LIB=-L$(HOME)/lib
8.39 +GPGME_INC=-I$(HOME)/include
8.40 ~~~
8.41
8.42 The engine is built as follows:
9.1 --- a/src/Makefile Fri Oct 27 16:05:34 2017 +0200
9.2 +++ b/src/Makefile Mon Oct 30 17:35:33 2017 +0100
9.3 @@ -3,7 +3,7 @@
9.4 # This file may be used under the terms of the GNU General Public License version 3
9.5 # see LICENSE.txt
9.6
9.7 -include ../Makefile.conf
9.8 +include ../default.conf
9.9
9.10 CFLAGS+= $(ETPAN_INC) -I../asn.1 -DSYSTEM_DB=\"$(SYSTEM_DB)\" $(EXTRA_MACROS)
9.11 LDFLAGS+= $(ETPAN_LIB) -L../asn.1 -shared
10.1 --- a/src/message_api.c Fri Oct 27 16:05:34 2017 +0200
10.2 +++ b/src/message_api.c Mon Oct 30 17:35:33 2017 +0100
10.3 @@ -21,6 +21,21 @@
10.4 #define _MAX(A, B) ((B) > (A) ? (B) : (A))
10.5 #endif
10.6
10.7 +static const stringpair_t* search_optfields(message* msg, const char* key) {
10.8 + stringpair_list_t* opt_fields = msg->opt_fields;
10.9 +
10.10 + const stringpair_list_t* curr;
10.11 +
10.12 + for (curr = opt_fields; curr && curr->value; curr = curr->next) {
10.13 + if (curr->value->key) {
10.14 + if (strcasecmp(curr->value->key, key) == 0)
10.15 + return curr->value;
10.16 + }
10.17 + }
10.18 +
10.19 + return NULL;
10.20 +}
10.21 +
10.22 static char * keylist_to_string(const stringlist_t *keylist)
10.23 {
10.24 if (keylist) {
10.25 @@ -1889,6 +1904,19 @@
10.26 return status;
10.27 }
10.28
10.29 +static PEP_STATUS transfer_autoconsume(message* src, message* msg) {
10.30 + const stringpair_t* autoconsume = search_optfields(src, "pEp-auto-consume");
10.31 +
10.32 + PEP_STATUS status = PEP_STATUS_OK;
10.33 +
10.34 + if (autoconsume) {
10.35 + stringpair_t* cpy = stringpair_dup(autoconsume);
10.36 + if (!cpy || !(stringpair_list_add(msg->opt_fields, cpy)))
10.37 + status = PEP_OUT_OF_MEMORY;
10.38 + }
10.39 + return status;
10.40 +}
10.41 +
10.42 static PEP_STATUS check_for_sync_msg(PEP_SESSION session,
10.43 message* src,
10.44 PEP_rating* rating,
10.45 @@ -2437,6 +2465,13 @@
10.46 if (wrap_info) {
10.47 // useless check, but just in case we screw up?
10.48 if (strcmp(wrap_info, "INNER") == 0) {
10.49 + // transfer autoconsume
10.50 + status = transfer_autoconsume(src, inner_message);
10.51 + if (status != PEP_STATUS_OK) {
10.52 + free_message(inner_message);
10.53 + GOTO(pep_error);
10.54 + }
10.55 +
10.56 // THIS is our message
10.57 // FIXME: free msg, but check references
10.58 src = msg = inner_message;
11.1 --- a/sync/Makefile Fri Oct 27 16:05:34 2017 +0200
11.2 +++ b/sync/Makefile Mon Oct 30 17:35:33 2017 +0100
11.3 @@ -3,7 +3,7 @@
11.4 # This file may be used under the terms of the GNU General Public License version 3
11.5 # see LICENSE.txt
11.6
11.7 -include ../Makefile.conf
11.8 +include ../default.conf
11.9
11.10 .PHONY: all
11.11 all: .codegen
12.1 --- a/test/Makefile Fri Oct 27 16:05:34 2017 +0200
12.2 +++ b/test/Makefile Mon Oct 30 17:35:33 2017 +0100
12.3 @@ -5,7 +5,7 @@
12.4
12.5 HERE:=$(CURDIR)
12.6
12.7 -include ../Makefile.conf
12.8 +include ../default.conf
12.9
12.10 TARGET=pEpEngineTest
12.11