lib/Tools/install
author wenzelm
Sat, 21 Mar 2009 20:00:23 +0100
changeset 30627 fb9e73c01603
parent 29143 72c960b2b83e
child 50132 180d086c30dd
permissions -rwxr-xr-x
added polyml_pp.ML: toplevel pretty printing for Poly/ML 4.x and 5.x before 5.3;
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
#
9788
wenzelm
parents: 7934
diff changeset
     3
# Author: Markus Wenzel, TU Muenchen
5362
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
     4
#
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
     5
# DESCRIPTION: install standalone Isabelle executables
5362
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
     6
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
     7
9788
wenzelm
parents: 7934
diff changeset
     8
PRG=$(basename "$0")
5362
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
     9
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    10
function usage()
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
  echo
28650
a7ba12e0d3b7 tuned usage line;
wenzelm
parents: 28504
diff changeset
    13
  echo "Usage: isabelle $PRG [OPTIONS]"
5362
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    14
  echo
5403
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    15
  echo "  Options are:"
7887
eedfff88ee40 tuned usage;
wenzelm
parents: 6545
diff changeset
    16
  echo "    -d DISTDIR   refer to DISTDIR as Isabelle distribution"
eedfff88ee40 tuned usage;
wenzelm
parents: 6545
diff changeset
    17
  echo "                 (default ISABELLE_HOME)"
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    18
  echo "    -p DIR       install standalone binaries in DIR"
5403
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    19
  echo
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    20
  echo "  Install Isabelle executables with absolute references to the current"
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    21
  echo "  distribution directory."
5362
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    22
  echo
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    23
  exit 1
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    24
}
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    25
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    26
function fail()
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
  echo "$1" >&2
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    29
  exit 2
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
5403
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    33
## process command line
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    34
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    35
# options
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    36
6450
990e6e2dee26 improved usage;
wenzelm
parents: 6417
diff changeset
    37
NO_OPTS=true
990e6e2dee26 improved usage;
wenzelm
parents: 6417
diff changeset
    38
5403
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    39
DISTDIR="$ISABELLE_HOME"
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    40
BINDIR=""
5362
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    41
16653
c12c2f411f77 isatool install: removed KDE option;
wenzelm
parents: 15856
diff changeset
    42
while getopts "d:p:" OPT
5403
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    43
do
15856
674ff97ce0ef removed -a option;
wenzelm
parents: 15848
diff changeset
    44
  NO_OPTS=""
5403
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    45
  case "$OPT" in
5404
wenzelm
parents: 5403
diff changeset
    46
    d)
5403
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    47
      DISTDIR="$OPTARG"
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    48
      ;;
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    49
    p)
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    50
      BINDIR="$OPTARG"
15733
75b9219980d3 Add RDISTDIR option used by Isabelle RPM.
aspinall
parents: 15574
diff changeset
    51
      ;;
5403
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    52
    \?)
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    53
      usage
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    54
      ;;
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    55
  esac
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    56
done
5362
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    57
5403
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    58
shift $(($OPTIND - 1))
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    59
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    60
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    61
# args
aa04ac8bfeae -d DISTDIR;
wenzelm
parents: 5398
diff changeset
    62
9788
wenzelm
parents: 7934
diff changeset
    63
[ "$#" -ne 0 -o -n "$NO_OPTS" ] && usage
5362
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    64
15848
3001067227af restored AUTO_BASH/PERL -- beware of ./configure!
wenzelm
parents: 15733
diff changeset
    65
5362
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    66
## main
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    67
6459
1d13a86bfa6c fixed ISABELLE_HOME/lib/logo/isabelle-tiny.xpm;
wenzelm
parents: 6450
diff changeset
    68
echo "referring to distribution at $DISTDIR"
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    69
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    70
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    71
# standalone binaries
5362
29ce4f1fe72c install binaries with absolute references to ISABELLE_HOME/bin;
wenzelm
parents:
diff changeset
    72
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    73
if [ -n "$BINDIR" ]; then
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    74
  mkdir -p "$BINDIR" || fail "Bad directory: $BINDIR"
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    75
28915
0642cbb60c98 removed obsolete isabelle-interface executable and ISABELLE_INTERFACE setting;
wenzelm
parents: 28650
diff changeset
    76
  for NAME in isabelle isabelle-process
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    77
  do
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    78
    BIN="$BINDIR/$NAME"
15856
674ff97ce0ef removed -a option;
wenzelm
parents: 15848
diff changeset
    79
    DIST="$DISTDIR/bin/$NAME"
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    80
    echo "installing $BIN"
15848
3001067227af restored AUTO_BASH/PERL -- beware of ./configure!
wenzelm
parents: 15733
diff changeset
    81
    rm -f "$BIN"
26577
50f47cc2af72 removed obsolete AUTO_BASH feature;
wenzelm
parents: 16653
diff changeset
    82
    echo "#!/usr/bin/env bash" > "$BIN" || fail "Cannot write file: $BIN"
9788
wenzelm
parents: 7934
diff changeset
    83
    echo >> "$BIN"
wenzelm
parents: 7934
diff changeset
    84
    echo "exec \"$DIST\" \"\$@\"" >> "$BIN"
wenzelm
parents: 7934
diff changeset
    85
    chmod +x "$BIN"
6417
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    86
  done
39941b906910 -p option;
wenzelm
parents: 6082
diff changeset
    87
fi