blob: ca0c0362853ee9ea0b7dc206e4c005b65ddf8d57 [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
David Lamparter5460bae2015-05-19 00:35:04 +02007basecfg="--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 --enable-werror"
David Lamparterf6295c22013-01-15 17:59:08 +01008
9configs_base="gcc|$basecfg"
10
David Lamparterf6295c22013-01-15 17:59:08 +010011configs_ext="gcc|$basecfg --enable-opaque-lsa --enable-ospf-te --enable-ospfclient --enable-isis-topology"
12configs_snmp="gcc|$basecfg --enable-opaque-lsa --enable-ospf-te --enable-ospfclient --enable-isis-topology --enable-snmp"
13configs_clang="clang|$basecfg --enable-opaque-lsa --enable-ospf-te --enable-ospfclient --enable-isis-topology"
14configs_icc="icc|$basecfg --enable-opaque-lsa --enable-ospf-te --enable-ospfclient --enable-isis-topology"
15
David Lamparter7fe17e62014-11-22 10:31:33 -080016defconfigs="base ext"
David Lamparterf6295c22013-01-15 17:59:08 +010017net-snmp-config --version &> /dev/null && defconfigs="$defconfigs snmp"
18clang --version &> /dev/null && defconfigs="$defconfigs clang"
19icc --version &> /dev/null && defconfigs="$defconfigs icc"
20
21echo "enabled configurations: $defconfigs"
22
23cc_gcc="CC=gcc; export CC"
24cc_clang="CC=clang; export CC"
25cc_icc="CC=icc; export CC"
26
27###############################
28
29errfunc() {
30 echo "something went wrong! check $TEMP"
31 exit 1
32}
33
34set -e
35trap errfunc ERR
36
37COMMITREF="$1"
38COMMITISH="`git rev-list --max-count=1 ${COMMITREF:-HEAD}`"
39TEMP="`mktemp -t -d quaggabuild.XXXXXX`"
40BASE="`pwd`"
41CONFIGS="$2"
42
43echo using temporary directory: $TEMP
44echo git commit used:
45git --no-pager log -n 1 --pretty=oneline "$COMMITISH"
46
47cd "$TEMP"
48git clone "$BASE" "source"
49cd "source"
50git checkout -b build "$COMMITISH"
51git clean -d -f -x
52sh bootstrap.sh
53
54cd ..
55
56echo -e "\n\n\n\n\033[33;1mmaking dist tarball\033[m"
57
58mkdir build_dist
59cd build_dist
60../source/configure
61make distdir=sdist dist-gzip
62cd ..
63tar zxvf build_dist/sdist.tar.gz
64
65for 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 Lamparterf281ab92013-02-26 16:21:20 +010082 make check
David Lamparterf6295c22013-01-15 17:59:08 +010083 make DESTDIR="$TEMP/inst_$cfg" install
84 cd ..
85done
86
87echo -e "\n\n\n\neverything seems ok. you may now\n\trm -rf $TEMP"