buildtest.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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-ipv6 --enable-ripngd --enable-ospf6d --enable-rtadv --disable-static --enable-isisd --enable-multipath=0 --enable-babeld --enable-pimd"
  7. configs_base="gcc|$basecfg"
  8. configs_nov6="gcc|$basecfg"
  9. configs_nov6="${configs_nov6/enable-ipv6/disable-ipv6}"
  10. configs_nov6="${configs_nov6/enable-ospf6d/disable-ospf6d}"
  11. configs_nov6="${configs_nov6/enable-ripngd/disable-ripngd}"
  12. configs_nov6="${configs_nov6/enable-babeld/disable-babeld}"
  13. configs_ext="gcc|$basecfg --enable-opaque-lsa --enable-ospf-te --enable-ospfclient --enable-isis-topology"
  14. configs_snmp="gcc|$basecfg --enable-opaque-lsa --enable-ospf-te --enable-ospfclient --enable-isis-topology --enable-snmp"
  15. configs_clang="clang|$basecfg --enable-opaque-lsa --enable-ospf-te --enable-ospfclient --enable-isis-topology"
  16. configs_icc="icc|$basecfg --enable-opaque-lsa --enable-ospf-te --enable-ospfclient --enable-isis-topology"
  17. defconfigs="base nov6 ext"
  18. net-snmp-config --version &> /dev/null && defconfigs="$defconfigs snmp"
  19. clang --version &> /dev/null && defconfigs="$defconfigs clang"
  20. icc --version &> /dev/null && defconfigs="$defconfigs icc"
  21. echo "enabled configurations: $defconfigs"
  22. cc_gcc="CC=gcc; export CC"
  23. cc_clang="CC=clang; export CC"
  24. cc_icc="CC=icc; export CC"
  25. ###############################
  26. errfunc() {
  27. echo "something went wrong! check $TEMP"
  28. exit 1
  29. }
  30. set -e
  31. trap errfunc ERR
  32. COMMITREF="$1"
  33. COMMITISH="`git rev-list --max-count=1 ${COMMITREF:-HEAD}`"
  34. TEMP="`mktemp -t -d quaggabuild.XXXXXX`"
  35. BASE="`pwd`"
  36. CONFIGS="$2"
  37. echo using temporary directory: $TEMP
  38. echo git commit used:
  39. git --no-pager log -n 1 --pretty=oneline "$COMMITISH"
  40. cd "$TEMP"
  41. git clone "$BASE" "source"
  42. cd "source"
  43. git checkout -b build "$COMMITISH"
  44. git clean -d -f -x
  45. sh bootstrap.sh
  46. cd ..
  47. echo -e "\n\n\n\n\033[33;1mmaking dist tarball\033[m"
  48. mkdir build_dist
  49. cd build_dist
  50. ../source/configure
  51. make distdir=sdist dist-gzip
  52. cd ..
  53. tar zxvf build_dist/sdist.tar.gz
  54. for cfg in ${CONFIGS:-$defconfigs}; do
  55. echo -e "\n\n\n\n\033[33;1mbuilding configuration $cfg\033[m"
  56. config="\${configs_$cfg}"
  57. eval "config=$config"
  58. cc="${config%%|*}"
  59. args="${config#*|}"
  60. ccset="\${cc_$cc}"
  61. eval "ccset=$ccset"
  62. eval "$ccset"
  63. bdir="build_$cfg"
  64. mkdir "$bdir"
  65. cd "$bdir"
  66. ../sdist/configure $args
  67. make -j5
  68. make check
  69. make DESTDIR="$TEMP/inst_$cfg" install
  70. cd ..
  71. done
  72. echo -e "\n\n\n\neverything seems ok. you may now\n\trm -rf $TEMP"