| author | huffman | 
| Tue, 01 Jul 2008 03:14:00 +0200 | |
| changeset 27416 | 07e04ab0177a | 
| parent 26577 | 50f47cc2af72 | 
| child 28504 | 7ad7d7d6df47 | 
| 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 | |
| 6417 | 74 | if [ -n "$BINDIR" ]; then | 
| 75 | mkdir -p "$BINDIR" || fail "Bad directory: $BINDIR" | |
| 76 | ||
| 11550 
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
 wenzelm parents: 
11127diff
changeset | 77 | for NAME in isatool isabelle-process isabelle-interface | 
| 6417 | 78 | do | 
| 79 | BIN="$BINDIR/$NAME" | |
| 15856 | 80 | DIST="$DISTDIR/bin/$NAME" | 
| 6417 | 81 | echo "installing $BIN" | 
| 15848 
3001067227af
restored AUTO_BASH/PERL -- beware of ./configure!
 wenzelm parents: 
15733diff
changeset | 82 | rm -f "$BIN" | 
| 26577 | 83 | echo "#!/usr/bin/env bash" > "$BIN" || fail "Cannot write file: $BIN" | 
| 9788 | 84 | echo >> "$BIN" | 
| 85 | echo "exec \"$DIST\" \"\$@\"" >> "$BIN" | |
| 86 | chmod +x "$BIN" | |
| 6417 | 87 | done | 
| 11550 
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
 wenzelm parents: 
11127diff
changeset | 88 | for NAME in Isabelle isabelle | 
| 
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
 wenzelm parents: 
11127diff
changeset | 89 | do | 
| 
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
 wenzelm parents: 
11127diff
changeset | 90 | BIN="$BINDIR/$NAME" | 
| 
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
 wenzelm parents: 
11127diff
changeset | 91 | echo "installing $BIN" | 
| 15848 
3001067227af
restored AUTO_BASH/PERL -- beware of ./configure!
 wenzelm parents: 
15733diff
changeset | 92 | rm -f "$BIN" | 
| 15856 | 93 | 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 | 94 | chmod +x "$BIN" | 
| 
915c5de6480f
smart selection of isabelle-process versus isabelle-interface;
 wenzelm parents: 
11127diff
changeset | 95 | done | 
| 6417 | 96 | fi |