summaryrefslogtreecommitdiff
path: root/tools/pipol/scripts/compile-svn.sh
blob: 5cbac09b80ff7289635b08d0421ece64eaf9b7eb (plain)
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
#!/bin/sh
if [[ $# -lt 1 ]]; then
	echo Usage: `basename $0` dir [options];
	echo -n "Configure, compile, and check sources in \$PIPOL_WDIR/dir "
	echo passing options to the compiler;
	exit 1;
	
	else
	echo \*; echo \* $0 $*; echo \*;
fi

cd $PIPOL_WDIR/$1
if [[ ! -f configure ]]; then
	autoreconf -i || exit 1;
fi

shift
if grep -q "CFLAGS=" <<<"$@"; then
# "$@" would also split the CFLAGS options so we have to separate configure
# and CFLAGS options manually
    CONFIGURE_OPTIONS=`sed -ne 's/\(.*\)\ *CFLAGS=\"\(.*\)\"\(.*\)/\1\3/p' <<<"$@"`
    CFLAGS_OPTIONS=`sed -ne 's/\(.*\)\ *CFLAGS=\"\(.*\)\"\(.*\)/CFLAGS=\2/p' <<<"$@"`
    ./configure $CONFIGURE_OPTIONS "$CFLAGS_OPTIONS" && make && make check;

else
    ./configure "$@" && make && make check;
fi