doc/build-macos.md
author Damiano Boppart <damiano@pep-security.net>
Tue, 29 Aug 2017 00:56:32 +0200
branchENGINE-237
changeset 2015 eefffcd9f781
parent 2014 4b6659d17b61
child 2019 6c2b325f2056
permissions -rw-r--r--
Formatting cleanup
damiano@2014
     1
<!-- Copyright 2015-2017, pEp foundation, Switzerland
damiano@2014
     2
This file is part of the pEp Engine
damiano@2014
     3
This file may be used under the terms of the Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) License
damiano@2014
     4
See CC_BY-SA.txt -->
vb@1513
     5
damiano@2014
     6
# Build instructions for macOS Sierra and iOS
dirk@821
     7
damiano@2014
     8
# Installing packaged dependencies
dirk@1415
     9
damiano@2014
    10
## MacPorts
vb@1425
    11
damiano@2014
    12
MacPorts is needed to install some compile-time dependencies.
damiano@2014
    13
Install MacPorts according to the instructions found [here](https://www.macports.org/install.php).
damiano@2014
    14
Ensure that Macports' binary paths (`/opt/local/bin` and `/opt/local/sbin`) are in your `PATH` environment variable.
dirk@821
    15
damiano@2014
    16
~~~
damiano@2014
    17
# general
damiano@2014
    18
sudo port install mercurial
damiano@2014
    19
# YML2
damiano@2014
    20
sudo port install py27-lxml
damiano@2014
    21
# libetpan
damiano@2014
    22
sudo port install git autoconf automake libtool
damiano@2014
    23
# asn1c
damiano@2014
    24
sudo port install asn1c
damiano@2014
    25
# engine
damiano@2014
    26
sudo port install gpgme
damiano@2014
    27
~~~
dirk@821
    28
damiano@2015
    29
FIXME Are `zlib openssl cyrus-sasl2` needed?
damiano@2015
    30
They were present in an older revision of the build instructions.
dirk@706
    31
damiano@2014
    32
Ensure that `python` is Python 2.7:
dirk@821
    33
damiano@2014
    34
~~~
damiano@2014
    35
sudo port select python python27
damiano@2014
    36
~~~
Damiano@1681
    37
damiano@2014
    38
# Installing unpackaged dependencies
damiano@2014
    39
## YML2
dirk@1414
    40
damiano@2014
    41
~~~
damiano@2014
    42
mkdir -p ~/code/yml2
damiano@2014
    43
hg clone https://cacert.pep.foundation/dev/repos/yml2/ ~/code/yml2
damiano@2014
    44
~~~
dirk@1414
    45
damiano@2014
    46
## libetpan
damiano@2014
    47
pEp Engine requires libetpan with a set of patches that have not been upstreamed yet.
dirk@1414
    48
damiano@2014
    49
~~~
damiano@2014
    50
mkdir -p ~/code/libetpan
damiano@2014
    51
git clone https://github.com/fdik/libetpan ~/code/libetpan
damiano@2014
    52
cd ~/code/libetpan
damiano@2014
    53
mkdir ~/code/libetpan/build
damiano@2014
    54
./autogen.sh --prefix="$HOME/code/libetpan/build"
edouard@1682
    55
make
edouard@1682
    56
make install
damiano@2014
    57
~~~
edouard@1682
    58
damiano@2014
    59
## GPGME
damiano@2014
    60
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.
dirk@821
    61
damiano@2014
    62
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.
dirk@821
    63
damiano@2014
    64
~~~
damiano@2014
    65
mkdir -p ~/code/gpgme/build/include
damiano@2014
    66
cp /opt/local/include/gpg*.h ~/code/gpgme/build/include
damiano@2014
    67
mkdir -p ~/code/gpgme/build/lib
damiano@2014
    68
cp -r /opt/local/lib/libgpg* ~/code/gpgme/build/lib
damiano@2014
    69
~~~
dirk@821
    70
damiano@2014
    71
It's of course possible to skip MacPort's version, and use a self-compiled GPGME/GPG.
dirk@821
    72
damiano@2014
    73
# pEp Engine
dirk@821
    74
damiano@2014
    75
~~~
damiano@2014
    76
mkdir -p ~/code/pep-engine
damiano@2014
    77
hg clone https://cacert.pep.foundation/dev/repos/pEpEngine/ ~/code/pep-engine
damiano@2014
    78
cd ~/code/pep-engine
damiano@2014
    79
mkdir ~/code/pep-engine/build
damiano@2014
    80
~~~
dirk@821
    81
damiano@2014
    82
For an explanation of the mechanics of `PLATFORM_OVERRIDE`, see the inline comments in `Makefile.conf`.
damiano@2014
    83
In this guide, the platform-specific configuration will be called `local`.
damiano@2014
    84
The installation directory will be a subdirectory of the repository.
damiano@2014
    85
This is useful for testing only.
Damiano@1681
    86
damiano@2014
    87
~~~
damiano@2014
    88
export PLATFORM_OVERRIDE=local
damiano@2014
    89
~~~
dirk@821
    90
damiano@2014
    91
`./build-config/local.conf`:
dirk@821
    92
damiano@2014
    93
~~~
damiano@2014
    94
PREFIX=$(HOME)/code/pep-engine/build
damiano@2014
    95
SYSTEM_DB=$(PREFIX)/share/pEp/system.db
dirk@821
    96
damiano@2014
    97
YML2_PATH=$(HOME)/code/yml2
damiano@2014
    98
damiano@2014
    99
ETPAN_LIB=-L$(HOME)/code/libetpan/build/lib
damiano@2014
   100
ETPAN_INC=-I$(HOME)/code/libetpan/build/include
damiano@2014
   101
damiano@2014
   102
GPGME_LIB=-L$(HOME)/code/gpgme/build/lib
damiano@2014
   103
GPGME_INC=-I$(HOME)/code/gpgme/build/include
damiano@2014
   104
~~~
damiano@2014
   105
damiano@2014
   106
The engine is built as follows:
damiano@2014
   107
damiano@2014
   108
~~~
dirk@821
   109
make all
dirk@821
   110
make db
damiano@2014
   111
~~~
dirk@821
   112
damiano@2015
   113
The unit tests can be run without the engine library being installed, however `system.db` must be installed:
dirk@821
   114
damiano@2014
   115
~~~
damiano@2014
   116
make -C db install
damiano@2014
   117
~~~
dirk@821
   118
damiano@2014
   119
Since `system.db` rarely changes, its installation is not needed for every build.
dirk@821
   120
damiano@2014
   121
Tests can be compiled and executed with the following commands:
dirk@821
   122
damiano@2014
   123
~~~
damiano@2014
   124
make -C test compile
dirk@821
   125
make test
damiano@2014
   126
~~~