build-linux-travis.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/sh
  2. #
  3. # Automate the build process on Linux based on
  4. # http://supertuxkart.sourceforge.net/Build_STK_on_Linux
  5. # CMake build type
  6. BUILDTYPE=Debug
  7. # Number of threads to use during compilation (make -j)
  8. THREADS=`lscpu -p | grep -v '^#' | wc -l`
  9. # Relative path to the root directory of this Git repository
  10. REPOROOT=..
  11. export LANG=C
  12. if [ "$CI" = 'true' -a "$TRAVIS" = 'true' ]
  13. then
  14. THREADS=4
  15. fi
  16. CURRENTDIR=`pwd`
  17. SCRIPTDIR=`dirname "$0"`
  18. cd "$SCRIPTDIR"
  19. cd "$REPOROOT"
  20. rm -rf cmake_build
  21. # One might want to do that to REALLY clean up
  22. #git reset --hard
  23. #git checkout master
  24. #git pull
  25. REVISION=`git rev-parse HEAD`
  26. # If you had Git submodules:
  27. #git submodule foreach git reset --hard
  28. #git submodule foreach git checkout master
  29. #git submodule foreach git pull
  30. mkdir cmake_build
  31. cd cmake_build
  32. cmake .. -DCMAKE_BUILD_TYPE=$BUILDTYPE 2>&1
  33. EXITCODE=$?
  34. if [ $EXITCODE -ne 0 ]
  35. then
  36. echo
  37. echo 'ERROR: CMAKE failed with exit code '"$EXITCODE"
  38. echo 'Git revision: '"$REVISION"
  39. cd "$CURRENTDIR"
  40. exit $EXITCODE
  41. fi
  42. make VERBOSE=1 -j $THREADS 2>&1
  43. EXITCODE=$?
  44. if [ $EXITCODE -ne 0 ]
  45. then
  46. echo
  47. echo 'ERROR: MAKE failed with exit code '"$EXITCODE"
  48. echo 'Git revision: '"$REVISION"
  49. cd "$CURRENTDIR"
  50. exit $EXITCODE
  51. fi
  52. cd "$SCRIPTDIR"
  53. echo
  54. echo 'SUCCESS: Build succeeded.'
  55. echo 'Git revision: '"$REVISION"
  56. echo
  57. #git status
  58. #git submodule foreach git status
  59. #git submodule foreach git rev-parse HEAD
  60. #ls -l cmake_build/bin/supertuxkart
  61. cd "$CURRENTDIR"