* Fix compiled and dep files path

* Comment out dep file since it's not used
* Fix checking of the `compile?' argument
* Print a "recompiling" message and a warning the file is not found

svn: r10434
This commit is contained in:
Eli Barzilay 2008-06-24 01:25:46 +00:00
parent d6ee81feba
commit 7febe63ce9

View File

@ -272,14 +272,15 @@
(define (ftime file)
(and (file-exists? file) (file-or-directory-modify-seconds file)))
(let* ([src (cpath "config.ss")]
[zo (cpath "compiled" "config.zo")]
[dep (cpath "compiled" "config.dep")]
[zo (cpath "compiled" "config_ss.zo")]
;; [dep (cpath "compiled" "config_ss.dep")] ; not needed
[src-time (ftime src)]
[zo-time (ftime zo)])
(printf "Rewriting configuration file at: ~a...\n" src)
(parameterize ([current-library-collection-paths ; for configtab.ss
(parameterize ([current-namespace (make-base-namespace)] ; to compile
[current-library-collection-paths ; for configtab.ss
(list collectsdir)])
(with-output-to-file (cpath "config.ss") #:exists 'truncate/replace
(with-output-to-file src #:exists 'truncate/replace
(lambda ()
(printf ";; automatically generated by unixstyle-install\n")
(printf "(module config (lib \"configtab.ss\" \"setup\")\n")
@ -293,14 +294,17 @@
;; recompile & set times as if nothing happened (don't remove .dep)
;; this requires the file to look the same on all compilations, and
;; configtab.ss generates bindings unhygienically for that reason.
(unless (and (pair? compile?) (not (car compile?)))
(when compile?
(when src-time (file-or-directory-modify-seconds src src-time))
(when zo-time
(with-input-from-file src
(lambda ()
(with-output-to-file zo #:exists 'truncate/replace
(lambda () (write (compile (read-syntax)))))))
(file-or-directory-modify-seconds zo zo-time)))))]))
(if (not zo-time)
(printf "WARNING: skipping recompilation, no zo file at ~a\n" zo)
(begin
(printf "Recompiling to ~a...\n" zo)
(with-input-from-file src
(lambda ()
(with-output-to-file zo #:exists 'truncate/replace
(lambda () (write (compile (read-syntax)))))))
(file-or-directory-modify-seconds zo zo-time))))))]))
;; creates a directory including its ancestors when needed
(define (make-dir* dir)