summaryrefslogtreecommitdiff
path: root/journal.cgi
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2009-10-11 10:59:58 +0200
committerMatthias Benkard <code@mail.matthias.benkard.de>2009-10-11 10:59:58 +0200
commitb71aa1cc3b05c8c4b1256c54f8ccb6bef4066694 (patch)
tree08bc1458efbaaed3ab9eaf78378f12757d4f4fae /journal.cgi
parent120da283d4235f63c203db9871e6428b4541b1ec (diff)
In CGI mode, create and load a single FASL file instead of loading each source file directly.
Ignore-this: ea3269e86aae4bb2642cb25bb0db9d42 darcs-hash:4ec74e8bdc53cd16d103ce15cfe3a6d812f2c514
Diffstat (limited to 'journal.cgi')
-rwxr-xr-xjournal.cgi21
1 files changed, 20 insertions, 1 deletions
diff --git a/journal.cgi b/journal.cgi
index bbec698..c34c2e7 100755
--- a/journal.cgi
+++ b/journal.cgi
@@ -8,4 +8,23 @@ else
LISPINIT_DIR="$NFSN_SITE_ROOT/protected/journal"
fi
-exec env LC_ALL=de_DE.UTF-8 clisp -M "$LISPINIT_DIR/lispinit.mem.gz" "$DIR/run.lisp"
+mtime_of() {
+ stat -n -f "%m" -t "%s" "$1" || echo -n 0
+}
+
+FASL_FILE="$LISPINIT_DIR/journal-full.fas"
+
+lisp_mtime=0
+for x in $DIR/*.lisp; do
+ mtime=`mtime_of "$x"`
+ if [ $mtime -gt $lisp_mtime ]; then
+ lisp_mtime=$mtime
+ fi
+done
+
+if ! [ -f "$FASL_FILE" -a \( `mtime_of "$FASL_FILE"` -gt $lisp_mtime \) ]; then
+ env LC_ALL=de_DE.UTF-8 clisp -M "$LISPINIT_DIR/lispinit.mem.gz" "$DIR/compile.lisp" &&\
+ find "$DIR" -name "*.fas" -print0 | xargs -0 cat > "$FASL_FILE"
+fi
+
+exec env LC_ALL=de_DE.UTF-8 clisp -q -q -M "$LISPINIT_DIR/lispinit.mem.gz" -x "(progn (load \"$FASL_FILE\") (cl-user::script-main))"