summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcompile.lisp (renamed from run.lisp)17
-rwxr-xr-xjournal-admin.cgi21
-rwxr-xr-xjournal.cgi21
3 files changed, 46 insertions, 13 deletions
diff --git a/run.lisp b/compile.lisp
index c77cab7..5806995 100755
--- a/run.lisp
+++ b/compile.lisp
@@ -29,19 +29,18 @@
;;; been written for purposes of debugging, development and
;;; documentation.
-(defclass load-source-simple-op (asdf:operation) ())
-(defmethod asdf:perform ((o load-source-simple-op) (c asdf:component))
+(defclass compile-source-simple-op (asdf:operation) ())
+(defmethod asdf:perform ((o compile-source-simple-op) (c asdf:component))
nil)
-(defmethod asdf:perform ((o load-source-simple-op) (m asdf:module))
+(defmethod asdf:perform ((o compile-source-simple-op) (m asdf:module))
(dolist (c (asdf:module-components m))
- (load (asdf:component-pathname c))))
+ (load (compile-file (asdf:component-pathname c)))))
#+clisp
(unless (asdf:find-system :mulk-journal nil)
(let ((*package* (find-package :asdf)))
- (load (merge-pathnames "mulk-journal.asd"
- system::*current-source-file*))))
+ (load (merge-pathnames "mulk-journal.asd" system::*current-source-file*))))
;;; The following does not generally work in a CGI setting because of
@@ -51,8 +50,4 @@
;;; our own files (no dependencies) using a manually loaded system
;;; definition (see above) works, which suffices for our needs.
(unless (find-package '#:mulk.journal)
- (asdf:oos 'load-source-simple-op '#:mulk-journal))
-
-
-#+clisp
-(script-main)
+ (asdf:oos 'compile-source-simple-op '#:mulk-journal))
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
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))"