2009-04-15 10:08:28 +02:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
# waf configure wrapper
|
|
|
|
|
|
|
|
# Fancy colors used to beautify the output a bit.
|
|
|
|
#
|
2009-04-22 19:35:47 +02:00
|
|
|
NORMAL=""
|
|
|
|
BOLD=""
|
|
|
|
RED=""
|
|
|
|
YELLOW=""
|
|
|
|
GREEN=""
|
2009-04-15 10:08:28 +02:00
|
|
|
|
|
|
|
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`
|
|
|
|
cd $CUR_DIR
|
|
|
|
|
2009-06-22 13:08:32 +02:00
|
|
|
WAF="${WORKINGDIR}/tools/waf"
|
|
|
|
|
2009-04-15 10:08:28 +02:00
|
|
|
# Checks for WAF. Honours $WAF if set. Stores path to 'waf' in $WAF.
|
|
|
|
# Requires that $PYTHON is set.
|
|
|
|
#
|
|
|
|
checkWAF()
|
|
|
|
{
|
|
|
|
printf "Checking for WAF\t\t\t: "
|
|
|
|
#installed miniwaf in sourcedir
|
|
|
|
if [ -z "$WAF" ] ; then
|
|
|
|
if [ -f "${WORKINGDIR}/waf" ] ; then
|
|
|
|
WAF="${WORKINGDIR}/waf"
|
|
|
|
if [ ! -x "$WAF" ] ; then
|
|
|
|
chmod +x $WAF
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ -z "$WAF" ] ; then
|
|
|
|
if [ -f "${WORKINGDIR}/waf-light" ] ; then
|
|
|
|
${WORKINGDIR}/waf-light --make-waf
|
|
|
|
WAF="${WORKINGDIR}/waf"
|
|
|
|
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 "Go to http://code.google.com/p/waf/"
|
|
|
|
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
|
|
|
|
WAF_HOME=$CUR_DIR
|
|
|
|
|
|
|
|
all:
|
|
|
|
@$WAF build
|
|
|
|
|
|
|
|
all-debug:
|
|
|
|
@$WAF -v build
|
|
|
|
|
|
|
|
all-progress:
|
|
|
|
@$WAF -p build
|
|
|
|
|
|
|
|
install:
|
|
|
|
if test -n "\$(DESTDIR)"; then \\
|
2009-04-23 14:22:57 +02:00
|
|
|
$WAF install --destdir="\$(DESTDIR)" ; \\
|
2009-04-15 10:08:28 +02:00
|
|
|
else \\
|
2009-04-23 14:22:57 +02:00
|
|
|
$WAF install ; \\
|
2009-04-15 10:08:28 +02:00
|
|
|
fi;
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
@if test -n "\$(DESTDIR)"; then \\
|
2009-04-18 14:31:13 +02:00
|
|
|
$WAF uninstall --destdir="\$(DESTDIR)" ; \\
|
2009-04-15 10:08:28 +02:00
|
|
|
else \\
|
2009-04-18 14:31:13 +02:00
|
|
|
$WAF uninstall ; \\
|
2009-04-15 10:08:28 +02:00
|
|
|
fi;
|
2009-04-21 13:51:05 +02:00
|
|
|
|
|
|
|
test: all
|
2009-06-22 13:51:47 +02:00
|
|
|
python tools/test.py --mode=release
|
2009-06-27 00:49:47 +02:00
|
|
|
|
|
|
|
test-all: all
|
|
|
|
python tools/test.py --mode=debug,release
|
2009-04-15 10:08:28 +02:00
|
|
|
|
2009-07-13 12:48:59 +02:00
|
|
|
test-debug: all
|
2009-07-16 16:54:55 +02:00
|
|
|
python tools/test.py --mode=debug
|
2009-07-13 12:48:59 +02:00
|
|
|
|
|
|
|
benchmark: all
|
|
|
|
build/default/node benchmark/run.js
|
|
|
|
|
2009-09-10 13:40:38 +02:00
|
|
|
doc: doc/node.1 doc/api.html doc/index.html
|
2009-06-30 13:27:25 +02:00
|
|
|
|
2009-09-10 13:40:38 +02:00
|
|
|
doc/api.html: doc/api.txt
|
2009-08-25 16:23:01 +02:00
|
|
|
asciidoc --unsafe \\
|
|
|
|
-a theme=pipe \\
|
|
|
|
-a toc \\
|
|
|
|
-a linkcss \\
|
2009-09-10 13:40:38 +02:00
|
|
|
-o doc/api.html doc/api.txt
|
2009-08-25 16:23:01 +02:00
|
|
|
|
2009-09-10 13:40:38 +02:00
|
|
|
doc/api.xml: doc/api.txt
|
|
|
|
asciidoc -b docbook -d manpage -o doc/api.xml doc/api.txt
|
2009-06-30 13:27:25 +02:00
|
|
|
|
2009-09-10 13:40:38 +02:00
|
|
|
doc/node.1: doc/api.xml
|
|
|
|
xsltproc --output doc/node.1 \\
|
2009-09-11 20:34:55 +02:00
|
|
|
--nonet doc/docbook-xsl/manpage.xsl \\
|
2009-09-10 13:40:38 +02:00
|
|
|
doc/api.xml
|
|
|
|
|
|
|
|
website-upload: doc
|
|
|
|
scp doc/* linode:~/tinyclouds/node/
|
2009-06-30 13:27:25 +02:00
|
|
|
|
2009-04-15 10:08:28 +02:00
|
|
|
clean:
|
|
|
|
@$WAF clean
|
|
|
|
|
|
|
|
distclean:
|
|
|
|
@$WAF distclean
|
|
|
|
@-rm -rf _build_
|
|
|
|
@-rm -f Makefile
|
2009-04-21 13:51:05 +02:00
|
|
|
@-rm -f *.pyc
|
2009-04-15 10:08:28 +02:00
|
|
|
|
|
|
|
check:
|
|
|
|
@$WAF check
|
|
|
|
|
|
|
|
dist:
|
|
|
|
@$WAF dist
|
|
|
|
|
2009-09-10 13:40:38 +02:00
|
|
|
.PHONY: benchmark clean dist distclean check uninstall install all test test-all website-upload
|
2009-04-15 10:08:28 +02:00
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
checkWAF
|
|
|
|
|
|
|
|
generateMakefile
|
|
|
|
|
2009-04-18 14:31:13 +02:00
|
|
|
"${WAF}" configure $*
|
2009-04-15 10:08:28 +02:00
|
|
|
|
|
|
|
exit $?
|