summaryrefslogtreecommitdiff
path: root/objective-cl-libobjcl.asd
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2008-02-10 17:36:08 +0100
committerMatthias Benkard <code@mail.matthias.benkard.de>2008-02-10 17:36:08 +0100
commit38747051bbe8bf893363c99374118e237e252cb7 (patch)
treede9bd9c4e7d27dc218a5d509c11a55f48087957b /objective-cl-libobjcl.asd
parentede0c056cba36f65464c9ac4f15d00b44eeacd4f (diff)
System definition: Copy the system prior to compilation instead of after it.
darcs-hash:73cfed6be2a95e02cf75bcd8cc6b26abf3778a9e
Diffstat (limited to 'objective-cl-libobjcl.asd')
-rw-r--r--objective-cl-libobjcl.asd79
1 files changed, 45 insertions, 34 deletions
diff --git a/objective-cl-libobjcl.asd b/objective-cl-libobjcl.asd
index 10047ea..2720db1 100644
--- a/objective-cl-libobjcl.asd
+++ b/objective-cl-libobjcl.asd
@@ -22,6 +22,7 @@
(in-package #:objcl-asdf)
(defvar *objc-obj-dir*)
+(defvar *stuff-copied-p* nil)
(defclass objc-source-file (source-file) ())
(defclass objcl-c-source-file (objc-source-file) ()
@@ -111,38 +112,48 @@
:serial t)
-(defmethod perform :before (o (c (eql (find-system "objective-cl-libobjcl"))))
+(defmethod perform :before (o (c objc-source-file))
;; Copy the Objective-C sources to the target directory.
- (unless (null (output-files o c))
- (let* ((source-dir (component-pathname (find-system "objective-cl-libobjcl")))
- (sources
- (mapcar #'(lambda (x)
- (enough-namestring x source-dir))
- (mapcan #'(lambda (x)
- (directory (merge-pathnames x source-dir)))
- '(#p"**/*.c" #p"**/*.m" #p"**/*.h"
- #p"**/GNUmakefile.*"
- #p"**/*.make" #p"**/GNUmakefile"
- #p"**/*.in" #p"**/configure" #p"**/configure.ac"
- #p"libffi/**/*" #p"libffi/**/*.*"))))
- (output-dir
- (merge-pathnames #p"../../"
- (directory-namestring (first (output-files o c))))))
- (dolist (relative-source-file sources)
- (let ((output-file (merge-pathnames relative-source-file output-dir))
- (source-file (merge-pathnames relative-source-file source-dir)))
- (ensure-directories-exist output-file)
- (unless (and (probe-file output-file)
- (= (file-write-date source-file)
- (file-write-date output-file)))
- (ignore-errors ;; FIXME: We need to skip directories, so
- ;; that IGNORE-ERRORS can go away.
- (with-open-file (in source-file
- :element-type '(unsigned-byte 8))
- (with-open-file (out output-file
- :direction :output
- :if-exists :supersede
- :element-type '(unsigned-byte 8))
- (loop for byte = (read-byte in nil nil)
- while byte
- do (write-byte byte out)))))))))))
+ (let ((output-files
+ (output-files (make-instance 'compile-op)
+ (find "libobjcl"
+ (module-components
+ (first
+ (module-components
+ (find-system "objective-cl-libobjcl"))))
+ :key #'component-name
+ :test #'string=))))
+ (unless (or *stuff-copied-p* (null output-files))
+ (setq *stuff-copied-p* t)
+ (let* ((source-dir (component-pathname (find-system "objective-cl-libobjcl")))
+ (sources
+ (mapcar #'(lambda (x)
+ (enough-namestring x source-dir))
+ (mapcan #'(lambda (x)
+ (directory (merge-pathnames x source-dir)))
+ '(#p"**/*.c" #p"**/*.m" #p"**/*.h"
+ #p"**/GNUmakefile.*"
+ #p"**/*.make" #p"**/GNUmakefile"
+ #p"**/*.in" #p"**/configure" #p"**/configure.ac"
+ #p"libffi/**/*" #p"libffi/**/*.*"))))
+ (output-dir
+ (merge-pathnames #p"../../"
+ (directory-namestring (first output-files)))))
+ (dolist (relative-source-file sources)
+ (let ((output-file (merge-pathnames relative-source-file output-dir))
+ (source-file (merge-pathnames relative-source-file source-dir)))
+ (ensure-directories-exist output-file)
+ (unless (and (probe-file output-file)
+ (= (file-write-date source-file)
+ (file-write-date output-file)))
+ (ignore-errors ;; FIXME: We need to skip directories, so
+ ;; that IGNORE-ERRORS can go away.
+ (with-open-file (in source-file
+ :element-type '(unsigned-byte 8))
+ (with-open-file (out output-file
+ :direction :output
+ :if-exists :supersede
+ :element-type '(unsigned-byte 8))
+ (loop for byte = (read-byte in nil nil)
+ while byte
+ do (write-byte byte out))))))))))))