lib/Tools/install
author oheimb
Wed, 03 Apr 2002 10:21:13 +0200
changeset 13076 70704dd48bd5
parent 11550 915c5de6480f
child 14981 e73f8140af78
permissions -rwxr-xr-x
bugfix concerning claset(), added limited support for ALLGOALS + fast_tac etc.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10555
2323ec838401 /usr/bin/env bash;
wenzelm
parents: 10504
diff changeset
     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
wenzelm
parents: 7934
diff changeset
     4
# Author: Markus Wenzel, TU Muenchen
wenzelm
parents: 7934
diff changeset
     5
# License: GPL (GNU GENERAL PUBLIC LICENSE)
5362
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
     6
#
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
     7
# DESCRIPTION: install standalone Isabelle executables
5362
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
     8
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
     9
9788
wenzelm
parents: 7934
diff changeset
    10
PRG=$(basename "$0")
5362
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    11
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    12
function usage()
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    13
{
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    14
  echo
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    15
  echo "Usage: $PRG [OPTIONS]"
5362
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    16
  echo
5403
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    17
  echo "  Options are:"
7887
eedfff88ee40 tuned usage;
wenzelm
parents: 6545
diff changeset
    18
  echo "    -d DISTDIR   refer to DISTDIR as Isabelle distribution"
eedfff88ee40 tuned usage;
wenzelm
parents: 6545
diff changeset
    19
  echo "                 (default ISABELLE_HOME)"
11125
b70c3c1b499f handle KDE version 1 or 2;
wenzelm
parents: 10555
diff changeset
    20
  echo "    -k VERSION   install KDE application icon on desktop"
b70c3c1b499f handle KDE version 1 or 2;
wenzelm
parents: 10555
diff changeset
    21
  echo "                 (for KDE VERSION 1 or 2)"
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    22
  echo "    -p DIR       install standalone binaries in DIR"
5403
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    23
  echo
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    24
  echo "  Install Isabelle executables with absolute references to the current"
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    25
  echo "  distribution directory."
5362
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    26
  echo
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    27
  exit 1
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
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    30
function fail()
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
  echo "$1" >&2
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    33
  exit 2
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
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    36
5403
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    37
## process command line
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    38
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    39
# options
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    40
6450
990e6e2dee26 improved usage;
wenzelm
parents: 6417
diff changeset
    41
NO_OPTS=true
990e6e2dee26 improved usage;
wenzelm
parents: 6417
diff changeset
    42
5403
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    43
DISTDIR="$ISABELLE_HOME"
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    44
KDE=""
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    45
BINDIR=""
5362
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    46
11125
b70c3c1b499f handle KDE version 1 or 2;
wenzelm
parents: 10555
diff changeset
    47
while getopts "d:k:p:" OPT
5403
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    48
do
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    49
  case "$OPT" in
5404
wenzelm
parents: 5403
diff changeset
    50
    d)
5403
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    51
      DISTDIR="$OPTARG"
6450
990e6e2dee26 improved usage;
wenzelm
parents: 6417
diff changeset
    52
      NO_OPTS=""
5403
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    53
      ;;
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    54
    k)
11125
b70c3c1b499f handle KDE version 1 or 2;
wenzelm
parents: 10555
diff changeset
    55
      KDE="$OPTARG"
6450
990e6e2dee26 improved usage;
wenzelm
parents: 6417
diff changeset
    56
      NO_OPTS=""
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    57
      ;;
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    58
    p)
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    59
      BINDIR="$OPTARG"
6450
990e6e2dee26 improved usage;
wenzelm
parents: 6417
diff changeset
    60
      NO_OPTS=""
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    61
      ;;
5403
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    62
    \?)
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    63
      usage
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    64
      ;;
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    65
  esac
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    66
done
5362
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    67
5403
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    68
shift $(($OPTIND - 1))
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    69
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    70
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    71
# args
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    72
9788
wenzelm
parents: 7934
diff changeset
    73
[ "$#" -ne 0 -o -n "$NO_OPTS" ] && usage
5362
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
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    76
## main
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    77
6459
1d13a86bfa6c fixed ISABELLE_HOME/lib/logo/isabelle-tiny.xpm;
wenzelm
parents: 6450
diff changeset
    78
