lib/Tools/install
author wenzelm
Tue Apr 13 12:36:11 1999 +0200 (1999-04-13)
changeset 6417 39941b906910
parent 6082 590f9e3bf4d8
child 6450 990e6e2dee26
permissions -rwxr-xr-x
-p option;
-k option;
wenzelm@5362
     1
#!/bin/bash
wenzelm@5362
     2
#
wenzelm@5362
     3
# $Id$
wenzelm@5362
     4
#
wenzelm@6417
     5
# DESCRIPTION: install standalone Isabelle executables
wenzelm@5362
     6
wenzelm@5362
     7
wenzelm@5362
     8
PRG=$(basename $0)
wenzelm@5362
     9
wenzelm@5362
    10
function usage()
wenzelm@5362
    11
{
wenzelm@5362
    12
  echo
wenzelm@6417
    13
  echo "Usage: $PRG [OPTIONS]"
wenzelm@5362
    14
  echo
wenzelm@5403
    15
  echo "  Options are:"
wenzelm@5403
    16
  echo "    -d DISTDIR   use DISTDIR as Isabelle distribution (default ISABELLE_HOME)"
wenzelm@6417
    17
  echo "    -k           install KDE application icon on Desktop"
wenzelm@6417
    18
  echo "    -p DIR       install standalone binaries in DIR"
wenzelm@5403
    19
  echo
wenzelm@6417
    20
  echo "  Install Isabelle executables with absolute references to the current"
wenzelm@6417
    21
  echo "  distribution directory."
wenzelm@5362
    22
  echo
wenzelm@5362
    23
  exit 1
wenzelm@5362
    24
}
wenzelm@5362
    25
wenzelm@5362
    26
function fail()
wenzelm@5362
    27
{
wenzelm@5362
    28
  echo "$1" >&2
wenzelm@5362
    29
  exit 2
wenzelm@5362
    30
}
wenzelm@5362
    31
wenzelm@5362
    32
wenzelm@5403
    33
## process command line
wenzelm@5403
    34
wenzelm@5403
    35
# options
wenzelm@5403
    36
wenzelm@5403
    37
DISTDIR="$ISABELLE_HOME"
wenzelm@6417
    38
KDE=""
wenzelm@6417
    39
BINDIR=""
wenzelm@5362
    40
wenzelm@6417
    41
while getopts "d:kp:" OPT
wenzelm@5403
    42
do
wenzelm@5403
    43
  case "$OPT" in
wenzelm@5404
    44
    d)
wenzelm@5403
    45
      DISTDIR="$OPTARG"
wenzelm@5403
    46
      ;;
wenzelm@6417
    47
    k)
wenzelm@6417
    48
      KDE=true
wenzelm@6417
    49
      ;;
wenzelm@6417
    50
    p)
wenzelm@6417
    51
      BINDIR="$OPTARG"
wenzelm@6417
    52
      ;;
wenzelm@5403
    53
    \?)
wenzelm@5403
    54
      usage
wenzelm@5403
    55
      ;;
wenzelm@5403
    56
  esac
wenzelm@5403
    57
done
wenzelm@5362
    58
wenzelm@5403
    59
shift $(($OPTIND - 1))
wenzelm@5403
    60
wenzelm@5403
    61
wenzelm@5403
    62
# args
wenzelm@5403
    63
wenzelm@6417
    64
[ $# -ne 0 ] && usage
wenzelm@5362
    65
wenzelm@5362
    66
wenzelm@5362
    67
## main
wenzelm@5362
    68
wenzelm@6417
    69
echo "distribution at $DISTDIR"
wenzelm@6417
    70
wenzelm@6417
    71
wenzelm@6417
    72
# standalone binaries
wenzelm@5362
    73
wenzelm@6082
    74
#set by configure
wenzelm@6082
    75
AUTO_BASH=/bin/bash
wenzelm@5362
    76
wenzelm@6417
    77
if [ -n "$BINDIR" ]; then
wenzelm@6417
    78
  mkdir -p "$BINDIR" || fail "Bad directory: $BINDIR"
wenzelm@6417
    79
wenzelm@6417
    80
  for NAME in isatool isabelle Isabelle
wenzelm@6417
    81
  do
wenzelm@6417
    82
    BIN="$BINDIR/$NAME"
wenzelm@6417
    83
    DIST="$DISTDIR/bin/$NAME"
wenzelm@6417
    84
    echo "installing $BIN"
wenzelm@6417
    85
    echo "#!$AUTO_BASH" >$BIN || fail "Cannot write file: $BIN"
wenzelm@6417
    86
    echo >>$BIN
wenzelm@6417
    87
    echo "exec $DIST \"\$@\"" >>$BIN
wenzelm@6417
    88
    chmod +x $BIN
wenzelm@6417
    89
  done
wenzelm@6417
    90
fi
wenzelm@6417
    91
wenzelm@6417
    92
wenzelm@6417
    93
# install KDE application icon
wenzelm@5403
    94
wenzelm@6417
    95
KDEHOME=~/.kde
wenzelm@6417
    96
KDEAPP=~/Desktop/Isabelle.kdelnk
wenzelm@6417
    97
wenzelm@6417
    98
if [ "$KDE" = true ]; then
wenzelm@6417
    99
  mkdir -p $KDEHOME/share/icons || fail "Bad directory: $KDEHOME/share/icons"
wenzelm@6417
   100
wenzelm@6417
   101
  ICON=$KDEHOME/share/icons/isabelle.xpm
wenzelm@6417
   102
  [ -f $ICON ] || cp $DISTDIR/lib/logo/isabelle-tiny.xpm $ICON || fail "Cannot write file: $ICON"
wenzelm@6417
   103
wenzelm@6417
   104
  echo "installing $KDEAPP"
wenzelm@6417
   105
  echo "# KDE Config File" >$KDEAPP || fail "Cannot write file: $KDEAPP"
wenzelm@6417
   106
  echo "[KDE Desktop Entry]" >>$KDEAPP
wenzelm@6417
   107
  echo "Type=Application" >>$KDEAPP
wenzelm@6417
   108
  echo "Exec=$DISTDIR/bin/Isabelle" >>$KDEAPP
wenzelm@6417
   109
  echo "Icon=isabelle.xpm" >>$KDEAPP
wenzelm@6417
   110
  echo "TerminalOptions=" >>$KDEAPP
wenzelm@6417
   111
  echo "Path=" >>$KDEAPP
wenzelm@6417
   112
  echo "Terminal=0" >>$KDEAPP
wenzelm@6417
   113
  echo "Name=Isabelle" >>$KDEAPP
wenzelm@6417
   114
wenzelm@6417
   115
  type -p kfmclient >/dev/null && kfmclient refreshDesktop
wenzelm@6417
   116
fi