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