build.sh 925 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/sh
  2. # This script is used by CI to build for a specific flavor. It can be used
  3. # locally: `./workspace/build.sh [linux|android] [sync]`
  4. #
  5. # For Android builds, you must set the ANDROID_NDK_PATH environment variable
  6. # to point to your Android NDK installation.
  7. flavor=${1:-linux}
  8. sync=${2}
  9. extra_flags=${3}
  10. nprocs=4
  11. if [ "$(uname)" = "Linux" ]; then
  12. nprocs=$(grep -c ^processor /proc/cpuinfo)
  13. fi
  14. : ${OPENSSL_ROOT_DIR:=/usr/local}
  15. set -e
  16. rm -rf ci.build
  17. mkdir -p ci.build
  18. cd ci.build
  19. cmake_flags=""
  20. if [ "${flavor}" = "android" ]; then
  21. [ -z $ANDROID_NDK_PATH ] && (echo "ANDROID_NDK_PATH is not set!"; exit 1)
  22. cmake_flags="-DREALM_PLATFORM=Android -DANDROID_NDK=${ANDROID_NDK_PATH}"
  23. fi
  24. if [ "${sync}" = "sync" ]; then
  25. cmake_flags="${cmake_flags} -DREALM_ENABLE_SYNC=1 -DREALM_ENABLE_SERVER=1 -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR}"
  26. fi
  27. cmake ${cmake_flags} ${extra_flags} ..
  28. make VERBOSE=1 -j${nprocs}