forked from opensourcerouting/quagga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildtest.sh
executable file
·87 lines (67 loc) · 2.5 KB
/
buildtest.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
# written 2012-2013 by David Lamparter, placed in Public Domain.
#
# builds some git commit of Quagga in some different configurations
# usage: buildtest.sh [commit [configurations...]]
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 --enable-werror"
configs_base="gcc|$basecfg"
configs_ext="gcc|$basecfg --enable-opaque-lsa --enable-ospf-te --enable-ospfclient --enable-isis-topology"
configs_snmp="gcc|$basecfg --enable-opaque-lsa --enable-ospf-te --enable-ospfclient --enable-isis-topology --enable-snmp"
configs_clang="clang|$basecfg --enable-opaque-lsa --enable-ospf-te --enable-ospfclient --enable-isis-topology"
configs_icc="icc|$basecfg --enable-opaque-lsa --enable-ospf-te --enable-ospfclient --enable-isis-topology"
defconfigs="base ext"
net-snmp-config --version &> /dev/null && defconfigs="$defconfigs snmp"
clang --version &> /dev/null && defconfigs="$defconfigs clang"
icc --version &> /dev/null && defconfigs="$defconfigs icc"
echo "enabled configurations: $defconfigs"
cc_gcc="CC=gcc; export CC"
cc_clang="CC=clang; export CC"
cc_icc="CC=icc; export CC"
###############################
errfunc() {
echo "something went wrong! check $TEMP"
exit 1
}
set -e
trap errfunc ERR
COMMITREF="$1"
COMMITISH="`git rev-list --max-count=1 ${COMMITREF:-HEAD}`"
TEMP="`mktemp -t -d quaggabuild.XXXXXX`"
BASE="`pwd`"
CONFIGS="$2"
echo using temporary directory: $TEMP
echo git commit used:
git --no-pager log -n 1 --pretty=oneline "$COMMITISH"
cd "$TEMP"
git clone "$BASE" "source"
cd "source"
git checkout -b build "$COMMITISH"
git clean -d -f -x
sh bootstrap.sh
cd ..
echo -e "\n\n\n\n\033[33;1mmaking dist tarball\033[m"
mkdir build_dist
cd build_dist
../source/configure
make distdir=sdist dist-gzip
cd ..
tar zxvf build_dist/sdist.tar.gz
for cfg in ${CONFIGS:-$defconfigs}; do
echo -e "\n\n\n\n\033[33;1mbuilding configuration $cfg\033[m"
config="\${configs_$cfg}"
eval "config=$config"
cc="${config%%|*}"
args="${config#*|}"
ccset="\${cc_$cc}"
eval "ccset=$ccset"
eval "$ccset"
bdir="build_$cfg"
mkdir "$bdir"
cd "$bdir"
../sdist/configure $args
make -j5
make check
make DESTDIR="$TEMP/inst_$cfg" install
cd ..
done
echo -e "\n\n\n\neverything seems ok. you may now\n\trm -rf $TEMP"