Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 147 lines (122 sloc) 2.822 kB
#! /bin/sh
# waf configure wrapper
# Fancy colors used to beautify the output a bit.
#
if [ $NOCOLOR ] ; then
NORMAL=""
BOLD=""
RED=""
YELLOW=""
GREEN=""
else
NORMAL="\033[0m"
BOLD="\033[1m"
RED="\033[91m"
YELLOW="\033[01;93m"
GREEN="\033[92m"
fi
EXIT_SUCCESS=0
EXIT_FAILURE=1
EXIT_ERROR=2
EXIT_BUG=10
CUR_DIR=$PWD
#possible relative path
WORKINGDIR=$(dirname $0)
cd $WORKINGDIR
#abs path
WORKINGDIR=$(pwd)
TESTDIR="$WORKINGDIR/t"
cd $CUR_DIR
# We store waf under build/
PATH=$WORKINGDIR/build:$PATH
export PATH
# Checks for Python interpreter. Honours $PYTHON if set. Stores path to
# interpreter in $PYTHON.
#
checkPython()
{
if [ -z "$PYTHON" ] ; then
PYTHON=$(which python 2>/dev/null)
fi
printf "Checking for Python\t\t\t: "
if [ ! -x "$PYTHON" ] ; then
printf $RED"not found!"$NORMAL"\n"
echo "Please make sure that the Python interpreter is available in your PATH"
echo "or invoke configure using the PYTHON flag, e.g."
echo "$ PYTHON=/usr/local/bin/python configure"
exit $EXIT_FAILURE
fi
printf $GREEN"$PYTHON"$NORMAL"\n"
}
# Checks for WAF. Honours $WAF if set. Stores path to 'waf' in $WAF.
# Requires that $PYTHON is set.
#
checkWAF()
{
#installed miniwaf in sourcedir
if [ -z "$WAF" ] ; then
if [ -f "${WORKINGDIR}/build/waf" ] ; then
WAF="${WORKINGDIR}/build/waf"
if [ ! -x $WAF ] ; then
chmod +x $WAF
fi
fi
fi
#global installed waf with waf->waf.py link
if [ -z $WAF ] ; then
WAF=$(which waf 2>/dev/null)
fi
# neither waf nor miniwaf could be found
if [ ! -x "$WAF" ] ; then
printf $RED"not found"$NORMAL"\n"
echo "Goto http://www.freehackers.org/~tnagy/bksys.html"
echo "and download a waf version"
exit $EXIT_FAILURE
else
printf $GREEN"$WAF"$NORMAL"\n"
fi
}
# Generates a Makefile. Requires that $WAF is set.
#
generateMakefile()
{
cat > Makefile << EOF
#!/usr/bin/make -f
# Waf Makefile wrapper
# http://www.freehackers.org/~tnagy/waf.html
WAF_HOME=$CUR_DIR
PYTHON=$PYTHON
all:
@\$(PYTHON) $WAF build
all_debug:
@\$(PYTHON) $WAF -v build
all_progress:
@\$(PYTHON) $WAF -p build
install:
@\$(PYTHON) $WAF install
uninstall:
@\$(PYTHON) $WAF uninstall
clean:
@\$(PYTHON) $WAF clean
distclean:
@\$(PYTHON) $WAF distclean
@-rm -rf cache/
@-rm -rf _build_
@-rm -f Makefile
check:
@\$(PYTHON) $WAF check
dist:
@\$(PYTHON) $WAF dist
test:
@$TESTDIR/run_tests
EOF
}
checkPython
checkWAF
echo "calling waf configure with parameters"
$WAF configure $* || exit $EXIT_ERROR
#create a Makefile if waf configure succeeds
if [ -f "${WORKINGDIR}/.lock-wscript" ] ; then
generateMakefile
fi
exit $EXIT_SUCCESS
Jump to Line
Something went wrong with that request. Please try again.