echo "referring to distribution at $DISTDIR"
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    79
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    80
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    81
# standalone binaries
5362
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    82
6082
590f9e3bf4d8 configure AUTO_BASH, AUTO_PERL;
wenzelm
parents: 5404
diff changeset
    83
#set by configure
10555
2323ec838401 /usr/bin/env bash;
wenzelm
parents: 10504
diff changeset
    84
AUTO_BASH=bash
2323ec838401 /usr/bin/env bash;
wenzelm
parents: 10504
diff changeset
    85
2323ec838401 /usr/bin/env bash;
wenzelm
parents: 10504
diff changeset
    86
case "$AUTO_BASH" in
2323ec838401 /usr/bin/env bash;
wenzelm
parents: 10504
diff changeset
    87
  /*)
2323ec838401 /usr/bin/env bash;
wenzelm
parents: 10504
diff changeset
    88
    BASH="$AUTO_BASH"
2323ec838401 /usr/bin/env bash;
wenzelm
parents: 10504
diff changeset
    89
    ;;
2323ec838401 /usr/bin/env bash;
wenzelm
parents: 10504
diff changeset
    90
  *)
2323ec838401 /usr/bin/env bash;
wenzelm
parents: 10504
diff changeset
    91
    BASH="/usr/bin/env bash"
2323ec838401 /usr/bin/env bash;
wenzelm
parents: 10504
diff changeset
    92
    ;;
2323ec838401 /usr/bin/env bash;
wenzelm
parents: 10504
diff changeset
    93
esac
5362
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    94
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    95
if [ -n "$BINDIR" ]; then
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    96
  mkdir -p "$BINDIR" || fail "Bad directory: $BINDIR"
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    97
11550
915c5de6480f smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents: 11127
diff changeset
    98
  for NAME in isatool isabelle-process isabelle-interface
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    99
  do
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
   100
    BIN="$BINDIR/$NAME"
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
   101
    DIST="$DISTDIR/bin/$NAME"
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
   102
    echo "installing $BIN"
10555
2323ec838401 /usr/bin/env bash;
wenzelm
parents: 10504
diff changeset
   103
    echo "#!$BASH" > "$BIN" || fail "Cannot write file: $BIN"
9788
wenzelm
parents: 7934
diff changeset
   104
    echo >> "$BIN"
wenzelm
parents: 7934
diff changeset
   105
    echo "exec \"$DIST\" \"\$@\"" >> "$BIN"
wenzelm
parents: 7934
diff changeset
   106
    chmod +x "$BIN"
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
   107
  done
11550
915c5de6480f smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents: 11127
diff changeset
   108
  for NAME in Isabelle isabelle
915c5de6480f smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents: 11127
diff changeset
   109
  do
915c5de6480f smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents: 11127
diff changeset
   110
    BIN="$BINDIR/$NAME"
915c5de6480f smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents: 11127
diff changeset
   111
    DIST="$DISTDIR/bin/$NAME"
915c5de6480f smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents: 11127
diff changeset
   112
    echo "installing $BIN"
915c5de6480f smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents: 11127
diff changeset
   113
    cp "$DIST" "$BIN" || fail "Cannot write file: $BIN"
915c5de6480f smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents: 11127
diff changeset
   114
    chmod +x "$BIN"
915c5de6480f smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents: 11127
diff changeset
   115
  done
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
   116
fi
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
   117
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
   118
11125
b70c3c1b499f handle KDE version 1 or 2;
wenzelm
parents: 10555
diff changeset
   119
# install KDE 1.x / 2.x application icon
5403
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
   120
11125
b70c3c1b499f handle KDE version 1 or 2;
wenzelm
parents: 10555
diff changeset
   121
if [ -n "$KDE" ]; then
b70c3c1b499f handle KDE version 1 or 2;
wenzelm
parents: 10555
diff changeset
   122
  if [ "$KDE" = 1 ]; then
b70c3c1b499f handle KDE version 1 or 2;
wenzelm
parents: 10555
diff changeset
   123
    KDEHOME=~/.kde
b70c3c1b499f handle KDE version 1 or 2;
wenzelm
parents: 10555
diff changeset
   124
    KDEDESKTOP=~/Desktop
b70c3c1b499f handle KDE version 1 or 2;
wenzelm
parents: 10555
diff changeset
   125
    KDEAPP="$KDEDESKTOP/Isabelle.kdelnk"
b70c3c1b499f handle KDE version 1 or 2;
wenzelm
parents: 10555
diff changeset
   126
  elif [ "$KDE" = 2 ]; then
b70c3c1b499f handle KDE version 1 or 2;
wenzelm
parents: 10555
diff changeset
   127
    KDEHOME=~/.kde2
b70c3c1b499f handle KDE version 1 or 2;
wenzelm
parents: 10555
diff changeset
   128
    KDEDESKTOP=~/KDesktop
b70c3c1b499f handle KDE version 1 or 2;
wenzelm
parents: 10555
diff changeset
   129
    KDEAPP="$KDEDESKTOP/Isabelle.desktop"
b70c3c1b499f handle KDE version 1 or 2;
wenzelm
parents: 10555
diff changeset
   130
  else
b70c3c1b499f handle KDE version 1 or 2;
wenzelm
parents: 10555
diff changeset
   131
    fail "Unknown KDE version \"$KDE\""
b70c3c1b499f handle KDE version 1 or 2;
wenzelm
parents: 10555
diff changeset
   132
  fi
11127
wenzelm
parents: 11125
diff changeset
   133
  mkdir -p "$KDEDESKTOP" || fail "Bad directory: $KDEDESKTOP"
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
   134
11125
b70c3c1b499f handle KDE version 1 or 2;
wenzelm
parents: 10555
diff changeset
   135
  KDEICONS="$KDEHOME/share/icons"
9788
wenzelm
parents: 7934
diff changeset
   136
  mkdir -p "$KDEICONS" || fail "Bad directory: $KDEICONS"
wenzelm
parents: 7934
diff changeset
   137
  mkdir -p "$KDEICONS/mini" || fail "Bad directory: $KDEICONS/mini"
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
   138
9788
wenzelm
parents: 7934
diff changeset
   139
  [ -f "$KDEICONS/isabelle.xpm" ] || cp "$ISABELLE_HOME/lib/icons/isabelle.xpm" "$KDEICONS" || \
6545
a8a235a8a4a3 improved icons;
wenzelm
parents: 6459
diff changeset
   140
    fail "Cannot write file: $KDEICONS/isabelle.xpm"
9788
wenzelm
parents: 7934
diff changeset
   141
  [ -f "$KDEICONS/mini/isabelle.xpm" ] || \
wenzelm
parents: 7934
diff changeset
   142
    cp "$ISABELLE_HOME/lib/icons/isabelle-mini.xpm" "$KDEICONS/mini/isabelle.xpm" || \
6545
a8a235a8a4a3 improved icons;
wenzelm
parents: 6459
diff changeset
   143
    fail "Cannot write file: $KDEICONS/mini/isabelle.xpm"
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
   144
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
   145
  echo "installing $KDEAPP"
9788
wenzelm
parents: 7934
diff changeset
   146
  echo "# KDE Config File" > "$KDEAPP" || fail "Cannot write file: $KDEAPP"
wenzelm
parents: 7934
diff changeset
   147
  echo "[KDE Desktop Entry]" >> "$KDEAPP"
wenzelm
parents: 7934
diff changeset
   148
  echo "Type=Application" >> "$KDEAPP"
11550
915c5de6480f smart selection of isabelle-process versus isabelle-interface;
wenzelm
parents: 11127
diff changeset
   149
  echo "Exec=\"$DISTDIR/bin/isabelle-interface\" %f" >> "$KDEAPP"
9788
wenzelm
parents: 7934
diff changeset
   150
  echo "Icon=isabelle.xpm" >> "$KDEAPP"
wenzelm
parents: 7934
diff changeset
   151
  echo "TerminalOptions=" >> "$KDEAPP"
wenzelm
parents: 7934
diff changeset
   152
  echo "Path=" >> "$KDEAPP"
wenzelm
parents: 7934
diff changeset
   153
  echo "Terminal=0" >> "$KDEAPP"
wenzelm
parents: 7934
diff changeset
   154
  echo "Name=Isabelle" >> "$KDEAPP"
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
   155
fi