diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2009-10-11 10:59:58 +0200 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2009-10-11 10:59:58 +0200 |
commit | b71aa1cc3b05c8c4b1256c54f8ccb6bef4066694 (patch) | |
tree | 08bc1458efbaaed3ab9eaf78378f12757d4f4fae | |
parent | 120da283d4235f63c203db9871e6428b4541b1ec (diff) |
In CGI mode, create and load a single FASL file instead of loading each source file directly.
Ignore-this: ea3269e86aae4bb2642cb25bb0db9d42
darcs-hash:4ec74e8bdc53cd16d103ce15cfe3a6d812f2c514
-rwxr-xr-x | compile.lisp (renamed from run.lisp) | 17 | ||||
-rwxr-xr-x | journal-admin.cgi | 21 | ||||
-rwxr-xr-x | journal.cgi | 21 |
3 files changed, 46 insertions, 13 deletions
@@ -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))" |