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