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
4.3 KiB

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 mercurial
  13. sudo port install gmake
  14. sudo port install autoconf
  15. sudo port install libtool
  16. sudo port install automake
  17. sudo port install wget
  18. sudo port install capnproto
  19. pushd ~
  20. hg clone https://pep.foundation/dev/repos/yml2/
  21. popd
  22. curl https://sh.rustup.rs -sSf | sh
  23. ```
  24. add this to ~/.profile (create if it doesn't exist):
  25. ```
  26. source $HOME/.cargo/env
  27. export PATH="$HOME/.cargo/bin:$PATH"
  28. ```
  29. restart your Console (!)
  30. ```
  31. sudo port install pkgconfig
  32. rustup update
  33. ```
  34. Install Xcode (if not installed already)
  35. ## Apple IDs & Certificates
  36. ### Apple ID
  37. 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.
  38. ## Build Dependencies
  39. ```
  40. mkdir src_pEpObjCAdapter_macOS
  41. cd src_pEpObjCAdapter_macOS
  42. mkdir local
  43. export MACOSX_DEPLOYMENT_TARGET=10.10
  44. git clone -b OpenSSL_1_1_1g https://github.com/openssl/openssl.git
  45. pushd "openssl"
  46. ./Configure --prefix=$(pwd)/../local/ --openssldir=$(pwd)/../local/ssl darwin64-x86_64-cc
  47. make
  48. make install
  49. popd
  50. GMP_VERSION="6.1.2"
  51. GMP_DIR="gmp-${GMP_VERSION}"
  52. TARBALL="gmp-${GMP_VERSION}.tar.bz2"
  53. wget -nc https://gmplib.org/download/gmp/"${TARBALL}"
  54. tar xvf "${TARBALL}"
  55. pushd ${GMP_DIR}
  56. PKG_CONFIG_ALLOW_CROSS=1 PKG_CONFIG_PATH=$(pwd)/../local/lib/pkgconfig ./configure --host=${HOST} --prefix=$(pwd)/../local/
  57. make -j4
  58. make install
  59. popd
  60. rm -rf "${TARBALL}"
  61. HOST="x86_64-apple-darwin10.0.0"
  62. NETTLE_VERSION="3.4.1"
  63. NETTLE_DIR="nettle-${NETTLE_VERSION}"
  64. TARBALL=nettle-${NETTLE_VERSION}.tar.gz
  65. wget -nc https://ftp.gnu.org/gnu/nettle/nettle-${NETTLE_VERSION}.tar.gz
  66. tar xvf "${TARBALL}"
  67. pushd ${NETTLE_DIR}
  68. 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
  69. make -j4
  70. make install
  71. popd
  72. rm -rf "${TARBALL}"
  73. git clone -b "pep-engine" --depth 1 https://gitlab.com/sequoia-pgp/sequoia.git
  74. pushd sequoia
  75. make build-release PYTHON=disable
  76. make install PYTHON=disable PREFIX=$(pwd)/../local/
  77. popd
  78. git clone git://github.com/vlm/asn1c.git
  79. pushd asn1c
  80. git checkout tags/v0.9.28 -b pep-engine
  81. autoreconf -iv
  82. ./configure --prefix=$(pwd)/../local/
  83. make install
  84. popd
  85. ICONV_VERSION="1.16"
  86. ICONV_DIR="libiconv-${ICONV_VERSION}"
  87. TARBALL="libiconv-${ICONV_VERSION}.tar.gz"
  88. wget -nc https://ftp.gnu.org/pub/gnu/libiconv/${TARBALL}
  89. tar xvf "${TARBALL}"
  90. pushd ${ICONV_DIR}
  91. ./configure --prefix=$(pwd)/../local/ --enable-static
  92. make -j 4
  93. make install
  94. popd
  95. #TODO: weget and build libz too and link it to libetpan. Rm linking dynamic lib in client afterwards.
  96. git clone https://github.com/fdik/libetpan
  97. pushd libetpan
  98. #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
  99. unset CFLAGS
  100. unset LDFLAGS
  101. export LDFLAGS="-Wl/Users/buff/workspace/pEp/src_pEpObjCAdapter_macOS/local/libiconv.a"
  102. ./autogen.sh --prefix=$(pwd)/../local/ --enable-shared=no
  103. make install
  104. popd
  105. #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
  106. rm -rf libetpan
  107. git clone https://pep-security.lu/gitlab/misc/libetpan.git
  108. git clone https://pep-security.lu/gitlab/misc/sqlite.git
  109. git clone https://gitea.pep.foundation/pEp.foundation/pEpEngine
  110. hg clone https://pep.foundation/dev/repos/pEpObjCAdapter
  111. ```
  112. ## Build
  113. ### iOS Only: Copy System DB
  114. 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.
  115. Backround: Has been introduces to use Apple Shared App Directory of the client App.
  116. ### Using Xcode UI
  117. `open pEpMacOSAdapter/pEpObjCAdapter.xcworkspace/`
  118. Build scheme "All" of pEpObjCAdapter.xcworkspace
  119. ### Using terminal
  120. `xcodebuild -workspace "pEpObjCAdapter.xcworkspace" -scheme "PEPObjCAdapter_macOS" -configuration RELEASE`
  121. (or DEBUG)
  122. ### Build Dir & Build Artefacts
  123. You can find the build artefacts in the `pEpMacOSAdapter/build` folder