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