(defpackage #:clsql-mysql-system (:use #:asdf #:cl))
(in-package #:clsql-mysql-system)
-(defvar *asd-file-dir* (pathname-directory *load-truename*))
+(defvar *library-file-dir* (append (pathname-directory *load-truename*)
+ (list "db-mysql")))
(defclass clsql-mysql-source-file (c-source-file)
())
(defmethod output-files ((o compile-op) (c clsql-mysql-source-file))
- (let ((searched (or
- (probe-file #p"/usr/lib/clsql/uffi.so")
- (probe-file (make-pathname
- :directory *asd-file-dir*
- :name "db-mysql"
- :type "so")))))
- (if searched
- (list searched)
- (list (merge-pathnames
- (make-pathname :name (component-name c)
- :type "so"
- :directory '(:relative "db-mysql"))
- (make-pathname :directory *asd-file-dir*))))))
+ (let ((found (some #'(lambda (dir)
+ (probe-file (make-pathname :directory dir
+ :name (component-name c)
+ :type "so")))
+ '((:absolute "usr" "lib" "clsql")))))
+ (list (if found
+ found
+ (make-pathname :name (component-name c)
+ :type "so"
+ :directory *library-file-dir*)))))
(defmethod perform ((o load-op) (c clsql-mysql-source-file))
nil) ;;; library will be loaded by a loader file
(defmethod perform ((o compile-op) (c clsql-mysql-source-file))
(unless (zerop (run-shell-command
"cd ~A; make"
- (namestring (merge-pathnames
- (make-pathname
- :name nil
- :type nil
- :directory '(:relative "db-mysql"))
- (make-pathname
- :directory *asd-file-dir*)))))
+ (namestring (make-pathname :name nil
+ :type nil
+ :directory *library-file-dir*))))
(error 'operation-error :component c :operation o)))
;;; System definition
)))
(defmethod perform ((o test-op) (c (eql (find-system 'clsql-tests))))
- (or (funcall (intern (symbol-name '#:do-tests)
- (find-package '#:regression-test)))
- (error "test-op failed")))
+ (unless (funcall (intern (symbol-name '#:run-tests)
+ (find-package '#:clsql-tests)))
+ (error "test-op failed")))
;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
;;;; *************************************************************************
+(in-package cl-user)
-(defpackage #:clsql-uffi-system (:use #:asdf #:cl))
-(in-package #:clsql-uffi-system)
+;; need to load uffi for below output-files method
+(eval-when (:compile-toplevel :load-toplevel :execute)
+ #+common-lisp-controller (require 'uffi)
+ #-common-lisp-controller (asdf:operate 'asdf:load-op 'uffi))
-(defvar *asd-file-dir* (pathname-directory *load-truename*))
+(defpackage clsql-uffi-system (:use #:asdf #:cl))
+(in-package clsql-uffi-system)
+
+(defvar *library-file-dir* (append (pathname-directory *load-truename*)
+ (list "uffi")))
(defclass clsql-uffi-source-file (c-source-file)
())
+
(defmethod output-files ((o compile-op) (c clsql-uffi-source-file))
- (let ((searched (or
- (probe-file #p"/usr/lib/clsql/uffi.so")
- (probe-file (make-pathname
- :directory *asd-file-dir*
- :name "uffi"
- :type "so")))))
- (if searched
- (list searched)
- (list (merge-pathnames
- (make-pathname :name (component-name c)
- :type "so"
- :directory '(:relative "tests"))
- (make-pathname :directory *asd-file-dir*))))))
+ (let* ((library-file-type
+ (funcall (intern (symbol-name'#:default-foreign-library-type)
+ (symbol-name '#:uffi))))
+ (found
+ (some #'(lambda (dir)
+ (probe-file (make-pathname
+ :directory dir
+ :name (component-name c)
+ :type library-file-type)))
+ '((:absolute "usr" "lib" "clsql")))))
+ (list (if found
+ found
+ (make-pathname :name (component-name c)
+ :type library-file-type
+ :directory *library-file-dir*)))))
(defmethod perform ((o load-op) (c clsql-uffi-source-file))
nil) ;;; library will be loaded by a loader file
(defmethod perform ((o compile-op) (c clsql-uffi-source-file))
(unless (zerop (run-shell-command
"cd ~A; make"
- (namestring (merge-pathnames
- (make-pathname
- :name nil
- :type nil
- :directory '(:relative "uffi"))
- (make-pathname
- :directory *asd-file-dir*)))))
+ (namestring (make-pathname :name nil
+ :type nil
+ :directory *library-file-dir*))))
(error 'operation-error :component c :operation o)))
#+(or allegro lispworks cmu sbcl openmcl mcl scl)
:description "Common UFFI Helper functions for Common Lisp SQL Interface Library"
:long-description "cl-sql-uffi package provides common helper functions using the UFFI for the CLSQL package."
+ :depends-on (:uffi :clsql-base)
+
:components
((:module :uffi
:components
((:clsql-uffi-source-file "uffi")
(:file "clsql-uffi-package")
(:file "clsql-uffi-loader" :depends-on ("clsql-uffi-package" "uffi"))
- (:file "clsql-uffi" :depends-on ("clsql-uffi-loader")))))
- :depends-on (:uffi :clsql-base))
+ (:file "clsql-uffi" :depends-on ("clsql-uffi-loader"))))))
;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
-;;;; Name: clsql.system
-;;;; Purpose: Defsystem-3/4 for CLSQL
+;;;; Name: clsql.asd
+;;;; Purpose: System definition for CLSQL
;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Feb 2002
;;;;
#!/bin/sh
-UNAME=`uname -a`
-LINUX=`expr "$UNAME" : '.*Linux.*'`
-DARWIN=`expr "$UNAME" : '.*Darwin.*'`
-SOLARIS=`expr "$UNAME" : '.*sun4u.*'`
-AIX=`expr "$UNAME" : '.*aix.*'`
+case "`uname`" in
+ Linux) os_linux=1 ;;
+ Darwin) os_darwin=1 ;;
+ SunOs) os_sunos=1 ;;
+ AIX) os_aix=1 ;;
+ *) echo "Unable to identify uname " `uname`
+ exit 1 ;;
+esac
+
+if [ "$os_linux" ]; then
+ gcc $CFLAGS -fPIC -c $SOURCE -o $OBJECT
+ gcc -shared $OBJECT $LDFLAGS -o $SHARED_LIB
+elif [ "$os_darwin" ]; then
+ cc $CFLAGS -dynamic -c $SOURCE -o $OBJECT
+ ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress -o $BASE.dylib $OBJECT
+ ld -bundle /usr/lib/bundle1.o $LDFLAGS -flat_namespace -undefined suppress /usr/lib/libz.dylib -o z.dylib
-if [ $LINUX -ne 0 ]; then
- gcc -fPIC -DPIC $CFLAGS -c $SOURCE -o $OBJECT
- gcc -shared $OBJECT $LDFLAGS -o $SHARED_LIB
- #gcc -shared -Wl,-soname,uffi-c-test-lib $OBJECT -o $SHARED_LIB
-elif [ $DARWIN -ne 0 ]; then
- cc -dynamic $CFLAGS -c $SOURCE -o $OBJECT
- ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress -o $BASE.dylib $OBJECT $LDFLAGS
- ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress /usr/lib/libz.dylib -o z.dylib
-elif [ $SOLARIS -ne 0 ]; then
- cc -KPIC $CFLAGS -c $SOURCE -o $OBJECT
- cc -G $OBJECT $LDFLAGS -o $SHARED_LIB
-elif [ $AIX -ne 0 ]; then
+elif [ "$os_sunos" ]; then
+ cc $CFLAGS -KPIC -c $SOURCE -o $OBJECT
+ cc -G $OBJECT $LDFLAGS -o $SHARED_LIB
+
+elif [ "$os_aix" ]; then
gcc $CFLAGS -c -D_BSD -D_NO_PROTO -D_NONSTD_TYPES -D_MBI=void $SOURCE
- make_shared $LDFLAGS -o $SHARED_LIB $OBJECT
+ make_shared $LDFLAGS -o $SHARED_LIB $OBJECT
fi
-
+exit 0
"/usr/lib/" "/postgresql/lib/"
"/usr/local/pgsql/lib/" "/usr/lib/pgsql/"
"/opt/pgsql/lib/pgsql" "/sw/lib/pgsql/")
- :drive-letters '("C" "D" "E"))))
+ :drive-letters '("C" "D" "E")
+ #+(or macosx darwin ccl-5.0) :types
+ #+(or macosx darwin ccl-5.0) '("so")
+ )))
(if (uffi:load-foreign-library libpath
:module "postgresql"
:supporting-libraries
+cl-sql (1.8.2-1) unstable; urgency=low
+
+ * Documentation fixes, MacOSX changes
+
+ -- Kevin M. Rosenberg <kmr@debian.org> Wed, 12 Nov 2003 22:52:45 -0700
+
+cl-sql (1.8.1-1) unstable; urgency=low
+
+ * Improved shared library building
+
+ -- Kevin M. Rosenberg <kmr@debian.org> Tue, 11 Nov 2003 15:26:55 -0700
+
cl-sql (1.8.0-1) unstable; urgency=low
* Make asdf-installable
-(docbook
+(load "docbook")
+
+(docbook-file "bookinfo2.xml"
(:bookinfo
(:title "&clsql; Users' Guide")
(:authorgroup
(:othername "M.")
(:surname "Rosenberg")
(:affiliation
- (:jobtitle "Maintainer of CLSQL"]]]
+ (:jobtitle "Maintainer of CLSQL")))
(:author
(:firstname "Pierre")
(:othername "R.")
"Other brand or
product names are the registered trademarks or trademarks of
their respective holders."))))))
+
<?xml version="1.0" encoding="iso-8859-1" ?>
-<!ENTITY defsystem "<application>Defsystem</application>">
<!ENTITY asdf "<application>ASDF</application>">
<!ENTITY clocc "<application><emphasis>CLOCC</emphasis></application>">
<!ENTITY cclan "<application><emphasis>CCLAN</emphasis></application>">
<!ENTITY nil "<symbol>NIL</symbol>">
<!ENTITY null "<constant>NULL</constant>">
<!ENTITY c "<symbol>C</symbol>">
-<!ENTITY defsystem "<application>defsystem</application>">
<title>Prerequisites</title>
<sect2>
- <title>&defsystem;</title>
+ <title>&asdf;</title>
<para> &clsql; uses &asdf; to compile and load its
components. &asdf; is included in the <ulink
url="http://cclan.sourceforge.net"><citetitle>&cclan;</citetitle></ulink> collection.
<title>Installation</title>
<sect2>
- <title>Ensure &defsystem; is loaded</title>
+ <title>Ensure &asdf; is loaded</title>
<para>
- Simply load the file <filename>defsystem.lisp</filename>.
+ Simply load the file <filename>asdf.lisp</filename>.
<programlisting>
-(load "defsystem.lisp")
+(load "asdf.lisp")
</programlisting>
</para>
</sect2>
<title>Load &uffi;</title>
<para>
Unzip or untar the &uffi; distribution which creates a directory
- for the &uffi; files. Add that directory to Defsystem's <varname>asdf:*central-registry*</varname>.
+ for the &uffi; files. Add that directory to &asdf;'s <varname>asdf:*central-registry*</varname>.
You can do that by pushing the pathname of the directory onto this variable.
The following example code assumes the &uffi; files reside in the
<filename>/usr/share/lisp/uffi/</filename>
<para>
If you plan to use the clsql-postgresql-socket interface, you must load the md5 module.
Unzip or untar the cl-md5 distribution, which creates a directory for the cl-md5 files.
- Add that directory to Defsystem's <varname>asdf:*central-registry*</varname>.
+ Add that directory to &asdf;'s <varname>asdf:*central-registry*</varname>.
You can do that by pushing the pathname of the directory onto this variable.
The following example code assumes the cl-md5 files reside in the
<filename>/usr/share/lisp/cl-md5/</filename>
<title>Load &clsql; modules</title>
<para>
Unzip or untar the &clsql; distribution which creates a directory
- for the &clsql; files. Add that directory to Defsystem's <varname>asdf:*central-registry*</varname>.
+ for the &clsql; files. Add that directory to &asdf;'s <varname>asdf:*central-registry*</varname>.
You can do that by pushing the pathname of the directory onto this variable.
The following example code assumes the &clsql; files reside in the
<filename>/usr/share/lisp/clsql/</filename>
the main <symbol>:clsql</symbol> system and at least one interface system.
<programlisting>
(push #P"/usr/share/lisp/clsql/" asdf:*central-repository*)
-(asdf:oos 'asdf:load-op :clsql-base) ; base clsql package
-(asdf:oos 'asdf:load-op :clsql-mysql) ; MySQL interface
-(asdf:oos 'asdf:load-op :clsql-postgresql) ; PostgreSQL interface
-(asdf:oos 'asdf:load-op :clsql-postgresql-socket) ; Socket PGSQL interface
-(asdf:oos 'asdf:load-op :clsql-aodbc) ; Allegro ODBC interface
-(asdf:oos 'asdf:load-op :clsql) ; main clsql package
+(asdf:operate 'asdf:load-op 'clsql-base) ; base clsql package
+(asdf:operate 'asdf:load-op 'clsql-mysql) ; MySQL interface
+(asdf:operate 'asdf:load-op 'clsql-postgresql) ; PostgreSQL interface
+(asdf:operate 'asdf:load-op 'clsql-postgresql-socket) ; Socket PGSQL interface
+(asdf:operate 'asdf:load-op 'clsql-aodbc) ; Allegro ODBC interface
+(asdf:operate 'asdf:load-op 'clsql) ; main clsql package
</programlisting>
</para>
</sect2>
<sect2>
<title>Run test suite</title>
<para>
- After loading &clsql;, you can execute the test program in
- the directory <filename>./test-suite</filename>. The test file,
- <filename>tester-clsql</filename>
- has instructions for creating a <filename>test.config</filename>.
- After creating that file, simple load the test file with Lisp
- and the tests should automatically execute.
+ After loading &clsql;, you can execute the test suite. A configuration
+ file named <filename>.clsql-test.config</filename> must be created
+ in your home directory. There are instructures on the format of that file
+ in the <filename>tests/tests.lisp</filename> file in the &clsql;
+ source directory. After creating that file, you can run the test suite
+ with &asdf;:
+ <programlisting>
+(asdf:operate 'asdf:test-op 'clsql)
+ </programlisting>. .
</para>
</sect2>
</sect1>
-
+
</chapter>
+
(setf (pgsql-socket-spec specs)
(cadr (assoc :postgresql-socket config)))
specs))
- (warn "CLSQL tester config file ~S not found" path)))
+ (progn
+ (warn "CLSQL tester config file ~S not found" path)
+ nil)))
(defmethod mysql-table-test ((test conn-specs))
(test-table (mysql-spec test) :mysql))
(defun drop-test-table (db)
(clsql:execute-command "DROP TABLE test_clsql" :database db))
-(defun clsql-tests ()
+(defun run-tests ()
(let ((specs (read-specs)))
+ (unless specs
+ (warn "Not running test because test configuration file is missing")
+ (return-from run-tests :skipped))
(with-tests (:name "CLSQL")
(mysql-low-level specs)
(mysql-table-test specs)
))
t)
-;(deftest clsql.all (clsql-tests) t)
-(clsql-tests)
-
-
-
#!/bin/sh
-UNAME=`uname -a`
-LINUX=`expr "$UNAME" : '.*Linux.*'`
-DARWIN=`expr "$UNAME" : '.*Darwin.*'`
-SOLARIS=`expr "$UNAME" : '.*sun4u.*'`
-AIX=`expr "$UNAME" : '.*aix.*'`
-
-
-if [ $LINUX -ne 0 ]; then
+case "`uname`" in
+ Linux) os_linux=1 ;;
+ Darwin) os_darwin=1 ;;
+ SunOs) os_sunos=1 ;;
+ AIX) os_aix=1 ;;
+ *) echo "Unable to identify uname " `uname`
+ exit 1 ;;
+esac
+
+if [ "$os_linux" ]; then
gcc -fPIC -DPIC -c $SOURCE -o $OBJECT
gcc -shared $OBJECT -o $SHARED_LIB
- #gcc -shared -Wl,-soname,uffi-c-test-lib $OBJECT -o $SHARED_LIB
-elif [ $DARWIN -ne 0 ]; then
+
+elif [ "$os_darwin" ]; then
cc -dynamic -c $SOURCE -o $OBJECT
ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress -o $BASE.dylib $OBJECT
ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress /usr/lib/libz.dylib -o z.dylib
-elif [ $SOLARIS -ne 0 ]; then
+
+elif [ "$os_sunos" ]; then
cc -KPIC -c $SOURCE -o $OBJECT
cc -G $OBJECT -o $SHARED_LIB
-elif [ $AIX -ne 0 ]; then
+
+elif [ "$os_aix" ]; then
gcc -c -D_BSD -D_NO_PROTO -D_NONSTD_TYPES -D_MBI=void $SOURCE
make_shared -o $SHARED_LIB $OBJECT
fi
-
+exit 0