travis_linux_before_install.sh 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/bash
  2. set -ev
  3. if [ -z ${LOCAL_PKG+x} ] || [ -z "$LOCAL_PKG" ]; then
  4. echo "LOCAL_PKG is not set. Aborting..."
  5. exit 1
  6. fi
  7. if ! [ -z ${CLANG_FORMAT+x} ]; then
  8. echo "CLANG_FORMAT does not need any dependencies. Done."
  9. exit 0
  10. fi
  11. if [ -z ${DOCKER+x} ] && [ -z ${SONAR+x} ]; then
  12. # Only on non-docker builds required
  13. echo "=== Installing from external package sources in $LOCAL_PKG ===" && echo -en 'travis_fold:start:before_install.external\\r'
  14. # Increase the environment version to force a rebuild of the packages
  15. # The version is writen to the cache file after every build of the dependencies
  16. ENV_VERSION="1"
  17. ENV_INSTALLED=""
  18. if [ -e $LOCAL_PKG/.build_env ]; then
  19. echo "=== No cached build environment ==="
  20. read -r ENV_INSTALLED < $LOCAL_PKG/.build_env
  21. fi
  22. # travis caches the $LOCAL_PKG dir. If it is loaded, we don't need to reinstall the packages
  23. if [ "$ENV_VERSION" = "$ENV_INSTALLED" ]; then
  24. echo "=== The build environment is current ==="
  25. exit 0
  26. fi
  27. echo "=== The build environment is outdated ==="
  28. # Clean up
  29. # additional safety measure to avoid rm -rf on root
  30. # only execute it on travis
  31. if ! [ -z ${TRAVIS+x} ]; then
  32. echo "rm -rf $LOCAL_PKG/*"
  33. fi
  34. if [ "$CC" = "tcc" ]; then
  35. mkdir tcc_install && cd tcc_install
  36. wget https://download.savannah.gnu.org/releases/tinycc/tcc-0.9.27.tar.bz2
  37. tar xf tcc-0.9.27.tar.bz2
  38. cd tcc-0.9.27
  39. ./configure --prefix=$LOCAL_PKG
  40. make
  41. make install
  42. cd ../..
  43. rm -rf tcc_install
  44. fi
  45. wget https://github.com/ARMmbed/mbedtls/archive/mbedtls-2.7.1.tar.gz
  46. tar xf mbedtls-2.7.1.tar.gz
  47. cd mbedtls-mbedtls-2.7.1
  48. cmake -DENABLE_TESTING=Off -DCMAKE_INSTALL_PREFIX=$LOCAL_PKG .
  49. make -j
  50. make install
  51. echo -en 'travis_fold:end:script.before_install.external\\r'
  52. echo "=== Installing python packages ===" && echo -en 'travis_fold:start:before_install.python\\r'
  53. pip install --user cpp-coveralls
  54. pip install --user sphinx_rtd_theme
  55. pip install --user cpplint
  56. echo -en 'travis_fold:end:script.before_install.python\\r'
  57. fi