summaryrefslogtreecommitdiff
path: root/tools/pipol/scripts/compile-svn.sh
blob: 092c6c14e213da1faf04f35dbc3af46d1ae4357e (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
28
29
30
31
32
33
#!/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" 
else
    ./configure "$@"
fi
if [ $? != 0 ]; then
# configure failed
    cat config.log
    exit 1
fi
make && make check