update to latest nikiroo-utils
[jvcard.git] / configure.sh
1 #!/bin/sh
2
3 # default:
4 PREFIX=/usr/local
5 PROGS="java javac jar make sed"
6
7 TUI=be/nikiroo/jvcard/tui/TuiLauncher
8 JTUI="-C bin/ com -C bin/ resources"
9
10 NET="be/nikiroo/jvcard/remote/Server be/nikiroo/jvcard/remote/Sync"
11 JNET=
12
13 valid=true
14 while [ "$*" != "" ]; do
15 key=`echo "$1" | cut -f1 -d=`
16 val=`echo "$1" | cut -f2 -d=`
17 case "$key" in
18 --)
19 ;;
20 --help) # This help message
21 echo The following arguments can be used:
22 cat "$0" | grep '^\s*--' | grep '#' | while read ln; do
23 cmd=`echo "$ln" | cut -f1 -d')'`
24 msg=`echo "$ln" | cut -f2 -d'#'`
25 echo " $cmd$msg"
26 done
27 ;;
28 --prefix) #=PATH Change the prefix to the given path
29 PREFIX="$val"
30 ;;
31 --net) #=no Disable server and sync support
32 [ "$val" = no -o "$val" = false ] && NET= && JNET=
33 ;;
34 --tui) #=no Disable TUI support (Lanterna)
35 [ "$val" = no -o "$val" = false ] && TUI= && JTUI=
36 ;;
37 *)
38 echo "Unsupported parameter: '$1'" >&2
39 echo >&2
40 sh "$0" --help >&2
41 valid=false
42 ;;
43 esac
44 shift
45 done
46
47 [ $valid = false ] && exit 1
48
49 MESS="A required program cannot be found:"
50 for prog in $PROGS; do
51 out="`whereis -b "$prog" 2>/dev/null`"
52 if [ "$out" = "$prog:" ]; then
53 echo "$MESS $prog" >&2
54 valid=false
55 fi
56 done
57
58 [ $valid = false ] && exit 2
59
60 if [ "`whereis tput`" = "tput:" ]; then
61 ok='"[ ok ]"';
62 ko='"[ !! ]"';
63 cols=80;
64 else
65 ok='"`tput bold`[`tput setf 2` OK `tput init``tput bold`]`tput init`"';
66 ko='"`tput bold`[`tput setf 4` !! `tput init``tput bold`]`tput init`"';
67 cols='"`tput cols`"';
68 fi;
69
70 echo "MAIN = be/nikiroo/jvcard/launcher/Main" > Makefile
71 echo "MORE = $NET $TUI" >> Makefile
72 echo "TEST = " >> Makefile
73 echo "TEST_PARAMS = $cols $ok $ko" >> Makefile
74 echo "NAME = jvcard" >> Makefile
75 echo "PREFIX = $PREFIX" >> Makefile
76 echo "JAR_FLAGS += $JNET $JTUI -C bin/ be -C bin/ VERSION" >> Makefile
77 #echo "SJAR_FLAGS += -C src/ com -C src/ be -C ./ LICENSE -C ./ README.md -C ./ VERSION" >> Makefile
78
79 cat Makefile.base >> Makefile
80