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