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