author | aspinall |
Thu, 14 Apr 2005 19:16:07 +0200 | |
changeset 15733 | 75b9219980d3 |
parent 15574 | b1d1b5bfc464 |
child 15848 | 3001067227af |
permissions | -rwxr-xr-x |
10555 | 1 |
#!/usr/bin/env bash |
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
2 |
# |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
3 |
# $Id$ |
9788 | 4 |
# Author: Markus Wenzel, TU Muenchen |
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
5 |
# |
6417 | 6 |
# DESCRIPTION: install standalone Isabelle executables |
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
7 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
8 |
|
9788 | 9 |
PRG=$(basename "$0") |
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
10 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
11 |
function usage() |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
12 |
{ |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
13 |
echo |
6417 | 14 |
echo "Usage: $PRG [OPTIONS]" |
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
15 |
echo |
5403 | 16 |
echo " Options are:" |
7887 | 17 |
echo " -d DISTDIR refer to DISTDIR as Isabelle distribution" |
18 |
echo " (default ISABELLE_HOME)" |
|
15733 | 19 |
echo " -a RDISTDIR refer to RDISTDIR as Isabelle distribution" |
20 |
echo " in installed files, for packaging scripts" |
|
21 |
echo " (default to same value as -d)" |
|
11125 | 22 |
echo " -k VERSION install KDE application icon on desktop" |
23 |
echo " (for KDE VERSION 1 or 2)" |
|
6417 | 24 |
echo " -p DIR install standalone binaries in DIR" |
5403 | 25 |
echo |
6417 | 26 |
echo " Install Isabelle executables with absolute references to the current" |
27 |
echo " distribution directory." |
|
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
28 |
echo |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
29 |
exit 1 |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
30 |
} |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
31 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
32 |
function fail() |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
33 |
{ |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
34 |
echo "$1" >&2 |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
35 |
exit 2 |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
36 |
} |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
37 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
38 |
|
5403 | 39 |
## process command line |
40 |
||
41 |
# options |
|
42 |
||
6450 | 43 |
NO_OPTS=true |
44 |
||
5403 | 45 |
DISTDIR="$ISABELLE_HOME" |
6417 | 46 |
KDE="" |
47 |
BINDIR="" |
|
15733 | 48 |
RDISTDIR="" |
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
49 |
|
15733 | 50 |
while getopts "d:k:p:a:" OPT |
5403 | 51 |
do |
52 |
case "$OPT" in |
|
5404 | 53 |
d) |
5403 | 54 |
DISTDIR="$OPTARG" |
6450 | 55 |
NO_OPTS="" |
5403 | 56 |
;; |
6417 | 57 |
k) |
11125 | 58 |
KDE="$OPTARG" |
6450 | 59 |
NO_OPTS="" |
6417 | 60 |
;; |
61 |
p) |
|
62 |
BINDIR="$OPTARG" |
|
6450 | 63 |
NO_OPTS="" |
6417 | 64 |
;; |
15733 | 65 |
a) |
66 |
RDISTDIR="$OPTARG" |
|
67 |
NO_OPTS="" |
|
68 |
;; |
|
5403 | 69 |
\?) |
70 |
usage |
|
71 |
;; |
|
72 |
esac |
|
73 |
done |
|
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
74 |
|
5403 | 75 |
shift $(($OPTIND - 1)) |
76 |
||
77 |
||
78 |
# args |
|
79 |
||
9788 | 80 |
[ "$#" -ne 0 -o -n "$NO_OPTS" ] && usage |
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
81 |
|
15733 | 82 |
if [ -z "$RDISTDIR" ]; then |
83 |
RDISTDIR=$DISTDIR |
|
84 |
fi |
|
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
85 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
86 |
## main |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
87 |
|
6459 | 88 |
echo "referring to distribution at $DISTDIR" |
6417 | 89 |
|
90 |
||
91 |
# standalone binaries |
|
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
92 |
|
6082 | 93 |
#set by configure |
15574
b1d1b5bfc464
Removed practically all references to Library.foldr.
skalberg
parents:
14981
diff
changeset
|
94 |
AUTO_BASH=/bin/bash |
10555 | 95 |
|
96 |
case "$AUTO_BASH" in |
|
97 |
/*) |
|
98 |
BASH="$AUTO_BASH" |
|
99 |
;; |
|
100 |
*) |
|
101 |
BASH="/usr/bin/env bash" |
|
102 |
;; |
|
103 |
esac |
|
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
104 |
|
6417 | 105 |
if [ -n "$BINDIR" ]; then |
106 |
mkdir -p "$BINDIR" || fail "Bad directory: $BINDIR" |
|
107 |
||
11550
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents:
11127
diff
changeset
|
108 |
for NAME in isatool isabelle-process isabelle-interface |
6417 | 109 |
do |
110 |
BIN="$BINDIR/$NAME" |
|
15733 | 111 |
DIST="$RDISTDIR/bin/$NAME" |
6417 | 112 |
echo "installing $BIN" |
10555 | 113 |
echo "#!$BASH" > "$BIN" || fail "Cannot write file: $BIN" |
9788 | 114 |
echo >> "$BIN" |
115 |
echo "exec \"$DIST\" \"\$@\"" >> "$BIN" |
|
116 |
chmod +x "$BIN" |
|
6417 | 117 |
done |
11550
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents:
11127
diff
changeset
|
118 |
for NAME in Isabelle isabelle |
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents:
11127
diff
changeset
|
119 |
do |
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents:
11127
diff
changeset
|
120 |
BIN="$BINDIR/$NAME" |
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents:
11127
diff
changeset
|
121 |
DIST="$DISTDIR/bin/$NAME" |
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents:
11127
diff
changeset
|
122 |
echo "installing $BIN" |
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents:
11127
diff
changeset
|
123 |
cp "$DIST" "$BIN" || fail "Cannot write file: $BIN" |
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents:
11127
diff
changeset
|
124 |
chmod +x "$BIN" |
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents:
11127
diff
changeset
|
125 |
done |
6417 | 126 |
fi |
127 |
||
128 |
||
11125 | 129 |
# install KDE 1.x / 2.x application icon |
5403 | 130 |
|
11125 | 131 |
if [ -n "$KDE" ]; then |
132 |
if [ "$KDE" = 1 ]; then |
|
133 |
KDEHOME=~/.kde |
|
134 |
KDEDESKTOP=~/Desktop |
|
135 |
KDEAPP="$KDEDESKTOP/Isabelle.kdelnk" |
|
136 |
elif [ "$KDE" = 2 ]; then |
|
137 |
KDEHOME=~/.kde2 |
|
138 |
KDEDESKTOP=~/KDesktop |
|
139 |
KDEAPP="$KDEDESKTOP/Isabelle.desktop" |
|
140 |
else |
|
141 |
fail "Unknown KDE version \"$KDE\"" |
|
142 |
fi |
|
11127 | 143 |
mkdir -p "$KDEDESKTOP" || fail "Bad directory: $KDEDESKTOP" |
6417 | 144 |
|
11125 | 145 |
KDEICONS="$KDEHOME/share/icons" |
9788 | 146 |
mkdir -p "$KDEICONS" || fail "Bad directory: $KDEICONS" |
147 |
mkdir -p "$KDEICONS/mini" || fail "Bad directory: $KDEICONS/mini" |
|
6417 | 148 |
|
9788 | 149 |
[ -f "$KDEICONS/isabelle.xpm" ] || cp "$ISABELLE_HOME/lib/icons/isabelle.xpm" "$KDEICONS" || \ |
6545 | 150 |
fail "Cannot write file: $KDEICONS/isabelle.xpm" |
9788 | 151 |
[ -f "$KDEICONS/mini/isabelle.xpm" ] || \ |
152 |
cp "$ISABELLE_HOME/lib/icons/isabelle-mini.xpm" "$KDEICONS/mini/isabelle.xpm" || \ |
|
6545 | 153 |
fail "Cannot write file: $KDEICONS/mini/isabelle.xpm" |
6417 | 154 |
|
155 |
echo "installing $KDEAPP" |
|
9788 | 156 |
echo "# KDE Config File" > "$KDEAPP" || fail "Cannot write file: $KDEAPP" |
157 |
echo "[KDE Desktop Entry]" >> "$KDEAPP" |
|
158 |
echo "Type=Application" >> "$KDEAPP" |
|
15733 | 159 |
echo "Exec=\"$RDISTDIR/bin/isabelle-interface\" %f" >> "$KDEAPP" |
9788 | 160 |
echo "Icon=isabelle.xpm" >> "$KDEAPP" |
161 |
echo "TerminalOptions=" >> "$KDEAPP" |
|
162 |
echo "Path=" >> "$KDEAPP" |
|
163 |
echo "Terminal=0" >> "$KDEAPP" |
|
164 |
echo "Name=Isabelle" >> "$KDEAPP" |
|
6417 | 165 |
fi |