travis_linux_before_install.sh 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #!/bin/bash
  2. set -ev
  3. echo "=== Updating the build environment in $LOCAL_PKG ==="
  4. echo "=== Installing python packages ==="
  5. pip install --user cpp-coveralls
  6. pip install --user sphinx
  7. pip install --user sphinx_rtd_theme
  8. # Increase the environment version to force a rebuild of the packages
  9. # The version is writen to the cache file after every build of the dependencies
  10. ENV_VERSION="1"
  11. ENV_INSTALLED=""
  12. if [ -e $LOCAL_PKG/.build_env ]; then
  13. echo "=== No cached build environment ==="
  14. read -r ENV_INSTALLED < $LOCAL_PKG/.build_env
  15. fi
  16. # travis caches the $LOCAL_PKG dir. If it is loaded, we don't need to reinstall the packages
  17. if [ "$ENV_VERSION" = "$ENV_INSTALLED" ]; then
  18. echo "=== The build environment is current ==="
  19. # Print version numbers
  20. clang --version
  21. g++ --version
  22. cppcheck --version
  23. valgrind --version
  24. exit 0
  25. fi
  26. echo "=== The build environment is outdated ==="
  27. # Clean up
  28. rm -rf $LOCAL_PKG/*
  29. # Install newer valgrind
  30. echo "=== Installing valgrind ==="
  31. wget http://valgrind.org/downloads/valgrind-3.11.0.tar.bz2
  32. tar xf valgrind-3.11.0.tar.bz2
  33. cd valgrind-3.11.0
  34. ./configure --prefix=$LOCAL_PKG
  35. make -s -j8 install
  36. cd ..
  37. # Install specific check version which is not yet in the apt package
  38. echo "=== Installing check ==="
  39. mkdir tmp_check
  40. wget http://ftp.de.debian.org/debian/pool/main/c/check/check_0.10.0-3+b1_amd64.deb
  41. dpkg -x check_0.10.0-3+b1_amd64.deb ./tmp_check
  42. # change pkg-config file path
  43. sed -i "s|prefix=/usr|prefix=${LOCAL_PKG}|g" ./tmp_check/usr/lib/x86_64-linux-gnu/pkgconfig/check.pc
  44. sed -i 's|libdir=.*|libdir=${prefix}/lib|g' ./tmp_check/usr/lib/x86_64-linux-gnu/pkgconfig/check.pc
  45. # move files to globally included dirs
  46. cp -R ./tmp_check/usr/lib/x86_64-linux-gnu/* $LOCAL_PKG/lib/
  47. cp -R ./tmp_check/usr/include/* $LOCAL_PKG/include/
  48. cp -R ./tmp_check/usr/bin/* $LOCAL_PKG/
  49. # Install specific liburcu version which is not yet in the apt package
  50. echo "=== Installing liburcu ==="
  51. mkdir tmp_liburcu
  52. wget https://launchpad.net/ubuntu/+source/liburcu/0.8.5-1ubuntu1/+build/6513813/+files/liburcu2_0.8.5-1ubuntu1_amd64.deb
  53. wget https://launchpad.net/ubuntu/+source/liburcu/0.8.5-1ubuntu1/+build/6513813/+files/liburcu-dev_0.8.5-1ubuntu1_amd64.deb
  54. dpkg -x liburcu2_0.8.5-1ubuntu1_amd64.deb ./tmp_liburcu
  55. dpkg -x liburcu-dev_0.8.5-1ubuntu1_amd64.deb ./tmp_liburcu
  56. # move files to globally included dirs
  57. cp -R ./tmp_liburcu/usr/lib/x86_64-linux-gnu/* $LOCAL_PKG/lib/
  58. cp -R ./tmp_liburcu/usr/include/* $LOCAL_PKG/include/
  59. # Install newer cppcheck
  60. echo "=== Installing cppcheck ==="
  61. wget https://github.com/danmar/cppcheck/archive/1.73.tar.gz -O cppcheck-1.73.tar.gz
  62. tar xf cppcheck-1.73.tar.gz
  63. cd cppcheck-1.73
  64. make PREFIX="$LOCAL_PKG" SRCDIR=build CFGDIR="$LOCAL_PKG/cppcheck-cfg" HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function" -j8
  65. make PREFIX="$LOCAL_PKG" SRCDIR=build CFGDIR="$LOCAL_PKG/cppcheck-cfg" HAVE_RULES=yes install
  66. cd ..
  67. # create cached flag
  68. echo "=== Store cache flag ==="
  69. echo $ENV_VERSION > $LOCAL_PKG/.build_env
  70. # Print version numbers
  71. echo "=== Installed versions are ==="
  72. clang --version
  73. g++ --version
  74. cppcheck --version
  75. valgrind --version