author | kleing |
Mon, 05 Mar 2007 22:12:20 +0100 | |
changeset 22410 | da313b67a04d |
child 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 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
10 |
ISABELLE_CVS="$(cd "$HOME/isabelle.cvs"; pwd -P)" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
11 |
ISABELLE_HOME="$ISABELLE_CVS/Distribution" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
12 |
HTML_DIR="$HOME/html-data/isabelle-doc" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
13 |
export CVS_RSH=ssh |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
14 |
export SMLNJ_HOME="$HOME/annomaly" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
15 |
export PATH="$SMLNJ_HOME/bin:$PATH" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
16 |
export SML_DOC_DIR="$HTML_DIR.tmp" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
17 |
export SML_DOC_REWRITE="isabelle=$ISABELLE_CVS" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
18 |
# export SML_DOC_DEBUG="all" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
19 |
TARGET=HOL |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
20 |
CVSUP=true |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
21 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
22 |
# Parse command line |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
23 |
for ARG in "$@"; do case "$ARG" in |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
24 |
-p) TARGET=Pure ;; |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
25 |
-n) CVSUP=false ;; |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
26 |
-l) export SML_LOG_DIR="$HOME/logs" ;; |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
27 |
esac; done |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
28 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
29 |
# Create clean output directory |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
30 |
rm -rf "$SML_DOC_DIR" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
31 |
mkdir "$SML_DOC_DIR" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
32 |
cp "$SMLNJ_HOME/annomaly/resources/"* "$SML_DOC_DIR" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
33 |
cat > "$SML_DOC_DIR/.htaccess" <<EOF |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
34 |
DirectoryIndex index.html source.html |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
35 |
<IfModule mod_deflate> |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
36 |
SetOutputFilter DEFLATE |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
37 |
</IfModule> |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
38 |
AddType text/plain .dot |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
39 |
EOF |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
40 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
41 |
# Update CVS |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
42 |
cd "$ISABELLE_CVS" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
43 |
if $CVSUP; then |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
44 |
echo "Updating CVS" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
45 |
cvs -q up -d |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
46 |
fi |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
47 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
48 |
# Build isabelle |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
49 |
cd "$ISABELLE_HOME" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
50 |
rm -rf heaps/* |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
51 |
./build -b $TARGET |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
52 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
53 |
# Postprocess created files |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
54 |
cd $SML_DOC_DIR |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
55 |
dot -Tsvg depGraph.dot \ |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
56 |
| 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
|
57 |
> depGraph.svg |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
58 |
dot -Tps2 depGraph.dot > depGraph.ps |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
59 |
ps2pdf depGraph.ps depGraph.pdf |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
60 |
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
|
61 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
62 |
# Install result by renaming to be almost atomic |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
63 |
rm -rf "$HTML_DIR.bac" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
64 |
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
|
65 |
mv "$SML_DOC_DIR" "$HTML_DIR" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
66 |
rm -rf "$HTML_DIR.bac" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
67 |
|
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
68 |
# Done |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
69 |
echo "Completed successfully" |
da313b67a04d
moved all isatest/cron job related files to own directory
kleing
parents:
diff
changeset
|
70 |
exit 0 |