summarylogtreecommitdiffstats
path: root/punyinform.sh
blob: d66dafddd0ea6e1b31d3153dd9914fddb80f0321 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
#
# This script passes the correct include_path to the Inform6 compiler
# for building games using the PunyInform Library.  Normally this script
# is automatically configured by the installing Makefile.
#
# This script was written by David Griffith <dave@661.org> in 2021 and
# released to the public domain.

# This is usually where the Inform6 libraries are installed.
# The installation process will fix this if necessary.
LIBPATH=/usr/local/share/inform

INFORM=inform
LIB=punyinform
LIBNAME="PunyInform"
NEWPATH=$LIBPATH/$LIB/lib
ZM_VERSION=-v3

MYNAME=`basename $0 ".sh"`

if [ "$MYNAME" != "$LIB" ] ; then
	VERSIONSTRING=`echo $MYNAME | sed s/$LIB//g`
	VERSION=`echo $VERSIONSTRING | sed s/^-//g`
	INFORM=$INFORM$VERSIONSTRING
else
	VERSION=`$INFORM -V | cut -d " " -f2`
fi

echo "Inform 6 Library Selection Wrapper by David Griffith."
echo "Using Inform version $VERSION."
echo "Using $LIBNAME library."

for ARG in "$@"; do
	case $ARG
	in
		-v*)
			ZM_VERSION=$ARG
			break
		;;
	esac
done

for ARG in "$@"; do
	if [ "$ZM_VERSION" != "$ARG" ] ; then
		LINE="$LINE $ARG"
	fi
done

FINAL="$ZM_VERSION +$NEWPATH $LINE"
$INFORM $FINAL