equal
deleted
inserted
replaced
8 PRG=$(basename "$0") |
8 PRG=$(basename "$0") |
9 |
9 |
10 function usage() |
10 function usage() |
11 { |
11 { |
12 echo |
12 echo |
13 echo "Usage: isabelle $PRG [OPTIONS]" |
13 echo "Usage: isabelle $PRG [OPTIONS] BINDIR" |
14 echo |
14 echo |
15 echo " Options are:" |
15 echo " Options are:" |
16 echo " -d DISTDIR refer to DISTDIR as Isabelle distribution" |
16 echo " -d DISTDIR refer to DISTDIR as Isabelle distribution" |
17 echo " (default ISABELLE_HOME)" |
17 echo " (default ISABELLE_HOME)" |
18 echo " -p DIR install standalone binaries in DIR" |
|
19 echo |
18 echo |
20 echo " Install Isabelle executables with absolute references to the current" |
19 echo " Install Isabelle executables with absolute references to the" |
21 echo " distribution directory." |
20 echo " distribution directory." |
22 echo |
21 echo |
23 exit 1 |
22 exit 1 |
24 } |
23 } |
25 |
24 |
32 |
31 |
33 ## process command line |
32 ## process command line |
34 |
33 |
35 # options |
34 # options |
36 |
35 |
37 NO_OPTS=true |
|
38 |
|
39 DISTDIR="$ISABELLE_HOME" |
36 DISTDIR="$ISABELLE_HOME" |
40 BINDIR="" |
37 BINDIR="" |
41 |
38 |
42 while getopts "d:p:" OPT |
39 while getopts "d:" OPT |
43 do |
40 do |
44 NO_OPTS="" |
|
45 case "$OPT" in |
41 case "$OPT" in |
46 d) |
42 d) |
47 DISTDIR="$OPTARG" |
43 DISTDIR="$OPTARG" |
48 ;; |
|
49 p) |
|
50 BINDIR="$OPTARG" |
|
51 ;; |
44 ;; |
52 \?) |
45 \?) |
53 usage |
46 usage |
54 ;; |
47 ;; |
55 esac |
48 esac |
58 shift $(($OPTIND - 1)) |
51 shift $(($OPTIND - 1)) |
59 |
52 |
60 |
53 |
61 # args |
54 # args |
62 |
55 |
63 [ "$#" -ne 0 -o -n "$NO_OPTS" ] && usage |
56 [ "$#" -ge 1 ] && { BINDIR="$1"; shift; } |
|
57 [ "$#" -ne 0 -o -z "$BINDIR" ] && usage |
64 |
58 |
65 |
59 |
66 ## main |
60 ## main |
67 |
61 |
68 echo "referring to distribution at $DISTDIR" |
62 echo "referring to distribution at \"$DISTDIR\"" |
69 |
63 |
|
64 mkdir -p "$BINDIR" || fail "Bad directory: \"$BINDIR\"" |
70 |
65 |
71 # standalone binaries |
66 for NAME in isabelle isabelle-process |
|
67 do |
|
68 BIN="$BINDIR/$NAME" |
|
69 DIST="$DISTDIR/bin/$NAME" |
|
70 echo "installing $BIN" |
|
71 rm -f "$BIN" |
|
72 echo "#!/usr/bin/env bash" > "$BIN" || fail "Cannot write file: $BIN" |
|
73 echo >> "$BIN" |
|
74 echo "exec \"$DIST\" \"\$@\"" >> "$BIN" |
|
75 chmod +x "$BIN" |
|
76 done |
72 |
77 |
73 if [ -n "$BINDIR" ]; then |
|
74 mkdir -p "$BINDIR" || fail "Bad directory: $BINDIR" |
|
75 |
|
76 for NAME in isabelle isabelle-process |
|
77 do |
|
78 BIN="$BINDIR/$NAME" |
|
79 DIST="$DISTDIR/bin/$NAME" |
|
80 echo "installing $BIN" |
|
81 rm -f "$BIN" |
|
82 echo "#!/usr/bin/env bash" > "$BIN" || fail "Cannot write file: $BIN" |
|
83 echo >> "$BIN" |
|
84 echo "exec \"$DIST\" \"\$@\"" >> "$BIN" |
|
85 chmod +x "$BIN" |
|
86 done |
|
87 fi |
|