lib/Tools/install
author wenzelm
Fri Jul 01 14:41:57 2005 +0200 (2005-07-01)
changeset 16653 c12c2f411f77
parent 15856 674ff97ce0ef
child 26577 50f47cc2af72
permissions -rwxr-xr-x
isatool install: removed KDE option;
     1 #!/usr/bin/env bash
     2 #
     3 # $Id$
     4 # Author: Markus Wenzel, TU Muenchen
     5 #
     6 # DESCRIPTION: install standalone Isabelle executables
     7 
     8 
     9 PRG=$(basename "$0")
    10 
    11 function usage()
    12 {
    13   echo
    14   echo "Usage: $PRG [OPTIONS]"
    15   echo
    16   echo "  Options are:"
    17   echo "    -d DISTDIR   refer to DISTDIR as Isabelle distribution"
    18   echo "                 (default ISABELLE_HOME)"
    19   echo "    -p DIR       install standalone binaries in DIR"
    20   echo
    21   echo "  Install Isabelle executables with absolute references to the current"
    22   echo "  distribution directory."
    23   echo
    24   exit 1
    25 }
    26 
    27 function fail()
    28 {
    29   echo "$1" >&2
    30   exit 2
    31 }
    32 
    33 
    34 ## process command line
    35 
    36 # options
    37 
    38 NO_OPTS=true
    39 
    40 DISTDIR="$ISABELLE_HOME"
    41 BINDIR=""
    42 
    43 while getopts "d:p:" OPT
    44 do
    45   NO_OPTS=""
    46   case "$OPT" in
    47     d)
    48       DISTDIR="$OPTARG"
    49       ;;
    50     p)
    51       BINDIR="$OPTARG"
    52       ;;
    53     \?)
    54       usage
    55       ;;
    56   esac
    57 done
    58 
    59 shift $(($OPTIND - 1))
    60 
    61 
    62 # args
    63 
    64 [ "$#" -ne 0 -o -n "$NO_OPTS" ] && usage
    65 
    66 
    67 ## main
    68 
    69 echo "referring to distribution at $DISTDIR"
    70 
    71 
    72 # standalone binaries
    73 
    74 #set by configure
    75 AUTO_BASH=bash
    76 
    77 case "$AUTO_BASH" in
    78   /*)
    79     BASH="$AUTO_BASH"
    80     ;;
    81   *)
    82     BASH="/usr/bin/env bash"
    83     ;;
    84 esac
    85 
    86 if [ -n "$BINDIR" ]; then
    87   mkdir -p "$BINDIR" || fail "Bad directory: $BINDIR"
    88 
    89   for NAME in isatool isabelle-process isabelle-interface
    90   do
    91     BIN="$BINDIR/$NAME"
    92     DIST="$DISTDIR/bin/$NAME"
    93     echo "installing $BIN"
    94     rm -f "$BIN"
    95     echo "#!$BASH" > "$BIN" || fail "Cannot write file: $BIN"
    96     echo >> "$BIN"
    97     echo "exec \"$DIST\" \"\$@\"" >> "$BIN"
    98     chmod +x "$BIN"
    99   done
   100   for NAME in Isabelle isabelle
   101   do
   102     BIN="$BINDIR/$NAME"
   103     echo "installing $BIN"
   104     rm -f "$BIN"
   105     cp "$ISABELLE_HOME/bin/$NAME" "$BIN" || fail "Cannot write file: $BIN"
   106     chmod +x "$BIN"
   107   done
   108 fi