README-OSX.md
author Krista Grothoff <krista@pep-project.org>
Mon, 24 Oct 2016 21:33:35 +0200
branchENGINE-128
changeset 1334 85973d7d2859
parent 1317 0e6df10f76c4
child 1414 26697bb8bc2c
permissions -rw-r--r--
ENGINE-128: closing branch
dirk@821
     1
# Building for OS X/macOS
dirk@707
     2
dirk@821
     3
See also README.txt for general information.
dirk@821
     4
dirk@821
     5
## Dependencies
dirk@821
     6
dirk@821
     7
### MacPorts
dirk@821
     8
dirk@821
     9
Install [MacPorts](https://www.macports.org/) for your
dirk@821
    10
[version of OS X/macOS](https://www.macports.org/install.php).
dirk@821
    11
dirk@821
    12
Note that you need [Xcode installed](https://www.macports.org/install.php)
dirk@821
    13
for MacPorts, and for building the engine. You also need to accept Xcode's EULA.
dirk@821
    14
dirk@821
    15
*Note*: Use the script `macports_env.sh` (or a similar one) to set up a clean build environment
dirk@821
    16
before building the engine:
dirk@707
    17
dirk@707
    18
```
dirk@821
    19
. macports_env.sh
dirk@707
    20
```
dirk@707
    21
dirk@821
    22
If you don't use that environment, please make sure you've set up all search paths correctly.
dirk@706
    23
dirk@821
    24
#### MacPorts dependencies
dirk@706
    25
dirk@706
    26
```
dirk@821
    27
sudo port install mercurial
dirk@821
    28
sudo port install py27-lxml
dirk@821
    29
sudo port install gpgme
dirk@1317
    30
sudo port install automake
dirk@821
    31
sudo port install asn1c
dirk@821
    32
sudo port install zlib
dirk@821
    33
```
dirk@821
    34
dirk@821
    35
### Other dependecies
dirk@821
    36
dirk@821
    37
#### [yml2](https://fdik.org/yml/toolchain)
dirk@821
    38
dirk@821
    39
Install into your home directory:
dirk@821
    40
dirk@821
    41
```
dirk@821
    42
pushd ~
dirk@1082
    43
hg clone https://cacert.pep.foundation/dev/repos/yml2/
dirk@821
    44
popd
dirk@821
    45
```
dirk@821
    46
dirk@821
    47
#### libetpan
dirk@821
    48
dirk@821
    49
Note: libetpan needs libz and libiconv, but the libiconv from MacPorts is not compatible, some
dirk@821
    50
functions seem to have been renamed there. Therefore the dynlib from OS X is used.
dirk@821
    51
dirk@821
    52
```
dirk@821
    53
git clone https://github.com/fdik/libetpan libetpan-osx
dirk@821
    54
cd libetpan-osx/
dirk@821
    55
./autogen.sh
dirk@706
    56
make
dirk@821
    57
cp ./src/.libs/libetpan.a ~/lib/
dirk@821
    58
```
dirk@821
    59
dirk@821
    60
##### libetpan with xcodebuild
dirk@821
    61
dirk@821
    62
The build with autoconf (see previous section) is preferred. This is just for completeness.
dirk@821
    63
*Don't actually build libetpan with xcodebuild.*
dirk@821
    64
dirk@821
    65
```
dirk@821
    66
git clone https://github.com/fdik/libetpan libetpan-osx
dirk@821
    67
cd libetpan-osx/build-mac
dirk@821
    68
xcodebuild -project libetpan.xcodeproj/ -target "static libetpan"
dirk@821
    69
mkdir ~/lib
dirk@821
    70
cp build/Release/libetpan.a ~/lib/
dirk@821
    71
```
dirk@821
    72
dirk@821
    73
### Configuration
dirk@821
    74
dirk@821
    75
You can change some defaults by editing `Makefile.conf`. But this readme assumes you don't.
dirk@821
    76
dirk@821
    77
### Build
dirk@821
    78
dirk@821
    79
```
dirk@821
    80
make clean
dirk@821
    81
make all
dirk@821
    82
make db
dirk@821
    83
```
dirk@821
    84
dirk@821
    85
Done! The result should be (among others):
dirk@821
    86
dirk@821
    87
```
dirk@821
    88
./src/libpEpEngine.a
dirk@821
    89
./src/libpEpEngine.dylib
dirk@821
    90
```
dirk@821
    91
dirk@821
    92
### Install
dirk@821
    93
dirk@821
    94
Install (you might need sudo for some commands, depending on how your system is set up):
dirk@821
    95
dirk@821
    96
```
dirk@706
    97
make install
dirk@821
    98
make -C db install
dirk@821
    99
```
dirk@821
   100
dirk@821
   101
Since the `system.db` rarely changes, `make -C db install` is not needed for every build.
dirk@821
   102
dirk@821
   103
### Run tests
dirk@821
   104
dirk@821
   105
Make sure that you add `/opt/local/lib` to each definition of `LD_LIBRARY_PATH`
dirk@821
   106
in `test/Makefile`. This ensures that libgpgme will be found:
dirk@821
   107
dirk@821
   108
```
dirk@821
   109
test: pEpEngineTest
dirk@821
   110
        LD_LIBRARY_PATH=/opt/local/lib:~/lib:../src ./pEpEngineTest
dirk@821
   111
```
dirk@821
   112
dirk@821
   113
```
dirk@821
   114
make test
dirk@706
   115
```
dirk@706
   116
dirk@670
   117
# Building for iOS
dirk@670
   118
dirk@670
   119
This is done with Xcode. Simply add `pEpEngine.xcodeproj` to
dirk@670
   120
your project and add a dependency to the target `pEpEngine`
dirk@670
   121
(in `Target Dependencies` in your `Build Phases`.
dirk@670
   122
dirk@670
   123
Usually you just integrate `pEpiOSAdapter.xcodeproj`.