summaryrefslogtreecommitdiff
path: root/journal-admin.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-admin.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-admin.cgi')
-rwxr-xr-xjournal-admin.cgi21
1 files changed, 20 insertions, 1 deletions
diff --git a/journal-admin.cgi b/journal-admin.cgi
index 5fa1272..53d7c97 100755
--- a/journal-admin.cgi
+++ b/journal-admin.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" --admin-mode
+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))" --admin-mode