-
Notifications
You must be signed in to change notification settings - Fork 58
/
wxhaskell-register
executable file
·57 lines (51 loc) · 1.4 KB
/
wxhaskell-register
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
52
53
54
55
56
57
#!/bin/sh
# guess installation directory
if test -e "/usr/local/wxhaskell/bin/wx.pkg"; then
installdir="/usr/local/wxhaskell"
else if test -e "./wx.pkg"; then
installdir=".."
else
installdir="/usr/local"
fi
fi
# parse command-line arguments
while : ; do
# put optional argument in the $arg variable
case "$1" in
-*=*) arg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) arg= ;;
esac
# match on the arguments
case "$1" in
"") break;;
-installdir=*|--installdir=*)
installdir="$arg";;
-?|--help)
echo "usage:"
echo " wxhaskell-register [--installdir=<dir>]"
exit 1;;
*) echo "error:" 1>&2
echo " Unknown option \"$1\"." 1>&2
echo "" 1>&2
echo "usage:" 1>&2
echo " wxhaskell-register [--installdir=<dir>]" 1>&2
echo "" 1>&2
exit 2;;
esac
shift
done
# set libdir/bindir
libdir="${installdir}/lib"
bindir="${installdir}/bin"
# test if package files are found.
if test ! -e "${bindir}/wx.pkg"; then
echo "error: " 1>&2
echo " Unable to find wxhaskell packages: ${bindir}/wx.pkg" 1>&2
echo " Please specify the installation directory on the command line." 1>&2
echo " For example: wxhaskell-register --installdir=/usr/local/wxhaskell" 1>&2
echo "" 1>&2
exit 2
fi
# register the packages.
env wxhlibdir=${libdir} ghc-pkg -u -i ${bindir}/wxcore.pkg
env wxhlibdir=${libdir} ghc-pkg -u -i ${bindir}/wx.pkg