README-OSX.md
author Dirk Zimmermann <dirk@pep-project.org>
Thu, 25 Aug 2016 09:56:10 +0200
branchkeysync
changeset 1082 9ed6c2829271
parent 821 a0907c429673
child 1317 0e6df10f76c4
permissions -rw-r--r--
Update macOS build instructions
     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 hg clone https://cacert.pep.foundation/dev/repos/yml2/
    44 popd
    45 ```
    46 
    47 #### libetpan
    48 
    49 Note: libetpan needs libz and libiconv, but the libiconv from MacPorts is not compatible, some
    50 functions seem to have been renamed there. Therefore the dynlib from OS X is used.
    51 
    52 ```
    53 git clone https://github.com/fdik/libetpan libetpan-osx
    54 cd libetpan-osx/
    55 ./autogen.sh
    56 make
    57 cp ./src/.libs/libetpan.a ~/lib/
    58 ```
    59 
    60 ##### libetpan with xcodebuild
    61 
    62 The build with autoconf (see previous section) is preferred. This is just for completeness.
    63 *Don't actually build libetpan with xcodebuild.*
    64 
    65 ```
    66 git clone https://github.com/fdik/libetpan libetpan-osx
    67 cd libetpan-osx/build-mac
    68 xcodebuild -project libetpan.xcodeproj/ -target "static libetpan"
    69 mkdir ~/lib
    70 cp build/Release/libetpan.a ~/lib/
    71 ```
    72 
    73 ### Configuration
    74 
    75 You can change some defaults by editing `Makefile.conf`. But this readme assumes you don't.
    76 
    77 ### Build
    78 
    79 ```
    80 make clean
    81 make all
    82 make db
    83 ```
    84 
    85 Done! The result should be (among others):
    86 
    87 ```
    88 ./src/libpEpEngine.a
    89 ./src/libpEpEngine.dylib
    90 ```
    91 
    92 ### Install
    93 
    94 Install (you might need sudo for some commands, depending on how your system is set up):
    95 
    96 ```
    97 make install
    98 make -C db install
    99 ```
   100 
   101 Since the `system.db` rarely changes, `make -C db install` is not needed for every build.
   102 
   103 ### Run tests
   104 
   105 Make sure that you add `/opt/local/lib` to each definition of `LD_LIBRARY_PATH`
   106 in `test/Makefile`. This ensures that libgpgme will be found:
   107 
   108 ```
   109 test: pEpEngineTest
   110         LD_LIBRARY_PATH=/opt/local/lib:~/lib:../src ./pEpEngineTest
   111 ```
   112 
   113 ```
   114 make test
   115 ```
   116 
   117 # Building for iOS
   118 
   119 This is done with Xcode. Simply add `pEpEngine.xcodeproj` to
   120 your project and add a dependency to the target `pEpEngine`
   121 (in `Target Dependencies` in your `Build Phases`.
   122 
   123 Usually you just integrate `pEpiOSAdapter.xcodeproj`.