doc/build-macos.md
branchENGINE-237
changeset 2014 4b6659d17b61
parent 2008 f93bf1fac875
child 2015 eefffcd9f781
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/doc/build-macos.md	Tue Aug 29 00:25:54 2017 +0200
     1.3 @@ -0,0 +1,125 @@
     1.4 +<!-- Copyright 2015-2017, pEp foundation, Switzerland
     1.5 +This file is part of the pEp Engine
     1.6 +This file may be used under the terms of the Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) License
     1.7 +See CC_BY-SA.txt -->
     1.8 +
     1.9 +# Build instructions for macOS Sierra and iOS
    1.10 +
    1.11 +# Installing packaged dependencies
    1.12 +
    1.13 +## MacPorts
    1.14 +
    1.15 +MacPorts is needed to install some compile-time dependencies.
    1.16 +Install MacPorts according to the instructions found [here](https://www.macports.org/install.php).
    1.17 +Ensure that Macports' binary paths (`/opt/local/bin` and `/opt/local/sbin`) are in your `PATH` environment variable.
    1.18 +
    1.19 +~~~
    1.20 +# general
    1.21 +sudo port install mercurial
    1.22 +# YML2
    1.23 +sudo port install py27-lxml
    1.24 +# libetpan
    1.25 +sudo port install git autoconf automake libtool
    1.26 +# asn1c
    1.27 +sudo port install asn1c
    1.28 +# engine
    1.29 +sudo port install gpgme
    1.30 +~~~
    1.31 +
    1.32 +FIXME Are `zlib openssl cyrus-sasl2` needed? They were in an older revision of the instructions
    1.33 +
    1.34 +Ensure that `python` is Python 2.7:
    1.35 +
    1.36 +~~~
    1.37 +sudo port select python python27
    1.38 +~~~
    1.39 +
    1.40 +# Installing unpackaged dependencies
    1.41 +## YML2
    1.42 +
    1.43 +~~~
    1.44 +mkdir -p ~/code/yml2
    1.45 +hg clone https://cacert.pep.foundation/dev/repos/yml2/ ~/code/yml2
    1.46 +~~~
    1.47 +
    1.48 +## libetpan
    1.49 +pEp Engine requires libetpan with a set of patches that have not been upstreamed yet.
    1.50 +
    1.51 +~~~
    1.52 +mkdir -p ~/code/libetpan
    1.53 +git clone https://github.com/fdik/libetpan ~/code/libetpan
    1.54 +cd ~/code/libetpan
    1.55 +mkdir ~/code/libetpan/build
    1.56 +./autogen.sh --prefix="$HOME/code/libetpan/build"
    1.57 +make
    1.58 +make install
    1.59 +~~~
    1.60 +
    1.61 +## GPGME
    1.62 +The MacPorts-packaged GPGME links to a version of GNU libiconv that has files in the same include/library paths as GPGME. This version of libiconv must not be visible to the linker when the pEp Engine is build or run.
    1.63 +
    1.64 +Thus the files of the GPGME distribution will have to be manually copied to separate include/library folders, so that no include or library paths used for building the pEp Engine contains files of MacPorts' libiconv distribution.
    1.65 +
    1.66 +~~~
    1.67 +mkdir -p ~/code/gpgme/build/include
    1.68 +cp /opt/local/include/gpg*.h ~/code/gpgme/build/include
    1.69 +mkdir -p ~/code/gpgme/build/lib
    1.70 +cp -r /opt/local/lib/libgpg* ~/code/gpgme/build/lib
    1.71 +~~~
    1.72 +
    1.73 +It's of course possible to skip MacPort's version, and use a self-compiled GPGME/GPG.
    1.74 +
    1.75 +# pEp Engine
    1.76 +
    1.77 +~~~
    1.78 +mkdir -p ~/code/pep-engine
    1.79 +hg clone https://cacert.pep.foundation/dev/repos/pEpEngine/ ~/code/pep-engine
    1.80 +cd ~/code/pep-engine
    1.81 +mkdir ~/code/pep-engine/build
    1.82 +~~~
    1.83 +
    1.84 +For an explanation of the mechanics of `PLATFORM_OVERRIDE`, see the inline comments in `Makefile.conf`.
    1.85 +In this guide, the platform-specific configuration will be called `local`.
    1.86 +The installation directory will be a subdirectory of the repository.
    1.87 +This is useful for testing only.
    1.88 +
    1.89 +~~~
    1.90 +export PLATFORM_OVERRIDE=local
    1.91 +~~~
    1.92 +
    1.93 +`./build-config/local.conf`:
    1.94 +
    1.95 +~~~
    1.96 +PREFIX=$(HOME)/code/pep-engine/build
    1.97 +SYSTEM_DB=$(PREFIX)/share/pEp/system.db
    1.98 +
    1.99 +YML2_PATH=$(HOME)/code/yml2
   1.100 +
   1.101 +ETPAN_LIB=-L$(HOME)/code/libetpan/build/lib
   1.102 +ETPAN_INC=-I$(HOME)/code/libetpan/build/include
   1.103 +
   1.104 +GPGME_LIB=-L$(HOME)/code/gpgme/build/lib
   1.105 +GPGME_INC=-I$(HOME)/code/gpgme/build/include
   1.106 +~~~
   1.107 +
   1.108 +The engine is built as follows:
   1.109 +
   1.110 +~~~
   1.111 +make all
   1.112 +make db
   1.113 +~~~
   1.114 +
   1.115 +The unit tests can be run without the engine library being installed, however the `system.db` must be installed:
   1.116 +
   1.117 +~~~
   1.118 +make -C db install
   1.119 +~~~
   1.120 +
   1.121 +Since `system.db` rarely changes, its installation is not needed for every build.
   1.122 +
   1.123 +Tests can be compiled and executed with the following commands:
   1.124 +
   1.125 +~~~
   1.126 +make -C test compile
   1.127 +make test
   1.128 +~~~