]>
Commit | Line | Data |
---|---|---|
f6295c29 DL |
1 | #!/bin/bash |
2 | # written 2012-2013 by David Lamparter, placed in Public Domain. | |
3 | # | |
1689cf7e | 4 | # builds some git commit of FRR in some different configurations |
f6295c29 DL |
5 | # usage: buildtest.sh [commit [configurations...]] |
6 | ||
555d1e3a | 7 | basecfg="--prefix=/usr --enable-user=frr --enable-group=frr --enable-vty-group=frr --enable-configfile-mask=0660 --enable-logfile-mask=0640 --enable-vtysh --sysconfdir=/etc/frr --enable-exampledir=/etc/frr/samples --localstatedir=/var/run/frr --libdir=/usr/lib64/frr --enable-rtadv --disable-static --enable-isisd --enable-multipath=0 --enable-pimd --enable-werror" |
f6295c29 DL |
8 | |
9 | configs_base="gcc|$basecfg" | |
10 | ||
f6295c29 DL |
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 | ||
80ec006d | 16 | defconfigs="base ext" |
f6295c29 DL |
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}`" | |
555d1e3a | 39 | TEMP="`mktemp -t -d frrbuild.XXXXXX`" |
f6295c29 DL |
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 | |
f281ab97 | 82 | make check |
f6295c29 DL |
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" |