Commit | Line | Data |
---|---|---|
08fe2e33 NR |
1 | #!/bin/sh |
2 | ||
3 | # default: | |
4 | PREFIX=/usr/local | |
5 | PROGS="java javac jar make sed" | |
6 | ||
24c18093 | 7 | IMG=be/nikiroo/utils/ui/ImageUtilsAwt |
9119671d | 8 | |
08fe2e33 NR |
9 | valid=true |
10 | while [ "$*" != "" ]; do | |
9119671d NR |
11 | key=`echo "$1" | cut -f1 -d=` |
12 | val=`echo "$1" | cut -f2 -d=` | |
08fe2e33 | 13 | case "$key" in |
9119671d NR |
14 | --) |
15 | ;; | |
16 | --help) # This help message | |
17 | echo The following arguments can be used: | |
18 | cat "$0" | grep '^\s*--' | grep '#' | while read ln; do | |
19 | cmd=`echo "$ln" | cut -f1 -d')'` | |
20 | msg=`echo "$ln" | cut -f2 -d'#'` | |
21 | echo " $cmd$msg" | |
22 | done | |
23 | ;; | |
24 | --prefix) #=PATH Change the prefix to the given path | |
08fe2e33 NR |
25 | PREFIX="$val" |
26 | ;; | |
27 | *) | |
28 | echo "Unsupported parameter: '$1'" >&2 | |
9119671d NR |
29 | echo >&2 |
30 | sh "$0" --help >&2 | |
08fe2e33 NR |
31 | valid=false |
32 | ;; | |
33 | esac | |
34 | shift | |
35 | done | |
36 | ||
37 | [ $valid = false ] && exit 1 | |
38 | ||
39 | MESS="A required program cannot be found:" | |
40 | for prog in $PROGS; do | |
41 | out="`whereis -b "$prog" 2>/dev/null`" | |
42 | if [ "$out" = "$prog:" ]; then | |
43 | echo "$MESS $prog" >&2 | |
44 | valid=false | |
45 | fi | |
46 | done | |
47 | ||
48 | [ $valid = false ] && exit 2 | |
49 | ||
a6395bef NR |
50 | if [ "`whereis tput`" = "tput:" ]; then |
51 | ok='"[ ok ]"'; | |
52 | ko='"[ !! ]"'; | |
53 | cols=80; | |
54 | else | |
7e50d389 NR |
55 | #ok='"`tput bold`[`tput setf 2` OK `tput init``tput bold`]`tput init`"'; |
56 | #ko='"`tput bold`[`tput setf 4` !! `tput init``tput bold`]`tput init`"'; | |
57 | ok='"`tput bold`[`tput setaf 2` OK `tput init``tput bold`]`tput init`"'; | |
58 | ko='"`tput bold`[`tput setaf 1` !! `tput init``tput bold`]`tput init`"'; | |
a6395bef NR |
59 | cols='"`tput cols`"'; |
60 | fi; | |
61 | ||
08fe2e33 | 62 | echo "MAIN = be/nikiroo/fanfix/Main" > Makefile |
d7367179 | 63 | echo "MORE = $IMG" >> Makefile |
92fb0719 | 64 | echo "TEST = be/nikiroo/fanfix/test/Test" >> Makefile |
a6395bef | 65 | echo "TEST_PARAMS = $cols $ok $ko" >> Makefile |
08fe2e33 NR |
66 | echo "NAME = fanfix" >> Makefile |
67 | echo "PREFIX = $PREFIX" >> Makefile | |
d7367179 | 68 | echo "JAR_FLAGS += -C bin/ org -C bin/ be -C ./ LICENSE -C ./ VERSION -C libs/ licenses" >> Makefile |
08fe2e33 NR |
69 | |
70 | cat Makefile.base >> Makefile | |
71 |