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