summaryrefslogtreecommitdiffstats
path: root/parts/appwizard/common/scons/configure
blob: 289a68432b32422c1cf948cbc08276ebe899a681 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#! /bin/sh
# Fancy colors used to beautify the output a bit.
#
NORMAL="\033[0m"
BOLD="\033[1m"
RED="\033[91m"
YELLOW="\033[93m"
GREEN="\033[92m"

# 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
	echo -n "Checking for Python               :  "
	if [ ! -x "$PYTHON" ]; then
	  echo -e $GREEN"not found!"$NORMAL
	  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 1
	fi
	echo -e $GREEN"$PYTHON"$NORMAL
}

# Checks for SCons. Honours $SCONS if set. Stores path to 'scons' in $SCONS.
# Requires that $PYTHON is set.
#
checkSCons()
{
	echo -n "Checking for SCons                :  "
	if [ -z $SCONS ]; then
	  SCONS=`which scons 2>/dev/null`
	fi
	if [ ! -x "$SCONS" ]; then
	  echo -e $BOLD"not found, will use mini distribution."$NORMAL
	  tar xjf admin/scons-mini.tar.bz2
	  SCONS="./scons"
	else
	  echo -e $GREEN"$SCONS"$NORMAL
	fi
	SCONS="$SCONS -Q"
}

# Generates a Makefile. Requires that $SCONS is set.
#
generateMakefile()
{
	cat > Makefile << EOF
all:
	@$SCONS

# it is also possible to use
# @$SCONS -j4

install:
	@$SCONS install

clean:
	@$SCONS -c

uninstall:
	@$SCONS -c install

dist:
	@$SCONS dist

distclean:
	@$SCONS -c
	rm -rf cache/
EOF
}

checkPython
checkSCons

if [[ "$1" == "--help" ]]; then
   $SCONS --help
   exit
fi

generateMakefile
$SCONS configure $@