build_travis.sh 916 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. #
  3. # build script for travis CI
  4. # environment based docker container at
  5. # https://hub.docker.com/r/kamailio/pkg-kamailio-docker/
  6. #
  7. set -e
  8. DIST=${DIST:-bullseye}
  9. CC=${CC:-gcc}
  10. if ! [ -d /code/pkg/kamailio/deb/"${DIST}" ] ; then
  11. echo "${DIST} not supported"
  12. exit 1
  13. else
  14. rm -rf /code/debian
  15. ln -s /code/pkg/kamailio/deb/"${DIST}" /code/debian
  16. fi
  17. function _clean {
  18. echo "make clean"
  19. make -f debian/rules clean
  20. }
  21. function _build {
  22. echo "make build"
  23. make -f debian/rules build
  24. }
  25. function _install {
  26. if [[ "$CC" =~ gcc ]] ; then
  27. echo "make install"
  28. make install
  29. else
  30. echo "skip make install step"
  31. fi
  32. }
  33. if [[ "${CC}" =~ clang ]] ; then
  34. CLANG=$(find /usr/bin -type l -name 'clang-[0-9]*' | sort -r | head -1)
  35. echo "setting clang to ${CLANG}"
  36. update-alternatives --install /usr/bin/clang clang "${CLANG}" 1
  37. fi
  38. echo "environment DIST=$DIST CC=$CC"
  39. ${CC} --version
  40. _clean
  41. _build
  42. _install