Renamed 'ugitlibs' to just plain 'ugit'
[ugit.git] / configure
blobba5ecddae7cedcb40da6d31c1eaed58caa32a7cc
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 cd $CUR_DIR
35 # We store waf under build/
36 PATH=$WORKINGDIR/build:$PATH
37 export PATH
39 # Checks for Python interpreter. Honours $PYTHON if set. Stores path to
40 # interpreter in $PYTHON.
42 checkPython()
44 if [ -z "$PYTHON" ] ; then
45 PYTHON=$(which python 2>/dev/null)
47 printf "Checking for Python\t\t\t: "
48 if [ ! -x "$PYTHON" ] ; then
49 printf $RED"not found!"$NORMAL"\n"
50 echo "Please make sure that the Python interpreter is available in your PATH"
51 echo "or invoke configure using the PYTHON flag, e.g."
52 echo "$ PYTHON=/usr/local/bin/python configure"
53 exit $EXIT_FAILURE
55 printf $GREEN"$PYTHON"$NORMAL"\n"
58 # Checks for WAF. Honours $WAF if set. Stores path to 'waf' in $WAF.
59 # Requires that $PYTHON is set.
61 checkWAF()
63 #installed miniwaf in sourcedir
64 if [ -z "$WAF" ] ; then
65 if [ -f "${WORKINGDIR}/build/waf" ] ; then
66 WAF="${WORKINGDIR}/build/waf"
67 if [ ! -x $WAF ] ; then
68 chmod +x $WAF
72 #global installed waf with waf->waf.py link
73 if [ -z $WAF ] ; then
74 WAF=$(which waf 2>/dev/null)
76 # neither waf nor miniwaf could be found
77 if [ ! -x "$WAF" ] ; then
78 printf $RED"not found"$NORMAL"\n"
79 echo "Goto http://www.freehackers.org/~tnagy/bksys.html"
80 echo "and download a waf version"
81 exit $EXIT_FAILURE
82 else
83 printf $GREEN"$WAF"$NORMAL"\n"
87 # Generates a Makefile. Requires that $WAF is set.
89 generateMakefile()
91 cat > Makefile << EOF
92 #!/usr/bin/make -f
94 # Waf Makefile wrapper
95 # http://www.freehackers.org/~tnagy/waf.html
96 WAF_HOME=$CUR_DIR
98 all:
99 @$WAF build
101 all_debug:
102 @$WAF -v build
104 all_progress:
105 @$WAF -p build
107 install:
108 @$WAF install
110 uninstall:
111 @$WAF uninstall
113 clean:
114 @$WAF clean
116 distclean:
117 @$WAF distclean
118 @-rm -rf cache/
119 @-rm -rf _build_
120 @-rm -f Makefile
122 check:
123 @$WAF check
125 dist:
126 @$WAF dist
131 checkPython
132 checkWAF
134 echo "calling waf configure with parameters"
135 $WAF configure $* || exit $EXIT_ERROR
137 #create a Makefile if waf configure succeeds
138 if [ -f "${WORKINGDIR}/.lock-wscript" ] ; then
139 if [ -f "Makefile" ] ; then
140 echo ""
141 else
142 generateMakefile
145 exit $EXIT_SUCCESS