README-OSX.md
author Damiano Boppart
Mon, 20 Mar 2017 16:14:27 +0100
changeset 1681 97db633df271
parent 1513 e7f7e42385b5
child 1682 1a6a30a2b30c
permissions -rw-r--r--
Update README for macOS
Damiano@1681
     1
This file is under Creative Commons License 3.0 cc-by-sa
vb@1513
     2
dirk@821
     3
# Building for OS X/macOS
dirk@821
     4
See also README.txt for general information.
dirk@821
     5
Damiano@1681
     6
For compiling pEp Engine and its dependencies, make sure you have the LANG variable set. Some source files contain unicode characters, and python (assuming files are ascii) will fail.
dirk@1415
     7
Damiano@1681
     8
```
Damiano@1681
     9
export LANG=en_US.UTF-8
Damiano@1681
    10
```
vb@1425
    11
dirk@821
    12
## Dependencies
dirk@821
    13
dirk@821
    14
### MacPorts
Damiano@1681
    15
[Install MacPorts](https://www.macports.org/install.php) for your version of OS X/macOS.
dirk@821
    16
Damiano@1681
    17
If MacPorts is already installed on your machine, but was installed by a different user, make sure your `PATH` variable is set as follows in `~/.profile`:
dirk@706
    18
dirk@706
    19
```
Damiano@1681
    20
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
dirk@821
    21
```
dirk@821
    22
Damiano@1681
    23
Install dependencies packaged with MacPorts as follows.
Damiano@1681
    24
Damiano@1681
    25
```
Damiano@1681
    26
sudo port install mercurial py27-lxml gpgme automake asn1c zlib openssl libiconv cyrus-sasl2
Damiano@1681
    27
```
dirk@1414
    28
dirk@1414
    29
Make sure that `python` is a version 2 one:
dirk@1414
    30
dirk@1414
    31
```
dirk@1414
    32
sudo port select python python27
dirk@1414
    33
```
dirk@1414
    34
Damiano@1681
    35
### Other Dependecies
dirk@821
    36
dirk@821
    37
#### [yml2](https://fdik.org/yml/toolchain)
dirk@821
    38
Install into your home directory:
dirk@821
    39
dirk@821
    40
```
dirk@821
    41
pushd ~
dirk@1082
    42
hg clone https://cacert.pep.foundation/dev/repos/yml2/
dirk@821
    43
popd
dirk@821
    44
```
dirk@821
    45
dirk@821
    46
#### libetpan
dirk@821
    47
dirk@821
    48
Note: libetpan needs libz and libiconv, but the libiconv from MacPorts is not compatible, some
dirk@821
    49
functions seem to have been renamed there. Therefore the dynlib from OS X is used.
dirk@821
    50
dirk@821
    51
```
Damiano@1681
    52
git clone https://github.com/fdik/libetpan
Damiano@1681
    53
cd libetpan
Damiano@1681
    54
./autogen.sh --prefix "$HOME"
dirk@706
    55
make
Damiano@1681
    56
make install
dirk@821
    57
```
dirk@821
    58
Damiano@1681
    59
## Building pEp Engine
Damiano@1681
    60
dirk@821
    61
### Configuration
Damiano@1681
    62
You can change some defaults by editing `Makefile.conf`. The following variable needs to be set appropriately:
dirk@821
    63
Damiano@1681
    64
```
Damiano@1681
    65
LIBGPGME=/opt/local/lib/libgpgme.11.dylib
Damiano@1681
    66
```
dirk@821
    67
dirk@821
    68
### Build
dirk@821
    69
dirk@821
    70
```
dirk@821
    71
make clean
dirk@821
    72
make all
dirk@821
    73
make db
dirk@821
    74
```
dirk@821
    75
Damiano@1681
    76
### Installation
dirk@821
    77
dirk@821
    78
```
dirk@706
    79
make install
Damiano@1681
    80
sudo make -C db install
dirk@821
    81
```
dirk@821
    82
Damiano@1681
    83
Since the `system.db` rarely changes, the last step is not needed for every build. If you would like to be able to install the engine without `sudo`, ensure that your user can write the file `/usr/local/share/pEp/system.db`. This is not recommended for production machines.
dirk@821
    84
dirk@821
    85
### Run tests
dirk@821
    86
Damiano@1681
    87
If you installed the test keys in your keyring (see: README.txt), this should just work:
dirk@821
    88
dirk@821
    89
```
dirk@821
    90
make test
dirk@706
    91
```
dirk@706
    92
dirk@670
    93
# Building for iOS
dirk@670
    94
dirk@670
    95
This is done with Xcode. Simply add `pEpEngine.xcodeproj` to
dirk@670
    96
your project and add a dependency to the target `pEpEngine`
dirk@670
    97
(in `Target Dependencies` in your `Build Phases`.
dirk@670
    98
dirk@670
    99
Usually you just integrate `pEpiOSAdapter.xcodeproj`.