| author | haftmann | 
| Sat, 03 Mar 2007 09:27:02 +0100 | |
| changeset 22401 | 51997956e7d1 | 
| parent 16653 | c12c2f411f77 | 
| child 26577 | 50f47cc2af72 | 
| 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)" | |
| 6417 | 19 | echo " -p DIR install standalone binaries in DIR" | 
| 5403 | 20 | echo | 
| 6417 | 21 | echo " Install Isabelle executables with absolute references to the current" | 
| 22 | echo " distribution directory." | |
| 5362 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 23 | echo | 
| 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 24 | exit 1 | 
| 
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 | |
| 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 27 | function fail() | 
| 
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 | echo "$1" >&2 | 
| 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 30 | exit 2 | 
| 
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 | |
| 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 33 | |
| 5403 | 34 | ## process command line | 
| 35 | ||
| 36 | # options | |
| 37 | ||
| 6450 | 38 | NO_OPTS=true | 
| 39 | ||
| 5403 | 40 | DISTDIR="$ISABELLE_HOME" | 
| 6417 | 41 | BINDIR="" | 
| 5362 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 42 | |
| 16653 | 43 | while getopts "d:p:" OPT | 
| 5403 | 44 | do | 
| 15856 | 45 | NO_OPTS="" | 
| 5403 | 46 | case "$OPT" in | 
| 5404 | 47 | d) | 
| 5403 | 48 | DISTDIR="$OPTARG" | 
| 49 | ;; | |
| 6417 | 50 | p) | 
| 51 | BINDIR="$OPTARG" | |
| 15733 | 52 | ;; | 
| 5403 | 53 | \?) | 
| 54 | usage | |
| 55 | ;; | |
| 56 | esac | |
| 57 | done | |
| 5362 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 58 | |
| 5403 | 59 | shift $(($OPTIND - 1)) | 
| 60 | ||
| 61 | ||
| 62 | # args | |
| 63 | ||
| 9788 | 64 | [ "$#" -ne 0 -o -n "$NO_OPTS" ] && usage | 
| 5362 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 65 | |
| 15848 
3001067227af
restored AUTO_BASH/PERL -- beware of ./configure!
 wenzelm parents: 
15733diff
changeset | 66 | |
| 5362 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 67 | ## main | 
| 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 68 | |
| 6459 | 69 | echo "referring to distribution at $DISTDIR" | 
| 6417 | 70 | |
| 71 | ||
| 72 | # standalone binaries | |
| 5362 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 73 | |
| 6082 | 74 | #set by configure | 
| 15848 
3001067227af
restored AUTO_BASH/PERL -- beware of ./configure!
 wenzelm parents: 
15733diff
changeset | 75 | AUTO_BASH=bash | 
| 10555 | 76 | |
| 77 | case "$AUTO_BASH" in | |
| 78 | /*) | |
| 79 | BASH="$AUTO_BASH" | |
| 80 | ;; | |
| 81 | *) | |
| 82 | BASH="/usr/bin/env bash" | |
| 83 | ;; | |
| 84 | esac | |
| 5362 
29ce4f1fe72c
install binaries with absolute references to ISABELLE_HOME/bin;
 wenzelm parents: diff
changeset | 85 | |
| 6417 | 86 | if [ -n "$BINDIR" ]; then | 
| 87 | mkdir -p "$BINDIR" || fail "Bad directory: $BINDIR" | |
| 88 | ||
| 11550 
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
 wenzelm parents: 
11127diff
changeset | 89 | for NAME in isatool isabelle-process isabelle-interface | 
| 6417 | 90 | do | 
| 91 | BIN="$BINDIR/$NAME" | |
| 15856 | 92 | DIST="$DISTDIR/bin/$NAME" | 
| 6417 | 93 | echo "installing $BIN" | 
| 15848 
3001067227af
restored AUTO_BASH/PERL -- beware of ./configure!
 wenzelm parents: 
15733diff
changeset | 94 | rm -f "$BIN" | 
| 10555 | 95 | echo "#!$BASH" > "$BIN" || fail "Cannot write file: $BIN" | 
| 9788 | 96 | echo >> "$BIN" | 
| 97 | echo "exec \"$DIST\" \"\$@\"" >> "$BIN" | |
| 98 | chmod +x "$BIN" | |
| 6417 | 99 | done | 
| 11550 
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
 wenzelm parents: 
11127diff
changeset | 100 | for NAME in Isabelle isabelle | 
| 
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
 wenzelm parents: 
11127diff
changeset | 101 | do | 
| 
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
 wenzelm parents: 
11127diff
changeset | 102 | BIN="$BINDIR/$NAME" | 
| 
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
 wenzelm parents: 
11127diff
changeset | 103 | echo "installing $BIN" | 
| 15848 
3001067227af
restored AUTO_BASH/PERL -- beware of ./configure!
 wenzelm parents: 
15733diff
changeset | 104 | rm -f "$BIN" | 
| 15856 | 105 | cp "$ISABELLE_HOME/bin/$NAME" "$BIN" || fail "Cannot write file: $BIN" | 
| 11550 
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
 wenzelm parents: 
11127diff
changeset | 106 | chmod +x "$BIN" | 
| 
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
 wenzelm parents: 
11127diff
changeset | 107 | done | 
| 6417 | 108 | fi |