buildtest.sh 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #!/bin/bash
  2. # written 2012-2013 by David Lamparter, placed in Public Domain.
  3. #
  4. # builds some git commit of Quagga in some different configurations
  5. # usage: buildtest.sh [commit [configurations...]]
  6. basecfg="--prefix=/usr --enable-user=quagga --enable-group=quagga --enable-vty-group=quagga --enable-configfile-mask=0660 --enable-logfile-mask=0640 --enable-vtysh --sysconfdir=/etc/quagga --enable-exampledir=/etc/quagga/samples --localstatedir=/var/run/quagga --libdir=/usr/lib64/quagga --enable-rtadv --disable-static --enable-isisd --enable-multipath=0 --enable-pimd"
  7. configs_base="gcc|$basecfg"
  8. configs_ext="gcc|$basecfg --enable-opaque-lsa --enable-ospf-te --enable-ospfclient --enable-isis-topology"
  9. configs_snmp="gcc|$basecfg --enable-opaque-lsa --enable-ospf-te --enable-ospfclient --enable-isis-topology --enable-snmp"
  10. configs_clang="clang|$basecfg --enable-opaque-lsa --enable-ospf-te --enable-ospfclient --enable-isis-topology"
  11. configs_icc="icc|$basecfg --enable-opaque-lsa --enable-ospf-te --enable-ospfclient --enable-isis-topology"
  12. defconfigs="base ext"
  13. net-snmp-config --version &> /dev/null && defconfigs="$defconfigs snmp"
  14. clang --version &> /dev/null && defconfigs="$defconfigs clang"
  15. icc --version &> /dev/null && defconfigs="$defconfigs icc"
  16. echo "enabled configurations: $defconfigs"
  17. cc_gcc="CC=gcc; export CC"
  18. cc_clang="CC=clang; export CC"
  19. cc_icc="CC=icc; export CC"
  20. ###############################
  21. errfunc() {
  22. echo "something went wrong! check $TEMP"
  23. exit 1
  24. }
  25. set -e
  26. trap errfunc ERR
  27. COMMITREF="$1"
  28. COMMITISH="`git rev-list --max-count=1 ${COMMITREF:-HEAD}`"
  29. TEMP="`mktemp -t -d quaggabuild.XXXXXX`"
  30. BASE="`pwd`"
  31. CONFIGS="$2"
  32. echo using temporary directory: $TEMP
  33. echo git commit used:
  34. git --no-pager log -n 1 --pretty=oneline "$COMMITISH"
  35. cd "$TEMP"
  36. git clone "$BASE" "source"
  37. cd "source"
  38. git checkout -b build "$COMMITISH"
  39. git clean -d -f -x
  40. sh bootstrap.sh
  41. cd ..
  42. echo -e "\n\n\n\n\033[33;1mmaking dist tarball\033[m"
  43. mkdir build_dist
  44. cd build_dist
  45. ../source/configure
  46. make distdir=sdist dist-gzip
  47. cd ..
  48. tar zxvf build_dist/sdist.tar.gz
  49. for cfg in ${CONFIGS:-$defconfigs}; do
  50. echo -e "\n\n\n\n\033[33;1mbuilding configuration $cfg\033[m"
  51. config="\${configs_$cfg}"
  52. eval "config=$config"
  53. cc="${config%%|*}"
  54. args="${config#*|}"
  55. ccset="\${cc_$cc}"
  56. eval "ccset=$ccset"
  57. eval "$ccset"
  58. bdir="build_$cfg"
  59. mkdir "$bdir"
  60. cd "$bdir"
  61. ../sdist/configure $args
  62. make -j5
  63. make check
  64. make DESTDIR="$TEMP/inst_$cfg" install
  65. cd ..
  66. done
  67. echo -e "\n\n\n\neverything seems ok. you may now\n\trm -rf $TEMP"