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.

180 lines
4.8 KiB

2 years ago
2 years ago
  1. WIP
  2. HowToBuild static lib for macOS
  3. ## Deployment
  4. ```
  5. PER_MACHINE_DIRECTORY="/Library/Application Support/pEp"
  6. PER_USER_DIRECTORY=$HOME/.pEp
  7. ```
  8. ## Required Tools
  9. For building the engine, you need a working python3 environment and all dependencies:
  10. ```
  11. sudo port install git
  12. sudo port install gmake
  13. sudo port install autoconf
  14. sudo port install libtool
  15. sudo port install automake
  16. sudo port install wget
  17. sudo port install capnproto
  18. pushd ~
  19. git clone https://gitea.pep.foundation/fdik/yml2
  20. popd
  21. curl https://sh.rustup.rs -sSf | sh
  22. ```
  23. add this to ~/.profile (create if it doesn't exist):
  24. ```
  25. source $HOME/.cargo/env
  26. export PATH="$HOME/.cargo/bin:$PATH"
  27. ```
  28. restart your Console (!)
  29. ```
  30. sudo port install pkgconfig
  31. rustup update
  32. ```
  33. Install Xcode (if not installed already)
  34. ## Apple IDs & Certificates
  35. ### Apple ID
  36. You need to have an Apple ID (connected to pEp team account) configured in Xcode . Ask `#service`, if you want to be added to the team account.
  37. ## Build Dependencies
  38. ```
  39. mkdir src_pEpObjCAdapter_macOS
  40. cd src_pEpObjCAdapter_macOS
  41. mkdir local
  42. export MACOSX_DEPLOYMENT_TARGET=10.10
  43. git clone -b OpenSSL_1_1_1g https://github.com/openssl/openssl.git
  44. pushd "openssl"
  45. ./Configure --prefix=$(pwd)/../local/ --openssldir=$(pwd)/../local/ssl darwin64-x86_64-cc
  46. make
  47. make install
  48. popd
  49. <<<<<<< HEAD
  50. git clone https://github.com/fdik/libetpan
  51. pushd libetpan
  52. ./autogen.sh --prefix=$(pwd)/../local/
  53. make install
  54. popd
  55. =======
  56. >>>>>>> 1.1.250
  57. GMP_VERSION="6.1.2"
  58. GMP_DIR="gmp-${GMP_VERSION}"
  59. TARBALL="gmp-${GMP_VERSION}.tar.bz2"
  60. wget -nc https://gmplib.org/download/gmp/"${TARBALL}"
  61. tar xvf "${TARBALL}"
  62. pushd ${GMP_DIR}
  63. PKG_CONFIG_ALLOW_CROSS=1 PKG_CONFIG_PATH=$(pwd)/../local/lib/pkgconfig ./configure --host=${HOST} --prefix=$(pwd)/../local/
  64. make -j4
  65. make install
  66. popd
  67. rm -rf "${TARBALL}"
  68. HOST="x86_64-apple-darwin10.0.0"
  69. NETTLE_VERSION="3.4.1"
  70. NETTLE_DIR="nettle-${NETTLE_VERSION}"
  71. TARBALL=nettle-${NETTLE_VERSION}.tar.gz
  72. wget -nc https://ftp.gnu.org/gnu/nettle/nettle-${NETTLE_VERSION}.tar.gz
  73. tar xvf "${TARBALL}"
  74. pushd ${NETTLE_DIR}
  75. PKG_CONFIG_ALLOW_CROSS=1 PKG_CONFIG_PATH=$(pwd)/../local/lib/pkgconfig ./configure --host=${HOST} --prefix=$(pwd)/../local/ --with-lib-path=$(pwd)/../local/lib --with-include-path=$(pwd)/../local/include
  76. make -j4
  77. make install
  78. popd
  79. rm -rf "${TARBALL}"
  80. git clone -b "pep-engine" --depth 1 https://gitlab.com/sequoia-pgp/sequoia.git
  81. pushd sequoia
  82. make build-release PYTHON=disable
  83. make install PYTHON=disable PREFIX=$(pwd)/../local/
  84. popd
  85. git clone git://github.com/vlm/asn1c.git
  86. pushd asn1c
  87. git checkout tags/v0.9.28 -b pep-engine
  88. autoreconf -iv
  89. ./configure --prefix=$(pwd)/../local/
  90. make install
  91. popd
  92. ICONV_VERSION="1.16"
  93. ICONV_DIR="libiconv-${ICONV_VERSION}"
  94. TARBALL="libiconv-${ICONV_VERSION}.tar.gz"
  95. wget -nc https://ftp.gnu.org/pub/gnu/libiconv/${TARBALL}
  96. tar xvf "${TARBALL}"
  97. pushd ${ICONV_DIR}
  98. ./configure --prefix=$(pwd)/../local/ --enable-static
  99. make -j 4
  100. make install
  101. popd
  102. <<<<<<< HEAD
  103. # //BUFF: weget and build libz too and link it to libetpan. Rm linking dynamic lib in client afterwards.
  104. git clone https://github.com/fdik/libetpan
  105. pushd libetpan
  106. # //BUFF: This is not working (afaics). libetpan is still using the systems dynamic iconv lib. I was unable yet to force libetpan to use libiconv.a
  107. =======
  108. #TODO: weget and build libz too and link it to libetpan. Rm linking dynamic lib in client afterwards.
  109. git clone https://github.com/fdik/libetpan
  110. pushd libetpan
  111. #ToDo: This is not working (afaics). libetpan is still using the systems dynamic iconv lib. I was unable yet to force libetpan to use libiconv.a
  112. >>>>>>> 1.1.250
  113. unset CFLAGS
  114. unset LDFLAGS
  115. export LDFLAGS="-Wl/Users/buff/workspace/pEp/src_pEpObjCAdapter_macOS/local/libiconv.a"
  116. ./autogen.sh --prefix=$(pwd)/../local/ --enable-shared=no
  117. make install
  118. popd
  119. #BAD, required due to ios libetpan sub project. RM after moving out of project or even better being able to build macOS libetpan with the Xcode project
  120. rm -rf libetpan
  121. git clone https://pep-security.lu/gitlab/misc/libetpan.git
  122. git clone https://pep-security.lu/gitlab/misc/sqlite.git
  123. git clone https://gitea.pep.foundation/pEp.foundation/pEpEngine
  124. git clone https://gitea.pep.foundation/pep.foundation/pEpObjCAdapter.git
  125. ```
  126. ## Build
  127. =======
  128. ### iOS Only: Copy System DB
  129. The `system.db` from the pEpEngine repository must be copied in the bundle that uses the pEpObjCAdapter.a static lib. The ObjCAdapter copies it at runtime in the desired directory.
  130. Backround: Has been introduces to use Apple Shared App Directory of the client App.
  131. ### Using Xcode UI
  132. `open pEpMacOSAdapter/pEpObjCAdapter.xcworkspace/`
  133. Build scheme "All" of pEpObjCAdapter.xcworkspace
  134. ### Using terminal
  135. `xcodebuild -workspace "pEpObjCAdapter.xcworkspace" -scheme "PEPObjCAdapter_macOS" -configuration RELEASE`
  136. (or DEBUG)
  137. ### Build Dir & Build Artefacts
  138. You can find the build artefacts in the `pEpMacOSAdapter/build` folder