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