script.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 with 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. cmake -DCMAKE_BUILD_TYPE=Debug \
  19. -DRUN_IN_PLACE=TRUE \
  20. -DENABLE_GETTEXT=TRUE \
  21. -DBUILD_SERVER=TRUE \
  22. ${CMAKE_FLAGS} ..
  23. make -j2
  24. echo "Running unit tests."
  25. CMD="../bin/minetest --run-unittests"
  26. if [[ "${VALGRIND}" == "1" ]]; then
  27. valgrind --leak-check=full --leak-check-heuristics=all --undef-value-errors=no --error-exitcode=9 ${CMD} && exit 0
  28. else
  29. ${CMD} && exit 0
  30. fi
  31. elif [[ $PLATFORM == Win* ]]; then
  32. [[ $CC == "clang" ]] && exit 1 # Not supposed to happen
  33. # We need to have our build directory outside of the minetest directory because
  34. # CMake will otherwise get very very confused with symlinks and complain that
  35. # something is not a subdirectory of something even if it actually is.
  36. # e.g.:
  37. # /home/travis/minetest/minetest/travisbuild/minetest
  38. # \/ \/ \/
  39. # /home/travis/minetest/minetest/travisbuild/minetest/travisbuild/minetest
  40. # \/ \/ \/
  41. # /home/travis/minetest/minetest/travisbuild/minetest/travisbuild/minetest/travisbuild/minetest
  42. # You get the idea.
  43. OLDDIR=$(pwd)
  44. cd ..
  45. export EXISTING_MINETEST_DIR=$OLDDIR
  46. export NO_MINETEST_GAME=1
  47. if [[ $PLATFORM == "Win32" ]]; then
  48. "$OLDDIR/util/buildbot/buildwin32.sh" travisbuild && exit 0
  49. elif [[ $PLATFORM == "Win64" ]]; then
  50. "$OLDDIR/util/buildbot/buildwin64.sh" travisbuild && exit 0
  51. fi
  52. else
  53. echo "Unknown platform \"${PLATFORM}\"."
  54. exit 1
  55. fi