p≡p engine FORK
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

161 lines
5.0 KiB

  1. <!-- Copyright 2015-2017, pEp foundation, Switzerland
  2. This file is part of the pEp Engine
  3. This file may be used under the terms of the Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) License
  4. See CC_BY-SA.txt -->
  5. # Build instructions for macOS Sierra
  6. # Installing packaged dependencies
  7. You will find instructions for using either Macports or Homebrew below to install the compile-time dependencies.
  8. ## MacPorts
  9. Install MacPorts according to the instructions found [here](https://www.macports.org/install.php).
  10. Ensure that Macports' binary paths (`/opt/local/bin` and `/opt/local/sbin`) are in your `PATH` environment variable.
  11. ~~~
  12. # general
  13. sudo port install mercurial
  14. # YML2
  15. sudo port install py27-lxml
  16. # libetpan
  17. sudo port install git autoconf automake libtool
  18. # asn1c
  19. sudo port install asn1c
  20. # engine
  21. sudo port install gpgme
  22. ~~~
  23. Ensure that `python` is Python 2.7:
  24. ~~~
  25. sudo port select python python27
  26. ~~~
  27. ## Homebrew
  28. Install Homebrew according to the instructions found [here](https://docs.brew.sh/Installation.html).
  29. Ensure that Homebrew's binary path (`/usr/local/bin`) is in your `PATH` environment variable.
  30. ~~~
  31. # general
  32. brew install mercurial
  33. # YML2
  34. # If you don't have pip with your Python 2 distribution, you can install it with brew
  35. brew install python
  36. pip2 install --user lxml
  37. # libetpan
  38. brew install git autoconf automake libtool
  39. # asn1c
  40. brew install asn1c
  41. # engine
  42. brew install gpgme
  43. ~~~
  44. # Installing unpackaged dependencies
  45. ## YML2
  46. To check if lxml is properly installed, you can use this lxml "hello world" command:
  47. ~~~
  48. python2 -c 'from lxml import etree; root = etree.Element("root"); print(root.tag)'
  49. ~~~
  50. It should generate the following output:
  51. ~~~
  52. root
  53. ~~~
  54. ~~~
  55. mkdir -p ~/code/yml2
  56. hg clone https://pep.foundation/dev/repos/yml2/ ~/code/yml2
  57. ~~~
  58. ## libetpan
  59. pEp Engine requires libetpan with a set of patches that have not been upstreamed yet.
  60. ~~~
  61. mkdir -p ~/code/libetpan
  62. git clone https://github.com/fdik/libetpan ~/code/libetpan
  63. cd ~/code/libetpan
  64. mkdir ~/code/libetpan/build
  65. ./autogen.sh --prefix="$HOME/code/libetpan/build"
  66. make
  67. make install
  68. ~~~
  69. ## GPGME
  70. The MacPorts-packaged GPGME links to a version of GNU libiconv that has files in the same include/library paths as GPGME. This version of libiconv must not be visible to the linker when the pEp Engine is build or run.
  71. Thus the files of the GPGME distribution will have to be manually copied to separate include/library folders, so that no include or library paths used for building the pEp Engine contains files of MacPorts' libiconv distribution.
  72. ~~~
  73. mkdir -p ~/code/gpgme/build/include
  74. cp /opt/local/include/gpg*.h ~/code/gpgme/build/include
  75. mkdir -p ~/code/gpgme/build/lib
  76. cp -r /opt/local/lib/libgpg* ~/code/gpgme/build/lib
  77. ~~~
  78. It's of course possible to skip MacPort's version, and use a self-compiled GPGME/GPG. The default build configuration assumes this case, and assumes you have installed your GPGME with `$(HOME)` as your prefix.
  79. # pEp Engine
  80. ~~~
  81. mkdir -p ~/code/pep-engine
  82. hg clone https://pep.foundation/dev/repos/pEpEngine/ ~/code/pep-engine
  83. cd ~/code/pep-engine
  84. mkdir ~/code/pep-engine/build
  85. ~~~
  86. Edit the build configuration to your needs in `Makefile.conf`, or create a `local.conf` that sets any of the make variables documented in `Makefile.conf`. All the default values for the build configuration variables on each platform are documented in `Makefile.conf`.
  87. If a dependency is not found in your system's default include or library paths, you will have to specify the according paths in a make variable. Typically, this has to be done at least for YML2, and libetpan.
  88. For a more detailed explanation of the mechanics of these build configuration files, and overriding defaults, see the comments in `Makefile.conf`.
  89. Below is a sample `./local.conf` file, for orientation.
  90. ~~~
  91. PREFIX=$(HOME)/code/engine/build
  92. SYSTEM_DB=$(PREFIX)/share/pEp/system.db
  93. YML2_PATH=$(HOME)/code/yml2
  94. ETPAN_LIB=-L$(HOME)/code/libetpan/build/lib
  95. ETPAN_INC=-I$(HOME)/code/libetpan/build/include
  96. GPGME_LIB=-L$(HOME)/lib
  97. GPGME_INC=-I$(HOME)/include
  98. ~~~
  99. The engine is built as follows:
  100. ~~~
  101. make all
  102. make db
  103. ~~~
  104. If your build fails with an error message similar to the following:
  105. ~~~
  106. File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 477, in _parse_localename
  107. raise ValueError, 'unknown locale: %s' % localename
  108. ValueError: unknown locale: UTF-8
  109. ~~~
  110. or any other locale-related Python error, make sure Python does not have any locale-related environment variables set.
  111. Usually, `unset LC_CTYPE` is sufficient to take care of the problem, but it depends on your macOS's regional and language settings and which terminal emulator you use.
  112. This is a bug in Python, see [https://bugs.python.org/issue18378#msg215215](https://bugs.python.org/issue18378#msg215215).
  113. The unit tests can be run without the engine library being installed, however `system.db` must be installed:
  114. ~~~
  115. make -C db install
  116. ~~~
  117. Since `system.db` rarely changes, its installation is not needed for every build.
  118. Tests can be compiled and executed with the following commands:
  119. ~~~
  120. make -C test compile
  121. make test
  122. ~~~