author | huffman |
Sun, 09 Oct 2011 11:13:53 +0200 | |
changeset 45122 | 49e305100097 |
parent 22488 | 415098eece94 |
permissions | -rwxr-xr-x |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
1 |
#!/bin/sh |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
2 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
3 |
# Create AnnoMaLy documentation for Isabelle |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
4 |
# See http://martin.von-gagern.net/projects/annomaly/ |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
5 |
# 2007 Martin von Gagern (martin@von-gagern.net) |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
6 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
7 |
# Abort on any error |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
8 |
set -e -o pipefail |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
9 |
|
22488
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
10 |
BUILD_DIR="$HOME/isabelle.annomaly" |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
11 |
ISABELLE_HOME="$BUILD_DIR/Isabelle" |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
12 |
ISABELLE_CVS="$HOME/isabelle.cvs" |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
13 |
ADMIN_CVS="$ISABELLE_CVS/Admin" |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
14 |
# ISABELLE_HOME="$ISABELLE_CVS/Distribution" |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
15 |
ISABELLE_SRC="$ISABELLE_HOME/src" |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
16 |
HTML_DIR="$HOME/html-data/isabelle-doc" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
17 |
export CVS_RSH=ssh |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
18 |
export SMLNJ_HOME="$HOME/annomaly" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
19 |
export PATH="$SMLNJ_HOME/bin:$PATH" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
20 |
export SML_DOC_DIR="$HTML_DIR.tmp" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
21 |
# export SML_DOC_DEBUG="all" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
22 |
TARGET=HOL |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
23 |
CVSUP=true |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
24 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
25 |
# Parse command line |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
26 |
for ARG in "$@"; do case "$ARG" in |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
27 |
-p) TARGET=Pure ;; |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
28 |
-n) CVSUP=false ;; |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
29 |
-l) export SML_LOG_DIR="$HOME/logs" ;; |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
30 |
esac; done |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
31 |
|
22488
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
32 |
# Update CVS |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
33 |
cd "$ADMIN_CVS" |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
34 |
if $CVSUP; then |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
35 |
echo "Updating CVS" |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
36 |
cvs -q up -d |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
37 |
fi |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
38 |
|
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
39 |
# Find nightly isabelle tarball |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
40 |
ISABELLE_TAR="" |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
41 |
for i in /home/html/isatest/Isabelle_[0-9]*-20[0-9][0-9].tar.gz; do |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
42 |
if [[ -r "$i" ]]; then ISABELLE_TAR="$i"; fi |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
43 |
done |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
44 |
if [[ -z $ISABELLE_TAR ]]; then |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
45 |
echo "No isabelle tarball found!" >&2 |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
46 |
exit 1 |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
47 |
fi |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
48 |
|
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
49 |
# Create build environemnt |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
50 |
mkdir -p "$BUILD_DIR" |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
51 |
cd "$BUILD_DIR" |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
52 |
if [[ -d Isabelle ]]; then |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
53 |
rm -rf * |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
54 |
fi |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
55 |
tar xzf "$ISABELLE_TAR" |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
56 |
cd "$ISABELLE_HOME" |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
57 |
cp "$ADMIN_CVS"/isatest/annomaly.ML src/Pure/ML-Systems/annomaly.ML |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
58 |
ln -s run-smlnj lib/scripts/run-annomaly |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
59 |
|
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
60 |
# Create clean output directory |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
61 |
rm -rf "$SML_DOC_DIR" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
62 |
mkdir "$SML_DOC_DIR" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
63 |
cp "$SMLNJ_HOME/annomaly/resources/"* "$SML_DOC_DIR" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
64 |
cat > "$SML_DOC_DIR/.htaccess" <<EOF |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
65 |
DirectoryIndex index.html source.html |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
66 |
<IfModule mod_deflate> |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
67 |
SetOutputFilter DEFLATE |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
68 |
</IfModule> |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
69 |
AddType text/plain .dot |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
70 |
EOF |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
71 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
72 |
# Build isabelle |
22488
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
73 |
ISABELLE_HOME="$(cd "$ISABELLE_HOME"; pwd -P)" |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
74 |
cd "$ISABELLE_HOME" |
22488
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
75 |
export SML_DOC_REWRITE="isabelle=$(cd src; pwd -P)" |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
76 |
rm -rf heaps |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
77 |
./build -b $TARGET |
22488
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
78 |
cd "$BUILD_DIR" |
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
79 |
rm -rf * |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
80 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
81 |
# Postprocess created files |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
82 |
cd $SML_DOC_DIR |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
83 |
dot -Tsvg depGraph.dot \ |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
84 |
| perl -pe 's/(width|height)="(\d+)/sprintf("%s=\"%.2f",$1,$2*0.6)/ge' \ |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
85 |
> depGraph.svg |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
86 |
dot -Tps2 depGraph.dot > depGraph.ps |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
87 |
ps2pdf depGraph.ps depGraph.pdf |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
88 |
grep -rl "$ISABELLE_HOME" . | xargs sed -i "s@$ISABELLE_HOME@\$ISABELLE_HOME@g" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
89 |
|
22488
415098eece94
Changed AnnoMaLy build process from CVS to tarball sources.
gagern
parents:
22410
diff
changeset
|
90 |
# Install result by renaming, to be almost atomic |
22410
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
91 |
rm -rf "$HTML_DIR.bac" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
92 |
if [[ -d $HTML_DIR ]]; then mv "$HTML_DIR" "$HTML_DIR.bac"; fi |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
93 |
mv "$SML_DOC_DIR" "$HTML_DIR" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
94 |
rm -rf "$HTML_DIR.bac" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
95 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
96 |
# Done |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
97 |
echo "Completed successfully" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
98 |
exit 0 |