summaryrefslogtreecommitdiff
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
parentede0c056cba36f65464c9ac4f15d00b44eeacd4f (diff)
System definition: Copy the system prior to compilation instead of after it.
darcs-hash:73cfed6be2a95e02cf75bcd8cc6b26abf3778a9e
-rw-r--r--Lisp/defpackage.lisp2
-rw-r--r--Lisp/libobjcl.lisp12
-rw-r--r--Objective-C/NSObject-ObjectiveCLWrapperLink.m4
-rw-r--r--objective-cl-libobjcl.asd79
4 files changed, 57 insertions, 40 deletions
diff --git a/Lisp/defpackage.lisp b/Lisp/defpackage.lisp
index 6b5f8eb..1854cfd 100644
--- a/Lisp/defpackage.lisp
+++ b/Lisp/defpackage.lisp
@@ -17,7 +17,7 @@
(defpackage #:mulk.objective-cl
(:nicknames #:objcl #:objective-cl #:mulk.objcl)
- (:use #:cl #:cffi #:split-sequence)
+ (:use #:closer-common-lisp #:cffi #:split-sequence)
(:shadow #:foreign-pointer)
;; Functions
diff --git a/Lisp/libobjcl.lisp b/Lisp/libobjcl.lisp
index 5616f71..6b14115 100644
--- a/Lisp/libobjcl.lisp
+++ b/Lisp/libobjcl.lisp
@@ -354,11 +354,13 @@ conventional case for namespace identifiers in Objective-C."
'objective-c-meta-class)
superclass
(class-of superclass))
- (c2mop:ensure-class
- (objc-fake-meta-class-name->symbol class-name-string)
- :metaclass 'objective-c-meta-class
- :pointer class-ptr
- :direct-superclasses (list superclass)))))
+ (let ((fake-metaclass-name
+ (objc-fake-meta-class-name->symbol class-name-string)))
+ (or (find-class fake-metaclass-name nil)
+ (c2mop:ensure-class fake-metaclass-name
+ :metaclass 'objective-c-meta-class
+ :pointer class-ptr
+ :direct-superclasses (list superclass)))))))
(or (find-class class-name nil)
(c2mop:ensure-class class-name
:metaclass metaclass
diff --git a/Objective-C/NSObject-ObjectiveCLWrapperLink.m b/Objective-C/NSObject-ObjectiveCLWrapperLink.m
index 5dac3a7..8677ef3 100644
--- a/Objective-C/NSObject-ObjectiveCLWrapperLink.m
+++ b/Objective-C/NSObject-ObjectiveCLWrapperLink.m
@@ -5,6 +5,10 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>
+#ifndef NULL
+#define NULL (void *)0
+#endif
+
static NSMutableDictionary *instance_wrappers = NULL;
void
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))))))))))))