author | kleing |
Mon, 21 Jun 2004 10:25:57 +0200 | |
changeset 14981 | e73f8140af78 |
parent 11550 | 915c5de6480f |
child 15574 | b1d1b5bfc464 |
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)" |
|
11125 | 19 |
echo " -k VERSION install KDE application icon on desktop" |
20 |
echo " (for KDE VERSION 1 or 2)" |
|
6417 | 21 |
echo " -p DIR install standalone binaries in DIR" |
5403 | 22 |
echo |
6417 | 23 |
echo " Install Isabelle executables with absolute references to the current" |
24 |
echo " distribution directory." |
|
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
25 |
echo |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
26 |
exit 1 |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
27 |
} |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
28 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
29 |
function fail() |
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 |
echo "$1" >&2 |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
32 |
exit 2 |
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 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
35 |
|
5403 | 36 |
## process command line |
37 |
||
38 |
# options |
|
39 |
||
6450 | 40 |
NO_OPTS=true |
41 |
||
5403 | 42 |
DISTDIR="$ISABELLE_HOME" |
6417 | 43 |
KDE="" |
44 |
BINDIR="" |
|
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
45 |
|
11125 | 46 |
while getopts "d:k:p:" OPT |
5403 | 47 |
do |
48 |
case "$OPT" in |
|
5404 | 49 |
d) |
5403 | 50 |
DISTDIR="$OPTARG" |
6450 | 51 |
NO_OPTS="" |
5403 | 52 |
;; |
6417 | 53 |
k) |
11125 | 54 |
KDE="$OPTARG" |
6450 | 55 |
NO_OPTS="" |
6417 | 56 |
;; |
57 |
p) |
|
58 |
BINDIR="$OPTARG" |
|
6450 | 59 |
NO_OPTS="" |
6417 | 60 |
;; |
5403 | 61 |
\?) |
62 |
usage |
|
63 |
;; |
|
64 |
esac |
|
65 |
done |
|
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
66 |
|
5403 | 67 |
shift $(($OPTIND - 1)) |
68 |
||
69 |
||
70 |
# args |
|
71 |
||
9788 | 72 |
[ "$#" -ne 0 -o -n "$NO_OPTS" ] && usage |
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
73 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
74 |
|
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
75 |
## main |
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
76 |
|
6459 | 77 |
echo "referring to distribution at $DISTDIR" |
6417 | 78 |
|
79 |
||
80 |
# standalone binaries |
|
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
81 |
|
6082 | 82 |
#set by configure |
10555 | 83 |
AUTO_BASH=bash |
84 |
||
85 |
case "$AUTO_BASH" in |
|
86 |
/*) |
|
87 |
BASH="$AUTO_BASH" |
|
88 |
;; |
|
89 |
*) |
|
90 |
BASH="/usr/bin/env bash" |
|
91 |
;; |
|
92 |
esac |
|
5362
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff
changeset
|
93 |
|
6417 | 94 |
if [ -n "$BINDIR" ]; then |
95 |
mkdir -p "$BINDIR" || fail "Bad directory: $BINDIR" |
|
96 |
||
11550
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents:
11127
diff
changeset
|
97 |
for NAME in isatool isabelle-process isabelle-interface |
6417 | 98 |
do |
99 |
BIN="$BINDIR/$NAME" |
|
100 |
DIST="$DISTDIR/bin/$NAME" |
|
101 |
echo "installing $BIN" |
|
10555 | 102 |
echo "#!$BASH" > "$BIN" || fail "Cannot write file: $BIN" |
9788 | 103 |
echo >> "$BIN" |
104 |
echo "exec \"$DIST\" \"\$@\"" >> "$BIN" |
|
105 |
chmod +x "$BIN" |
|
6417 | 106 |
done |
11550
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents:
11127
diff
changeset
|
107 |
for NAME in Isabelle isabelle |
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents:
11127
diff
changeset
|
108 |
do |
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents:
11127
diff
changeset
|
109 |
BIN="$BINDIR/$NAME" |
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents:
11127
diff
changeset
|
110 |
DIST="$DISTDIR/bin/$NAME" |
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents:
11127
diff
changeset
|
111 |
echo "installing $BIN" |
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents:
11127
diff
changeset
|
112 |
cp "$DIST" "$BIN" || fail "Cannot write file: $BIN" |
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents:
11127
diff
changeset
|
113 |
chmod +x "$BIN" |
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents:
11127
diff
changeset
|
114 |
done |
6417 | 115 |
fi |
116 |
||
117 |
||
11125 | 118 |
# install KDE 1.x / 2.x application icon |
5403 | 119 |
|
11125 | 120 |
if [ -n "$KDE" ]; then |
121 |
if [ "$KDE" = 1 ]; then |
|
122 |
KDEHOME=~/.kde |
|
123 |
KDEDESKTOP=~/Desktop |
|
124 |
KDEAPP="$KDEDESKTOP/Isabelle.kdelnk" |
|
125 |
elif [ "$KDE" = 2 ]; then |
|
126 |
KDEHOME=~/.kde2 |
|
127 |
KDEDESKTOP=~/KDesktop |
|
128 |
KDEAPP="$KDEDESKTOP/Isabelle.desktop" |
|
129 |
else |
|
130 |
fail "Unknown KDE version \"$KDE\"" |
|
131 |
fi |
|
11127 | 132 |
mkdir -p "$KDEDESKTOP" || fail "Bad directory: $KDEDESKTOP" |
6417 | 133 |
|
11125 | 134 |
KDEICONS="$KDEHOME/share/icons" |
9788 | 135 |
mkdir -p "$KDEICONS" || fail "Bad directory: $KDEICONS" |
136 |
mkdir -p "$KDEICONS/mini" || fail "Bad directory: $KDEICONS/mini" |
|
6417 | 137 |
|
9788 | 138 |
[ -f "$KDEICONS/isabelle.xpm" ] || cp "$ISABELLE_HOME/lib/icons/isabelle.xpm" "$KDEICONS" || \ |
6545 | 139 |
fail "Cannot write file: $KDEICONS/isabelle.xpm" |
9788 | 140 |
[ -f "$KDEICONS/mini/isabelle.xpm" ] || \ |
141 |
cp "$ISABELLE_HOME/lib/icons/isabelle-mini.xpm" "$KDEICONS/mini/isabelle.xpm" || \ |
|
6545 | 142 |
fail "Cannot write file: $KDEICONS/mini/isabelle.xpm" |
6417 | 143 |
|
144 |
echo "installing $KDEAPP" |
|
9788 | 145 |
echo "# KDE Config File" > "$KDEAPP" || fail "Cannot write file: $KDEAPP" |
146 |
echo "[KDE Desktop Entry]" >> "$KDEAPP" |
|
147 |
echo "Type=Application" >> "$KDEAPP" |
|
11550
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents:
11127
diff
changeset
|
148 |
echo "Exec=\"$DISTDIR/bin/isabelle-interface\" %f" >> "$KDEAPP" |
9788 | 149 |
echo "Icon=isabelle.xpm" >> "$KDEAPP" |
150 |
echo "TerminalOptions=" >> "$KDEAPP" |
|
151 |
echo "Path=" >> "$KDEAPP" |
|
152 |
echo "Terminal=0" >> "$KDEAPP" |
|
153 |
echo "Name=Isabelle" >> "$KDEAPP" |
|
6417 | 154 |
fi |