common.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/bash -e
  2. set_linux_compiler_env() {
  3. if [[ "${COMPILER}" == "gcc-5.1" ]]; then
  4. export CC=gcc-5.1
  5. export CXX=g++-5.1
  6. elif [[ "${COMPILER}" == "gcc-6" ]]; then
  7. export CC=gcc-6
  8. export CXX=g++-6
  9. elif [[ "${COMPILER}" == "gcc-7" ]]; then
  10. export CC=gcc-7
  11. export CXX=g++-7
  12. elif [[ "${COMPILER}" == "clang-3.6" ]]; then
  13. export CC=clang-3.6
  14. export CXX=clang++-3.6
  15. elif [[ "${COMPILER}" == "clang-5.0" ]]; then
  16. export CC=clang-5.0
  17. export CXX=clang++-5.0
  18. fi
  19. }
  20. # Linux build only
  21. install_linux_deps() {
  22. sudo apt-get update
  23. sudo apt-get install libirrlicht-dev cmake libbz2-dev libpng12-dev \
  24. libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev \
  25. libhiredis-dev libogg-dev libgmp-dev libvorbis-dev libopenal-dev \
  26. gettext libpq-dev libleveldb-dev
  27. }
  28. # Mac OSX build only
  29. install_macosx_deps() {
  30. brew update
  31. brew install freetype gettext hiredis irrlicht leveldb libogg libvorbis luajit
  32. if brew ls | grep -q jpeg; then
  33. brew upgrade jpeg
  34. else
  35. brew install jpeg
  36. fi
  37. #brew upgrade postgresql
  38. }
  39. # Relative to git-repository root:
  40. TRIGGER_COMPILE_PATHS="src/.*\.(c|cpp|h)|CMakeLists.txt|cmake/Modules/|util/travis/|util/buildbot/"
  41. needs_compile() {
  42. RANGE="$TRAVIS_COMMIT_RANGE"
  43. if [[ "$(git diff --name-only $RANGE -- 2>/dev/null)" == "" ]]; then
  44. RANGE="$TRAVIS_COMMIT^...$TRAVIS_COMMIT"
  45. echo "Fixed range: $RANGE"
  46. fi
  47. git diff --name-only $RANGE -- | egrep -q "^($TRIGGER_COMPILE_PATHS)"
  48. }