models: add export_patchset helper
[ugit.git] / configure
blobf28b52be233e8b460b94dff5b8ec15e140d2f350
1 #! /bin/sh
3 # waf configure wrapper
5 # Fancy colors used to beautify the output a bit.
7 if [ $NOCOLOR ] ; then
8 NORMAL=""
9 BOLD=""
10 RED=""
11 YELLOW=""
12 GREEN=""
13 else
14 NORMAL="\033[0m"
15 BOLD="\033[1m"
16 RED="\033[91m"
17 YELLOW="\033[01;93m"
18 GREEN="\033[92m"
21 EXIT_SUCCESS=0
22 EXIT_FAILURE=1
23 EXIT_ERROR=2
24 EXIT_BUG=10
26 CUR_DIR=$PWD
28 #possible relative path
29 WORKINGDIR=$(dirname $0)
30 cd $WORKINGDIR
31 #abs path
32 WORKINGDIR=$(pwd)
33 TESTDIR="$WORKINGDIR/t"
34 cd $CUR_DIR
36 # We store waf under build/
37 PATH=$WORKINGDIR/build:$PATH
38 export PATH
40 # Checks for Python interpreter. Honours $PYTHON if set. Stores path to
41 # interpreter in $PYTHON.
43 checkPython()
45 if [ -z "$PYTHON" ] ; then
46 PYTHON=$(which python 2>/dev/null)
48 printf "Checking for Python\t\t\t: "
49 if [ ! -x "$PYTHON" ] ; then
50 printf $RED"not found!"$NORMAL"\n"
51 echo "Please make sure that the Python interpreter is available in your PATH"
52 echo "or invoke configure using the PYTHON flag, e.g."
53 echo "$ PYTHON=/usr/local/bin/python configure"
54 exit $EXIT_FAILURE
56 printf $GREEN"$PYTHON"$NORMAL"\n"
59 # Checks for WAF. Honours $WAF if set. Stores path to 'waf' in $WAF.
60 # Requires that $PYTHON is set.
62 checkWAF()
64 #installed miniwaf in sourcedir
65 if [ -z "$WAF" ] ; then
66 if [ -f "${WORKINGDIR}/build/waf" ] ; then
67 WAF="${WORKINGDIR}/build/waf"
68 if [ ! -x $WAF ] ; then
69 chmod +x $WAF
73 #global installed waf with waf->waf.py link
74 if [ -z $WAF ] ; then
75 WAF=$(which waf 2>/dev/null)
77 # neither waf nor miniwaf could be found
78 if [ ! -x "$WAF" ] ; then
79 printf $RED"not found"$NORMAL"\n"
80 echo "Goto http://www.freehackers.org/~tnagy/bksys.html"
81 echo "and download a waf version"
82 exit $EXIT_FAILURE
83 else
84 printf $GREEN"$WAF"$NORMAL"\n"
88 # Generates a Makefile. Requires that $WAF is set.
90 generateMakefile()
92 cat > Makefile << EOF
93 #!/usr/bin/make -f
95 # Waf Makefile wrapper
96 # http://www.freehackers.org/~tnagy/waf.html
97 WAF_HOME=$CUR_DIR
98 PYTHON=$PYTHON
100 all:
101 @\$(PYTHON) $WAF build
103 all_debug:
104 @\$(PYTHON) $WAF -v build
106 all_progress:
107 @\$(PYTHON) $WAF -p build
109 install:
110 @\$(PYTHON) $WAF install
112 uninstall:
113 @\$(PYTHON) $WAF uninstall
115 clean:
116 @\$(PYTHON) $WAF clean
118 distclean:
119 @\$(PYTHON) $WAF distclean
120 @-rm -rf cache/
121 @-rm -rf _build_
122 @-rm -f Makefile
124 check:
125 @\$(PYTHON) $WAF check
127 dist:
128 @\$(PYTHON) $WAF dist
130 test:
131 @$TESTDIR/run_tests
136 checkPython
137 checkWAF
139 echo "calling waf configure with parameters"
140 $WAF configure $* || exit $EXIT_ERROR
142 #create a Makefile if waf configure succeeds
143 if [ -f "${WORKINGDIR}/.lock-wscript" ] ; then
144 generateMakefile
146 exit $EXIT_SUCCESS