summaryrefslogtreecommitdiffstats
path: root/configure
blob: 83b4ab9380ef2227492cb94aeab19d5f251bd15a (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
# TODO parse each passed argument and remove any "--" prefix

BOLD="\033[1m"
RED="\033[91m"
GREEN="\033[92m"
YELLOW="\033[93m"
CYAN="\033[96m"
NORMAL="\033[0m"

if command -v scons >/dev/null 2>&1;
then
	SCONS=scons
else
	if [ ! -e "scons/scons" ]; then
		echo ""
		echo -ne "Unpacking mini-scons..."$RED

		pushd scons >/dev/null 2>&1
		tar xjvf scons-mini.tar.bz2 > /dev/null 2>&1

		if [[ "$?" == "0" ]]; then
			echo -e $GREEN"done"$NORMAL
		else
			echo -e $RED"failed!"$NORMAL
			exit 2
		fi

		popd > /dev/null
        fi

	SCONS=scons/scons
fi

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

echo ""
echo "Configuring Codeine "`cat VERSION`"..."
echo ""

#TODO remove all prefixed "--"

$SCONS -Q configure $@ || exit 1

echo ""
echo -e "Your configure completed "$GREEN"successfully"$NORMAL", now type "$BOLD"make"$NORMAL
echo ""

cat > Makefile << EOF
## Makefile automatically generated by unpack_local_scons.sh

SCONS=$SCONS

# scons            : compile
# scons -c         : clean
# scons install    : install
# scons -c install : uninstall and clean

# default target : use scons to build the programs
all:
	\$(SCONS) -Q

### There are several possibilities to help debugging :
# scons --debug=explain, scons --debug=tree ..
#
### To optimize the runtime, use
# scons --max-drift=1 --implicit-deps-unchanged
debug:
	\$(SCONS) -Q --debug=tree

clean:
	\$(SCONS) -c

install:
	\$(SCONS) install

uninstall:
	\$(SCONS) -c install

## this target creates a tarball of the project
dist:
	\$(SCONS) dist
EOF