travis_linux_before_install.sh 1.9 KB

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