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.

73 lines
2.4 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 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. LIBETPAN_DIR="${PARENT_DIR}/libetpan"
  42. if [ ! -d "${LIBETPAN_DIR}" ]; then
  43. # git clone -b "master" https://gitea.pep.foundation/pep.foundation/libetpan.git
  44. git clone -b "IOSAD-218" https://gitea.pep.foundation/buff/libetpan.git
  45. # build with Engine Xcode project
  46. fi
  47. XCODE_PROJECT_DIR="${PEP_ENGINE_DIR}/build-mac"
  48. pushd ${XCODE_PROJECT_DIR}
  49. xcodebuild -project "pEpEngine.xcodeproj" -scheme "pEpEngine_macOS" -configuration ${CONFIG}
  50. popd
  51. # Copy Artefacts
  52. cp "${XCODE_PROJECT_DIR}/build/libpEpEngine.a" "${PREFIX}/lib/libpEpEngine.a"
  53. cp "${XCODE_PROJECT_DIR}/Subprojects/pEpASN1/build/libpEpASN1_macOS.a" "${PREFIX}/lib/libasn1.a"
  54. cp "${XCODE_PROJECT_DIR}/Subprojects/PEPSQLITE3/build/libPEPSQLITE3_macOS.a" "${PREFIX}/lib/libsqlite3.a"
  55. cp "${PARENT_DIR}/libetpan/build-mac/build/libetpan.a" "${PREFIX}/lib"
  56. # Copy Headers
  57. cp -r "${XCODE_PROJECT_DIR}/build/include"/* "${PREFIX}/include"
  58. cp -r "${XCODE_PROJECT_DIR}/Subprojects/pEpASN1/build/include"/* "${PREFIX}/include"
  59. cp -r "${XCODE_PROJECT_DIR}/Subprojects/PEPSQLITE3/build/include"/* "${PREFIX}/include"
  60. popd
  61. # Cleanup
  62. export MACOSX_DEPLOYMENT_TARGET=10.10