forked from OlioEngr/jexer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.sh
executable file
·76 lines (66 loc) · 1.72 KB
/
configure.sh
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
#!/bin/sh
# default:
PREFIX=/usr/local
PROGS="java javac jar make sed"
DEMOS=
i=2 # 1 = main file
while [ -e src/jexer/demos/Demo$i.java ]; do
DEMOS="$DEMOS jexer/demos/Demo$i"
i=`expr $i + 1`
done
valid=true
while [ "$*" != "" ]; do
key=`echo "$1" | cut -f1 -d=`
val=`echo "$1" | cut -f2 -d=`
case "$key" in
--)
;;
--help) # This help message
echo The following arguments can be used:
cat "$0" | grep '^\s*--' | grep '#' | while read ln; do
cmd=`echo "$ln" | cut -f1 -d')'`
msg=`echo "$ln" | cut -f2 -d'#'`
echo " $cmd$msg"
done
;;
--prefix) #=PATH Change the prefix to the given path
PREFIX="$val"
;;
*)
echo "Unsupported parameter: '$1'" >&2
echo >&2
sh "$0" --help >&2
valid=false
;;
esac
shift
done
[ $valid = false ] && exit 1
MESS="A required program cannot be found:"
for prog in $PROGS; do
out="`whereis -b "$prog" 2>/dev/null`"
if [ "$out" = "$prog:" ]; then
echo "$MESS $prog" >&2
valid=false
fi
done
[ $valid = false ] && exit 2
if [ "`whereis tput`" = "tput:" ]; then
ok='"[ ok ]"';
ko='"[ !! ]"';
cols=80;
else
#ok='"`tput bold`[`tput setf 2` OK `tput init``tput bold`]`tput init`"';
#ko='"`tput bold`[`tput setf 4` !! `tput init``tput bold`]`tput init`"';
ok='"`tput bold`[`tput setaf 2` OK `tput init``tput bold`]`tput init`"';
ko='"`tput bold`[`tput setaf 1` !! `tput init``tput bold`]`tput init`"';
cols='"`tput cols`"';
fi;
echo "MAIN = jexer/demos/Demo1" > Makefile
echo "MORE = $DEMOS" >> Makefile
echo "TEST = be/nikiroo/fanfix/test/Test" >> Makefile
echo "TEST_PARAMS = $cols $ok $ko" >> Makefile
echo "NAME = jexer" >> Makefile
echo "PREFIX = $PREFIX" >> Makefile
echo "JAR_FLAGS += -C bin/ jexer -C ./ LICENSE -C ./ VERSION" >> Makefile
cat Makefile.base >> Makefile