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 |
16a81ef7 | 8 | CLI=be/nikiroo/fanfix/reader/cli/CliReader |
738c81bf | 9 | TUI= |
16a81ef7 | 10 | GUI=be/nikiroo/fanfix/reader/ui/GuiReader |
24c18093 | 11 | JIMG= |
062ee296 | 12 | JCLI= |
738c81bf | 13 | JTUI= |
062ee296 | 14 | JGUI= |
9119671d | 15 | |
08fe2e33 NR |
16 | valid=true |
17 | while [ "$*" != "" ]; do | |
9119671d NR |
18 | key=`echo "$1" | cut -f1 -d=` |
19 | val=`echo "$1" | cut -f2 -d=` | |
08fe2e33 | 20 | case "$key" in |
9119671d NR |
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 | |
08fe2e33 NR |
32 | PREFIX="$val" |
33 | ;; | |
9119671d | 34 | --cli) #=no Disable CLI support (System.out) |
062ee296 | 35 | [ "$val" = no -o "$val" = false ] && CLI= && JCLI= |
9119671d | 36 | ;; |
738c81bf | 37 | --tui) #=yes Enable TUI support (Jexer, experimental) |
062ee296 | 38 | [ "$val" = no -o "$val" = false ] && TUI= && JTUI= |
738c81bf | 39 | if [ "$val" = yes -o "$val" = true ]; then |
16a81ef7 | 40 | TUI=be/nikiroo/fanfix/reader/tui/TuiReader |
738c81bf NR |
41 | JTUI="-C bin/ jexer" |
42 | fi | |
9119671d NR |
43 | ;; |
44 | --gui) #=no Disable GUI support (Swing) | |
062ee296 | 45 | [ "$val" = no -o "$val" = false ] && GUI= && JGUI= |
9119671d | 46 | ;; |
08fe2e33 NR |
47 | *) |
48 | echo "Unsupported parameter: '$1'" >&2 | |
9119671d NR |
49 | echo >&2 |
50 | sh "$0" --help >&2 | |
08fe2e33 NR |
51 | valid=false |
52 | ;; | |
53 | esac | |
54 | shift | |
55 | done | |
56 | ||
57 | [ $valid = false ] && exit 1 | |
58 | ||
59 | MESS="A required program cannot be found:" | |
60 | for prog in $PROGS; do | |
61 | out="`whereis -b "$prog" 2>/dev/null`" | |
62 | if [ "$out" = "$prog:" ]; then | |
63 | echo "$MESS $prog" >&2 | |
64 | valid=false | |
65 | fi | |
66 | done | |
67 | ||
68 | [ $valid = false ] && exit 2 | |
69 | ||
a6395bef NR |
70 | if [ "`whereis tput`" = "tput:" ]; then |
71 | ok='"[ ok ]"'; | |
72 | ko='"[ !! ]"'; | |
73 | cols=80; | |
74 | else | |
75 | ok='"`tput bold`[`tput setf 2` OK `tput init``tput bold`]`tput init`"'; | |
76 | ko='"`tput bold`[`tput setf 4` !! `tput init``tput bold`]`tput init`"'; | |
77 | cols='"`tput cols`"'; | |
78 | fi; | |
79 | ||
08fe2e33 | 80 | echo "MAIN = be/nikiroo/fanfix/Main" > Makefile |
24c18093 | 81 | echo "MORE = $CLI $TUI $GUI $IMG" >> Makefile |
92fb0719 | 82 | echo "TEST = be/nikiroo/fanfix/test/Test" >> Makefile |
a6395bef | 83 | echo "TEST_PARAMS = $cols $ok $ko" >> Makefile |
08fe2e33 NR |
84 | echo "NAME = fanfix" >> Makefile |
85 | echo "PREFIX = $PREFIX" >> Makefile | |
062ee296 | 86 | echo "JAR_FLAGS += -C bin/ org $JCLI $JTUI $JGUI -C bin/ be -C bin/ VERSION" >> Makefile |
53282dec | 87 | echo "RM_FOR_ANDROID = jexer be/nikiroo/utils/ui/* be/nikiroo/fanfix/reader/tui/* be/nikiroo/fanfix/reader/ui/*" >> Makefile |
9b05b757 | 88 | echo "ID_FOR_ANDROID = be.nikiroo.fanfix.reader.android" >> Makefile |
7d04a702 | 89 | #echo "SJAR_FLAGS += -C src/ org -C src/ jexer -C src/ be -C ./ LICENSE -C ./ README.md -C ./ VERSION" >> Makefile |
08fe2e33 NR |
90 | |
91 | cat Makefile.base >> Makefile | |
92 |