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.

78 lines
2.6 KiB

6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
  1. # Builds fat lib for macOS (ARM64 & x86_64).
  2. # Pass PREFIX as argument. If not passed, "local/" is used as deafult. Config can also be passed.
  3. # Sample:
  4. # `sh build-pEpEngine-macOS.sh $MyPREFIX [RELEASE|DEBUG]
  5. # Exit on errors
  6. set -e
  7. SCRIPT_DIR=$(dirname "$0")
  8. PREFIX=$1
  9. CONFIG=$2
  10. if [ "${CONFIG}" = "" ]; then
  11. CONFIG="RELEASE"
  12. fi
  13. VERSION=$(sh "${SCRIPT_DIR}/get-pEp-version.sh" "PEP_ENGINE_VERSION")
  14. # Get Absolute Paths & Setup
  15. pushd "${SCRIPT_DIR}"
  16. SCRIPT_DIR=$(pwd)
  17. popd
  18. if [ "${PREFIX}" = "" ]; then
  19. PREFIX="${SCRIPT_DIR}/local"
  20. fi
  21. mkdir -p "${PREFIX}"
  22. pushd "${PREFIX}"
  23. PREFIX=$(pwd)
  24. popd
  25. PARENT_DIR="${SCRIPT_DIR}/.."
  26. if [ -f "${PREFIX}/lib/libpEpEngine.a" ]; then
  27. echo "lib exists already in ${PREFIX}/lib. If you want to rebuild it, delete the existing one."
  28. exit 0
  29. fi
  30. # libpEpEngine
  31. pushd "${PARENT_DIR}"
  32. PEP_ENGINE_DIR="${PARENT_DIR}/pEpEngine"
  33. if [ ! -d "${PEP_ENGINE_DIR}" ]; then
  34. git clone -b "${VERSION}" https://gitea.pep.foundation/buff/pEpEngine
  35. fi
  36. SQLITE3_DIR="${PARENT_DIR}/sqlite"
  37. if [ ! -d "${SQLITE3_DIR}" ]; then
  38. git clone -b "master" https://pep-security.lu/gitlab/misc/sqlite.git
  39. # build with Engine Xcode project
  40. fi
  41. PEP_TRANSPORT_DIR="${PARENT_DIR}/libpEpTransport"
  42. if [ ! -d "${PEP_TRANSPORT_DIR}" ]; then
  43. git clone -b "master" https://gitea.pep.foundation/pEp.foundation/libpEpTransport.git
  44. # build with Engine Xcode project
  45. fi
  46. LIBETPAN_DIR="${PARENT_DIR}/libetpan"
  47. if [ ! -d "${LIBETPAN_DIR}" ]; then
  48. # git clone -b "master" https://gitea.pep.foundation/pep.foundation/libetpan.git
  49. git clone -b "master" https://gitea.pep.foundation/buff/libetpan.git
  50. # build with Engine Xcode project
  51. fi
  52. XCODE_PROJECT_DIR="${PEP_ENGINE_DIR}/build-mac"
  53. pushd ${XCODE_PROJECT_DIR}
  54. xcodebuild -project "pEpEngine.xcodeproj" -scheme "pEpEngine_macOS" -configuration ${CONFIG}
  55. popd
  56. # Copy Artefacts
  57. cp "${XCODE_PROJECT_DIR}/build/libpEpEngine.a" "${PREFIX}/lib/libpEpEngine.a"
  58. cp "${XCODE_PROJECT_DIR}/Subprojects/pEpASN1/build/libpEpASN1_macOS.a" "${PREFIX}/lib/libasn1.a"
  59. cp "${XCODE_PROJECT_DIR}/Subprojects/PEPSQLITE3/build/libPEPSQLITE3_macOS.a" "${PREFIX}/lib/libsqlite3.a"
  60. cp "${PARENT_DIR}/libetpan/build-mac/build/libetpan.a" "${PREFIX}/lib"
  61. # Copy Headers
  62. cp -r "${XCODE_PROJECT_DIR}/build/include"/* "${PREFIX}/include"
  63. cp -r "${XCODE_PROJECT_DIR}/Subprojects/pEpASN1/build/include"/* "${PREFIX}/include"
  64. cp -r "${XCODE_PROJECT_DIR}/Subprojects/PEPSQLITE3/build/include"/* "${PREFIX}/include"
  65. popd
  66. # Cleanup
  67. export MACOSX_DEPLOYMENT_TARGET=10.10