[elephant-cvs] CVS elephant

ieslick ieslick at common-lisp.net
Sun Feb 19 16:22:40 UTC 2006


Update of /project/elephant/cvsroot/elephant
In directory common-lisp:/tmp/cvs-serv18566

Modified Files:
	Makefile ele-clsql.asd elephant.asd 
Log Message:
Further reorg, added auto build of memutil

--- /project/elephant/cvsroot/elephant/Makefile	2006/02/19 04:52:58	1.9
+++ /project/elephant/cvsroot/elephant/Makefile	2006/02/19 16:22:39	1.10
@@ -1,41 +1,57 @@
 #
-# GNU Makefile for compiling libsleepycat.c (BSDers use gmake)
+# GNU Makefile for compiling elephant libs (BSDers use gmake)
 #
-# Contributed by Rafal Strzalinski
+# Originally contributed by Rafal Strzalinski
 #
 
 SHELL=/bin/sh
 UNAME:=$(shell uname -s)
 
-# DB43DIR=/db/ben/lisp/db43
-# Dan Knapp contributed this line, which came form OS X?
-#DB43DIR=/sw
+ifeq (Darwin,$(UNAME))
+	SHARED=-bundle
+	EXT=dylib
+else
+	SHARED=-shared
+	EXT=so
+endif
+
+#
+# ALL PLATFORMS NEED TO LOAD MEMUTILS
+#
+
+UTILSRC=src/memutil
+
+all: $(UTILSRC)/libmemutil.$(EXT)
+
+$(UTILSRC)/libmemutil.$(EXT): $(UTILSRC)/libmemutil.c
+	gcc $(SHARED) -Wall  -fPIC -O3 -o $@ $< -lm
+
+#
+# NON BDB PLATFORMS SHOULDN'T NEED TO COMPILE LIBSLEEPYCAT
+# SO ONLY EDIT THIS IF YOU WANT TO USE BDB!
+#
+
 # But I will assume that Linux is more common?
 DB43DIR=/usr/local/BerkeleyDB.4.3/
+# Dan Knapp contributed this line, which came form OS X?
+# DB43DIR=/sw
+# Other example paths
+# DB43DIR=/db/ben/lisp/db43
 
-DBLIBDIR=$(DB43DIR)/lib/
 DBINCDIR=$(DB43DIR)/include/
 # Dan Knapp contributed this line; for fink/OS X?
 #DBINCDIR=$(DB43DIR)/include/db4/
 
+DBLIBDIR=$(DB43DIR)/lib/
 # *BSD users will probably want
 #DBLIBDIR=/usr/local/lib/db43
 #DBINCDIR=/usr/local/include/db43
 
-ifeq (Darwin,$(UNAME))
-	SHARED=-bundle
-	EXT=dylib
-else
-	SHARED=-shared
-	EXT=so
-endif
-
-all: libsleepycat.$(EXT) libmemutil.$(EXT)
+BDBSRC=src/db-bdb
 
-libmemutil.$(EXT): src/memutil/libmemutil.c
-	gcc $(SHARED) -Wall  -fPIC -O3 -o $@ $< -lm
+bdb: libsleepycat.$(EXT) 
 
-libsleepycat.$(EXT): src/db-bdb/libsleepycat.c 
+$(BDBSRC)/libsleepycat.$(EXT): $(BDBSRC)/libsleepycat.c 
 	gcc $(SHARED) -Wall -L$(DBLIBDIR)  -I$(DBINCDIR) -fPIC -O3 -o $@ $< -ldb -lm 
 
 
--- /project/elephant/cvsroot/elephant/ele-clsql.asd	2006/02/19 05:13:02	1.5
+++ /project/elephant/cvsroot/elephant/ele-clsql.asd	2006/02/19 16:22:39	1.6
@@ -30,7 +30,7 @@
 	    ((:module :db-clsql
 		      :components
 		      ((:file "sql-controller")
-		       (:file "sql-transactions")
+		       (:file "sql-transaction")
 		       (:file "sql-collections"))
 		      :serial t))))
   :depends-on (:elephant :clsql :cl-base64))
--- /project/elephant/cvsroot/elephant/elephant.asd	2006/02/19 04:52:58	1.13
+++ /project/elephant/cvsroot/elephant/elephant.asd	2006/02/19 16:22:39	1.14
@@ -23,6 +23,58 @@
 
 (in-package :elephant-system)
 
+(eval-when (:compile-toplevel :load-toplevel :execute)
+  ;; We need this dependency satisfied to compute what to do for C files
+  (unless (find-package 'uffi)
+    (asdf:operate 'asdf:load-op 'uffi)))
+
+(defclass elephant-util-c-source (c-source-file)
+  ())
+
+(defparameter *root-dir* (pathname-directory *load-truename*))
+
+(defparameter *library-file-dir* (append (pathname-directory *load-truename*)
+					 (list "src" "memutil")))
+
+;; Compile foreign library on non-win32 platforms
+
+(defmethod output-files ((o compile-op) (c elephant-util-c-source))
+  (let* ((library-file-type
+	  (funcall (intern (symbol-name '#:default-foreign-library-type)
+			   (symbol-name '#:uffi)))))
+    (list (make-pathname :name (component-name c)
+			 :type library-file-type
+			 :directory *library-file-dir*))))
+
+(defmethod perform ((o compile-op) (c elephant-util-c-source))
+  (unless (operation-done-p o c)
+    #-(or win32 windows)
+    (unless (zerop (uffi:run-shell-command
+		    (format nil 
+			    #-freebsd "cd ~A; make"
+			    #+freebds "cd ~A; gmake"
+			    (make-pathname :directory *root-dir*))))
+      (error 'operation-error :component c :operation o))))
+
+(defmethod operation-done-p ((o compile-op) (c elephant-util-c-source))
+  (or (let ((lib (make-pathname :defaults (component-pathname c)
+				:type (uffi:default-foreign-library-type))))
+	(and (probe-file lib) (probe-file (component-pathname c))
+	     (> (file-write-date lib) (file-write-date (component-pathname c)))))))
+
+;; Load op - ensure that foreign library is loaded
+
+(defmethod perform ((o load-op) (c elephant-util-c-source))
+  "Nothing to do!"
+  t)
+
+(defmethod operation-done-p ((o load-op) (c elephant-util-c-source))
+  "Operation is done when the foreign library is loaded which should 
+   happen when we compile the interface lisp file"
+  (and (symbol-function (intern (symbol-name '#:copy-bufs)
+				(find-package '#:elephant-memutil)))
+       t))
+
 (defsystem elephant
   :name "elephant"
   :author "Ben Lee <blee at common-lisp.net>"
@@ -36,7 +88,9 @@
 	    :components
 	    ((:module memutil
 		      :components
-		      ((:file "memutil")))
+		      ((:elephant-util-c-source "libmemutil")
+		       (:file "memutil"))
+		      :serial t)
 	     (:module elephant
 		      :components
 		      ((:file "elephant")
@@ -58,3 +112,6 @@
 		      :depends-on (memutil)))))
   :depends-on (:uffi))
 
+
+
+




More information about the Elephant-cvs mailing list