forked from pEp.foundation/pEpEngine
Merge branch 'ENGINE-864'. This merges in some generic Makefile refactoring as well as the changes so that pEpMIME can be built in to the engine (this requires a separately checked-out pEpMIME repo, setting PEP_MIME to 1 in the local.conf file, and ensuring PEP_MIME_SRC is set properly. System also needs boost to do built-in parsing, but if you don't touch the PEP_MIME variable, we still default to etpan. Please contact krista with a copy of your local.conf and the compiler error if you can't get it working. (Does not apply to non-MacOS/*nix-flavoured OSs for the time being...)
commit
0ddef895f7
@ -0,0 +1,102 @@
|
||||
# This file is under GNU General Public License 3.0
|
||||
# see LICENSE.txt
|
||||
|
||||
##################################################################################
|
||||
# This is a modified Makefile based on that in the libpEpMIME repository.
|
||||
# THEY ARE NOT INTERCHANGEABLE. This is SPECIFICALLY for the pEp engine and
|
||||
# is only for the built-in variant of the compiler.
|
||||
#
|
||||
# Note that this is the only supported way of including pEpMIME within the engine.
|
||||
#
|
||||
# If additional object files are added to the repository object requirements, they
|
||||
# will have to be included here specifically.
|
||||
##################################################################################
|
||||
|
||||
.PHONY: mimesrc lib all clean install test
|
||||
|
||||
include ../Makefile.conf
|
||||
|
||||
######### General #########
|
||||
BUILD_ON:=$(shell uname)
|
||||
|
||||
# This variable specifies the platform that the engine should be cross-compiled for.
|
||||
BUILD_FOR=$(BUILD_ON)
|
||||
|
||||
# Cross-compiling is currently not supported.
|
||||
# Maybe you can hack something with `local.conf`.
|
||||
ifneq ($(BUILD_ON),$(BUILD_FOR))
|
||||
$(error I don't know how to build for $(BUILD_FOR) on $(BUILD_ON).)
|
||||
endif
|
||||
|
||||
SED=
|
||||
# MacOS needs -liconv, Linix don't.
|
||||
ifeq ($(BUILD_FOR),Darwin)
|
||||
LDLIBS+= -liconv
|
||||
SED=sed -i ''
|
||||
else
|
||||
SED=sed -i
|
||||
endif
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# libpEpMIME can be built as a separate library in its own repository.
|
||||
#
|
||||
# However, it is dependent on the engine, which obviously does not
|
||||
# work within the engine, as the engine is dependent upon IT.
|
||||
# Because header files within the engine are local and not defined
|
||||
# to exist in some installed library under pEp/header_file.h, we simply
|
||||
# copy them into this directory and build/modify them as needed.
|
||||
#
|
||||
######################################################################
|
||||
# Repo source
|
||||
PEPMIME_SRC_FILES:= $(wildcard $(PEP_MIME_SRC)/*.cc) $(wildcard $(PEP_MIME_SRC)/*.hh) $(wildcard $(PEP_MIME_SRC)/*.hxx)
|
||||
# Stripped filenames
|
||||
LOCAL_PEPMIME_SRC:= $(subst $(PEP_MIME_SRC)/,,$(PEPMIME_SRC_FILES))
|
||||
|
||||
all: lib
|
||||
|
||||
lib: mimesrc libpEpMIME.a
|
||||
|
||||
mimesrc: ${LOCAL_PEPMIME_SRC}
|
||||
|
||||
# Copy the files to the local directory and change their engine header references to quoted references
|
||||
%.hh : $(PEP_MIME_SRC)/%.hh
|
||||
cp -p $< $@
|
||||
$(SED) 's/#include <pEp\/\(.*\)>/#include "..\/src\/\1"/g' $@
|
||||
|
||||
%.cc : $(PEP_MIME_SRC)/%.cc
|
||||
cp -p $< $@
|
||||
$(SED) 's/#include <pEp\/\(.*\)>/#include "..\/src\/\1"/g' $@
|
||||
|
||||
%.hxx : $(PEP_MIME_SRC)/%.hxx
|
||||
cp -p $< $@
|
||||
$(SED) 's/#include <pEp\/\(.*\)>/#include "..\/src\/\1"/g' $@
|
||||
|
||||
LIB_OBJ=pEpMIME.o pEpMIME_internal.o rules.o bodyparser.o \
|
||||
attachment.o bodygenerator.o \
|
||||
headerparser.o parse_timestamp.o parse_address.o nulllogger.o \
|
||||
base64.o nfc.o mime_headers.o nfc_sets.o to_utf8.o quoted_printable.o \
|
||||
header_generator.o message.o pEpEngine_mime.o
|
||||
|
||||
libpEpMIME.a: $(LIB_OBJ)
|
||||
${AR} rcs $@ $^
|
||||
|
||||
%.o : %.cc %.hh
|
||||
${CXX} ${CXXFLAGS} ${CPPFLAGS} -I${PREFIX}/include -o $@ -c $<
|
||||
|
||||
%.o : %.cc
|
||||
${CXX} ${CXXFLAGS} ${CPPFLAGS} -I${PREFIX}/include -o $@ -c $<
|
||||
|
||||
clean:
|
||||
rm -vf *.o *.a
|
||||
|
||||
srcclean:
|
||||
rm *.cc *.hh *.hxx
|
||||
|
||||
install: lib
|
||||
mkdir -p "$(PREFIX)/lib/"
|
||||
cp -v libpEpMIME.a $(PREFIX)/lib
|
||||
|
||||
uninstall:
|
||||
rm $(PREFIX)/lib/libpEpMIME.a
|
||||
|
@ -0,0 +1,38 @@
|
||||
# Instructions and caveats for using pEpMIME as the built-in engine parser
|
||||
|
||||
## Makefile variables and local.conf
|
||||
|
||||
We copy the necessary files from the user's *separate* libpEpMIME repository
|
||||
on the machine.
|
||||
|
||||
**Note: The Makefile in this directory is *different* from the libpEpMIME Makefile.**
|
||||
**DO NOT REPLACE THE pEpEngine's pEpMIME Makefile with the one from the libpEpMIME repository. It won't work!**
|
||||
|
||||
Source files in this directory are local copies only and will be copied over if the repository is
|
||||
updated. We post-process the source to change the "installed-header" requirements of the "separate"
|
||||
(quotes intentional) library.
|
||||
|
||||
* PEP_MIME=1
|
||||
* PEP_MIME_SRC=<your checked-out libpEpMIME repo's src directory>
|
||||
|
||||
## Known issues
|
||||
On MacOS, the built-in standard BSD C library provides strlcat et al. **However**, for some weird reason, when
|
||||
compiling the engine with pEpMIME, the compiler thinks strlcat is no longer defined, though everything links and runs
|
||||
in the end.
|
||||
|
||||
If you see something like:
|
||||
|
||||
```
|
||||
platform_unix.c:280:5: warning: implicitly declaring library function 'strlcat' with type 'unsigned long (char *, const char *, unsigned long)' [-Wimplicit-function-declaration]
|
||||
strlcat(*first, second, size);
|
||||
^
|
||||
platform_unix.c:280:5: note: include the header <string.h> or explicitly provide a declaration for 'strlcat'
|
||||
1 warning generated.
|
||||
```
|
||||
|
||||
It doesn't seem to be an actual issue, and maybe it's a problem of compiling part of the engine with clang and part of it with clang++ and c++14, but anyway, watch out for it, and
|
||||
don't complain to the engine team unless you figure out how to fix it ;)
|
||||
|
||||
## TODO
|
||||
|
||||
* git submodules would be a good way to handle our "copy this in because it really isn't a separate library" issue
|
Loading…
Reference in new issue