author | wenzelm |
Wed, 08 Jun 2011 21:29:49 +0200 | |
changeset 43285 | 966f359dc724 |
parent 43280 | e5dd0ae1b054 |
child 43320 | 657635e0445a |
permissions | -rwxr-xr-x |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
1 |
#!/usr/bin/env bash |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
2 |
# |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
3 |
# Author: Makarius |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
4 |
# |
42899 | 5 |
# build-jars - build Isabelle/Scala |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
6 |
# |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
7 |
# Requires proper Isabelle settings environment. |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
8 |
|
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
9 |
|
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
10 |
## diagnostics |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
11 |
|
43280 | 12 |
PRG="$(basename "$0")" |
13 |
||
14 |
function usage() |
|
15 |
{ |
|
16 |
echo |
|
17 |
echo "Usage: isabelle $PRG [OPTIONS]" |
|
18 |
echo |
|
19 |
echo " Options are:" |
|
20 |
echo " -f fresh build" |
|
21 |
echo |
|
22 |
exit 1 |
|
23 |
} |
|
24 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
25 |
function fail() |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
26 |
{ |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
27 |
echo "$1" >&2 |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
28 |
exit 2 |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
29 |
} |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
30 |
|
42899 | 31 |
[ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment" |
37174
6feaab4fc27d
assume given SCALA_HOME, e.g. from component settings or external setup;
wenzelm
parents:
37044
diff
changeset
|
32 |
[ -z "$SCALA_HOME" ] && fail "Unknown SCALA_HOME -- Scala unavailable" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
33 |
|
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
34 |
|
43280 | 35 |
## process command line |
36 |
||
37 |
# options |
|
38 |
||
39 |
FRESH="" |
|
40 |
||
41 |
while getopts "f" OPT |
|
42 |
do |
|
43 |
case "$OPT" in |
|
44 |
f) |
|
45 |
FRESH=true |
|
46 |
;; |
|
47 |
\?) |
|
48 |
usage |
|
49 |
;; |
|
50 |
esac |
|
51 |
done |
|
52 |
||
53 |
shift $(($OPTIND - 1)) |
|
54 |
||
55 |
||
56 |
# args |
|
57 |
||
58 |
[ "$#" -ne 0 ] && usage |
|
59 |
||
60 |
||
61 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
62 |
## dependencies |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
63 |
|
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
64 |
declare -a SOURCES=( |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
65 |
Concurrent/future.scala |
38636
b7647ca7de5a
module for simplified thread operations (Scala version);
wenzelm
parents:
38567
diff
changeset
|
66 |
Concurrent/simple_thread.scala |
38840 | 67 |
Concurrent/volatile.scala |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
68 |
General/exn.scala |
40393 | 69 |
General/timing.scala |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
70 |
General/linear_set.scala |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
71 |
General/markup.scala |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
72 |
General/position.scala |
36683 | 73 |
General/pretty.scala |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
74 |
General/scan.scala |
38473
bd96f2a5beb0
digesting strings according to SHA-1 -- Scala version;
wenzelm
parents:
38429
diff
changeset
|
75 |
General/sha1.scala |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
76 |
General/symbol.scala |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
77 |
General/xml.scala |
38267
e50c283dd125
type XML.Body as basic data representation language (Scala version);
wenzelm
parents:
38227
diff
changeset
|
78 |
General/xml_data.scala |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
79 |
General/yxml.scala |
36947 | 80 |
Isar/keyword.scala |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
81 |
Isar/outer_syntax.scala |
36948 | 82 |
Isar/parse.scala |
36956
21be4832c362
renamed class Outer_Lex to Token and Token_Kind to Token.Kind;
wenzelm
parents:
36948
diff
changeset
|
83 |
Isar/token.scala |
36676 | 84 |
PIDE/command.scala |
85 |
PIDE/document.scala |
|
38483 | 86 |
PIDE/isar_document.scala |
38479
e628da370072
more efficient Markup_Tree, based on branches sorted by quasi-order;
wenzelm
parents:
38473
diff
changeset
|
87 |
PIDE/markup_tree.scala |
38425 | 88 |
PIDE/text.scala |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
89 |
System/cygwin.scala |
36676 | 90 |
System/download.scala |
38428
c13c95c97e89
event_bus.scala rather belongs to system plumbing;
wenzelm
parents:
38425
diff
changeset
|
91 |
System/event_bus.scala |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
92 |
System/gui_setup.scala |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
93 |
System/isabelle_process.scala |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
94 |
System/isabelle_syntax.scala |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
95 |
System/isabelle_system.scala |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
96 |
System/platform.scala |
34871
e596a0b71f3c
incorporate "proofdocument" part into main Isabelle/Pure.jar -- except for html_panel.scala, which depends on external library (Lobo/Cobra browser);
wenzelm
parents:
34284
diff
changeset
|
97 |
System/session.scala |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
98 |
System/session_manager.scala |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
99 |
System/standard_system.scala |
36676 | 100 |
System/swing_thread.scala |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
101 |
Thy/completion.scala |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
102 |
Thy/html.scala |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
103 |
Thy/thy_header.scala |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
104 |
Thy/thy_syntax.scala |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
105 |
library.scala |
42720
caa4f1279154
added toplevel isabelle package -- reduce warnings with scala-2.9.0.final;
wenzelm
parents:
40393
diff
changeset
|
106 |
package.scala |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
107 |
) |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
108 |
|
34284 | 109 |
TARGET_DIR="$ISABELLE_HOME/lib/classes" |
110 |
PURE_JAR="$TARGET_DIR/Pure.jar" |
|
111 |
FULL_JAR="$TARGET_DIR/isabelle-scala.jar" |
|
112 |
||
113 |
declare -a TARGETS=("$PURE_JAR" "$FULL_JAR") |
|
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
114 |
|
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
115 |
|
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
116 |
## main |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
117 |
|
43280 | 118 |
if [ -n "$FRESH" ]; then |
119 |
OUTDATED=true |
|
120 |
else |
|
121 |
OUTDATED=false |
|
122 |
for SOURCE in "${SOURCES[@]}" |
|
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
123 |
do |
43280 | 124 |
[ ! -e "$SOURCE" ] && fail "Missing source file: $SOURCE" |
125 |
for TARGET in "${TARGETS[@]}" |
|
126 |
do |
|
127 |
[ ! -e "$TARGET" -o "$SOURCE" -nt "$TARGET" ] && OUTDATED=true |
|
128 |
done |
|
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
129 |
done |
43280 | 130 |
fi |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
131 |
|
34284 | 132 |
if [ "$OUTDATED" = true ] |
133 |
then |
|
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
134 |
echo "###" |
34876 | 135 |
echo "### Building Isabelle/Scala layer ..." |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
136 |
echo "###" |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
137 |
|
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
138 |
rm -rf classes && mkdir classes |
36011
3ff725ac13a4
adapted to Scala 2.8.0 Beta1 -- with notable changes to scala.collection;
wenzelm
parents:
34876
diff
changeset
|
139 |
"$SCALA_HOME/bin/scalac" -unchecked -deprecation -d classes -target:jvm-1.5 "${SOURCES[@]}" || \ |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
140 |
fail "Failed to compile sources" |
34284 | 141 |
mkdir -p "$TARGET_DIR" || fail "Failed to create directory $TARGET_DIR" |
43280 | 142 |
|
43285 | 143 |
pushd classes >/dev/null |
43280 | 144 |
|
145 |
jar cfe "$(jvmpath "$PURE_JAR")" isabelle.GUI_Setup isabelle || \ |
|
146 |
fail "Failed to produce $PURE_JAR" |
|
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
147 |
|
43280 | 148 |
cp "$SCALA_HOME/lib/scala-swing.jar" . |
149 |
jar xf scala-swing.jar |
|
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
150 |
|
43280 | 151 |
cp "$SCALA_HOME/lib/scala-library.jar" "$FULL_JAR" |
152 |
jar ufe "$(jvmpath "$FULL_JAR")" isabelle.GUI_Setup isabelle scala || \ |
|
153 |
fail "Failed to produce $FULL_JAR" |
|
154 |
||
155 |
popd >/dev/null |
|
156 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
157 |
rm -rf classes |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
158 |
fi |