README-OSX.md
changeset 821 a0907c429673
parent 805 f026ae414feb
child 1082 9ed6c2829271
     1.1 --- a/README-OSX.md	Sun Jul 10 08:56:19 2016 +0200
     1.2 +++ b/README-OSX.md	Sat Jul 09 10:49:10 2016 +0200
     1.3 @@ -1,23 +1,119 @@
     1.4 -# Dependencies
     1.5 +# Building for OS X/macOS
     1.6  
     1.7 -You need a working [asn1c](https://lionet.info/asn1c/blog/).
     1.8 +See also README.txt for general information.
     1.9 +
    1.10 +## Dependencies
    1.11 +
    1.12 +### MacPorts
    1.13 +
    1.14 +Install [MacPorts](https://www.macports.org/) for your
    1.15 +[version of OS X/macOS](https://www.macports.org/install.php).
    1.16 +
    1.17 +Note that you need [Xcode installed](https://www.macports.org/install.php)
    1.18 +for MacPorts, and for building the engine. You also need to accept Xcode's EULA.
    1.19 +
    1.20 +*Note*: Use the script `macports_env.sh` (or a similar one) to set up a clean build environment
    1.21 +before building the engine:
    1.22  
    1.23  ```
    1.24 -brew install asn1c
    1.25 +. macports_env.sh
    1.26  ```
    1.27  
    1.28 -# Building for OS X
    1.29 +If you don't use that environment, please make sure you've set up all search paths correctly.
    1.30  
    1.31 -* TODO: which dependencies can be fetched via "brew" and which have to be compiled manually?
    1.32 -
    1.33 -## Build libetpan
    1.34 +#### MacPorts dependencies
    1.35  
    1.36  ```
    1.37 -cd pEpEngine   <--- huh? to build libetpan???
    1.38 -autoreconf -vfi
    1.39 -./configure
    1.40 +sudo port install mercurial
    1.41 +sudo port install py27-lxml
    1.42 +sudo port install gpgme
    1.43 +sudo port install autoconf
    1.44 +sudo port install asn1c
    1.45 +sudo port install zlib
    1.46 +```
    1.47 +
    1.48 +### Other dependecies
    1.49 +
    1.50 +#### [yml2](https://fdik.org/yml/toolchain)
    1.51 +
    1.52 +Install into your home directory:
    1.53 +
    1.54 +```
    1.55 +pushd ~
    1.56 +curl -LO http://fdik.org/yml2.tar.bz2
    1.57 +tar xf yml2.tar.bz2
    1.58 +rm yml2.tar.bz2*
    1.59 +popd
    1.60 +```
    1.61 +
    1.62 +#### libetpan
    1.63 +
    1.64 +Note: libetpan needs libz and libiconv, but the libiconv from MacPorts is not compatible, some
    1.65 +functions seem to have been renamed there. Therefore the dynlib from OS X is used.
    1.66 +
    1.67 +```
    1.68 +git clone https://github.com/fdik/libetpan libetpan-osx
    1.69 +cd libetpan-osx/
    1.70 +./autogen.sh
    1.71  make
    1.72 +cp ./src/.libs/libetpan.a ~/lib/
    1.73 +```
    1.74 +
    1.75 +##### libetpan with xcodebuild
    1.76 +
    1.77 +The build with autoconf (see previous section) is preferred. This is just for completeness.
    1.78 +*Don't actually build libetpan with xcodebuild.*
    1.79 +
    1.80 +```
    1.81 +git clone https://github.com/fdik/libetpan libetpan-osx
    1.82 +cd libetpan-osx/build-mac
    1.83 +xcodebuild -project libetpan.xcodeproj/ -target "static libetpan"
    1.84 +mkdir ~/lib
    1.85 +cp build/Release/libetpan.a ~/lib/
    1.86 +```
    1.87 +
    1.88 +### Configuration
    1.89 +
    1.90 +You can change some defaults by editing `Makefile.conf`. But this readme assumes you don't.
    1.91 +
    1.92 +### Build
    1.93 +
    1.94 +```
    1.95 +make clean
    1.96 +make all
    1.97 +make db
    1.98 +```
    1.99 +
   1.100 +Done! The result should be (among others):
   1.101 +
   1.102 +```
   1.103 +./src/libpEpEngine.a
   1.104 +./src/libpEpEngine.dylib
   1.105 +```
   1.106 +
   1.107 +### Install
   1.108 +
   1.109 +Install (you might need sudo for some commands, depending on how your system is set up):
   1.110 +
   1.111 +```
   1.112  make install
   1.113 +make -C db install
   1.114 +```
   1.115 +
   1.116 +Since the `system.db` rarely changes, `make -C db install` is not needed for every build.
   1.117 +
   1.118 +### Run tests
   1.119 +
   1.120 +Make sure that you add `/opt/local/lib` to each definition of `LD_LIBRARY_PATH`
   1.121 +in `test/Makefile`. This ensures that libgpgme will be found:
   1.122 +
   1.123 +```
   1.124 +test: pEpEngineTest
   1.125 +        LD_LIBRARY_PATH=/opt/local/lib:~/lib:../src ./pEpEngineTest
   1.126 +```
   1.127 +
   1.128 +```
   1.129 +make test
   1.130  ```
   1.131  
   1.132  # Building for iOS