travis_linux_script.sh 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/bash
  2. set -ev
  3. echo "Checking the applicability of patches"
  4. # ./tools/.checkPorts.sh
  5. echo "Documentation and certificate build"
  6. mkdir -p build
  7. cd build
  8. cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DOCUMENTATION=ON -DGENERATE_SELFSIGNED=ON ..
  9. make doc
  10. make selfsigned
  11. cp -r doc ..
  12. cp server_cert.der ..
  13. echo "Testing builds"
  14. cd .. && rm build -rf && mkdir -p build && cd build
  15. echo "Cross compile release build for MinGW 32 bit"
  16. cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw32.cmake -DENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLESERVER=ON -DBUILD_EXAMPLECLIENT=ON ..
  17. make
  18. cp ../README.md .
  19. cp ../LICENSE .
  20. cp ../AUTHORS .
  21. cp -r ../doc .
  22. cp ../server_cert.der .
  23. zip -r open62541-win32.zip doc server_cert.der LICENSE AUTHORS README.md server_static.exe server.exe client.exe client_static.exe libopen62541.dll libopen62541.dll.a open62541.h open62541.c
  24. cp open62541-win32.zip ..
  25. cd .. && rm build -rf && mkdir -p build && cd build
  26. echo "Cross compile release build for MinGW 64 bit"
  27. cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw64.cmake -DENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLESERVER=ON -DBUILD_EXAMPLECLIENT=ON ..
  28. make
  29. cp ../README.md .
  30. cp ../LICENSE .
  31. cp ../AUTHORS .
  32. cp -r ../doc .
  33. cp ../server_cert.der .
  34. zip -r open62541-win64.zip doc server_cert.der LICENSE AUTHORS README.md server_static.exe server.exe client.exe client_static.exe libopen62541.dll libopen62541.dll.a open62541.h open62541.c
  35. cp open62541-win64.zip ..
  36. cd .. && rm build -rf && mkdir -p build && cd build
  37. echo "Cross compile release build for 32-bit linux"
  38. cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-gcc-m32.cmake -DENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLESERVER=ON -DBUILD_EXAMPLECLIENT=ON ..
  39. make
  40. tar -pczf open62541-linux32.tar.gz ../doc ../server_cert.der ../LICENSE ../AUTHORS ../README.md server_static server client_static client libopen62541.so open62541.h open62541.c
  41. cp open62541-linux32.tar.gz ..
  42. cd .. && rm build -rf && mkdir -p build && cd build
  43. echo "Compile release build for 64-bit linux"
  44. cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_AMALGAMATION=ON -DBUILD_EXAMPLESERVER=ON -DBUILD_EXAMPLECLIENT=ON ..
  45. make
  46. tar -pczf open62541-linux64.tar.gz ../doc ../server_cert.der ../LICENSE ../AUTHORS ../README.md server_static server client_static client libopen62541.so open62541.h open62541.c
  47. cp open62541-linux64.tar.gz ..
  48. cp open62541.h .. #copy single file-release
  49. cp open62541.c .. #copy single file-release
  50. echo "Upgrade to gcc 4.8"
  51. sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
  52. sudo apt-get update -qq
  53. sudo apt-get install -qq gcc-4.8 g++-4.8 valgrind
  54. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20
  55. sudo update-alternatives --config gcc
  56. echo "Building the C++ example"
  57. gcc -std=c99 -c open62541.c
  58. g++-4.8 ../examples/server.cpp -I./ open62541.o -o cpp-server
  59. cd .. && rm build -rf && mkdir -p build && cd build
  60. echo "Compile multithreaded version"
  61. cmake -DENABLE_MULTITHREADING=ON -DBUILD_EXAMPLESERVER=ON ..
  62. make
  63. cd .. && rm build -rf && mkdir -p build && cd build
  64. echo "Debug build and unit tests (64 bit)"
  65. cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_DEMO_NODESET=ON -DBUILD_UNIT_TESTS=ON -DBUILD_EXAMPLESERVER=ON -DENABLE_COVERAGE=ON ..
  66. make && make test
  67. echo "Run valgrind to see if the server leaks memory (just starting up and closing..)"
  68. if [[ ! ( ${TRAVIS_OS_NAME} == "linux" && ${CC} == "clang") ]]; then
  69. (valgrind --error-exitcode=3 ./server & export pid=$!; sleep 2; kill -INT $pid; wait $pid);
  70. (coveralls --gcov /usr/bin/gcov-4.8 -E '.*\.h' -E '.*CMakeCXXCompilerId\.cpp' -E '.*CMakeCCompilerId\.c' -r ../ ; exit 0);
  71. fi
  72. cd ..