script.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/bash -e
  2. . util/travis/common.sh
  3. . util/travis/lint.sh
  4. needs_compile || exit 0
  5. if [[ "$LINT" == "1" ]]; then
  6. # Lint and exit CI
  7. perform_lint
  8. exit 0
  9. fi
  10. set_linux_compiler_env
  11. if [[ ${PLATFORM} == "Unix" ]]; then
  12. mkdir -p travisbuild
  13. cd travisbuild || exit 1
  14. CMAKE_FLAGS=''
  15. if [[ ${TRAVIS_OS_NAME} == "osx" ]]; then
  16. CMAKE_FLAGS+=' -DCUSTOM_GETTEXT_PATH=/usr/local/opt/gettext'
  17. fi
  18. if [[ -n "${FREETYPE}" ]] && [[ "${FREETYPE}" == "0" ]]; then
  19. CMAKE_FLAGS+=' -DENABLE_FREETYPE=0'
  20. fi
  21. cmake -DCMAKE_BUILD_TYPE=Debug \
  22. -DRUN_IN_PLACE=TRUE \
  23. -DENABLE_GETTEXT=TRUE \
  24. -DBUILD_SERVER=TRUE \
  25. ${CMAKE_FLAGS} ..
  26. make -j2
  27. echo "Running unit tests."
  28. CMD="../bin/minetest --run-unittests"
  29. if [[ "${VALGRIND}" == "1" ]]; then
  30. valgrind --leak-check=full --leak-check-heuristics=all --undef-value-errors=no --error-exitcode=9 ${CMD} && exit 0
  31. else
  32. ${CMD} && exit 0
  33. fi
  34. elif [[ $PLATFORM == Win* ]]; then
  35. [[ $CC == "clang" ]] && exit 1 # Not supposed to happen
  36. # We need to have our build directory outside of the minetest directory because
  37. # CMake will otherwise get very very confused with symlinks and complain that
  38. # something is not a subdirectory of something even if it actually is.
  39. # e.g.:
  40. # /home/travis/minetest/minetest/travisbuild/minetest
  41. # \/ \/ \/
  42. # /home/travis/minetest/minetest/travisbuild/minetest/travisbuild/minetest
  43. # \/ \/ \/
  44. # /home/travis/minetest/minetest/travisbuild/minetest/travisbuild/minetest/travisbuild/minetest
  45. # You get the idea.
  46. OLDDIR=$(pwd)
  47. cd ..
  48. export EXISTING_MINETEST_DIR=$OLDDIR
  49. export NO_MINETEST_GAME=1
  50. if [[ $PLATFORM == "Win32" ]]; then
  51. "$OLDDIR/util/buildbot/buildwin32.sh" travisbuild && exit 0
  52. elif [[ $PLATFORM == "Win64" ]]; then
  53. "$OLDDIR/util/buildbot/buildwin64.sh" travisbuild && exit 0
  54. fi
  55. else
  56. echo "Unknown platform \"${PLATFORM}\"."
  57. exit 1
  58. fi