From 4661cdbb26de93d072226ab6cd9325c1ca7bb75e Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Thu, 13 Nov 2003 05:58:22 +0000 Subject: [PATCH] r8176: changes for macosx, documentation fixes --- clsql-mysql.asd | 36 ++++++++---------- clsql-tests.asd | 6 +-- clsql-uffi.asd | 57 ++++++++++++++++------------ clsql.asd | 4 +- db-mysql/make.sh | 42 ++++++++++---------- db-postgresql/postgresql-loader.lisp | 5 ++- debian/changelog | 12 ++++++ doc/bookinfo.lisp | 7 +++- doc/entities.xml | 2 - doc/intro.xml | 44 +++++++++++---------- tests/tests.lisp | 14 +++---- uffi/make.sh | 30 ++++++++------- 12 files changed, 144 insertions(+), 115 deletions(-) diff --git a/clsql-mysql.asd b/clsql-mysql.asd index feb6d29..ec4e5ef 100644 --- a/clsql-mysql.asd +++ b/clsql-mysql.asd @@ -19,25 +19,23 @@ (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 @@ -45,13 +43,9 @@ (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 diff --git a/clsql-tests.asd b/clsql-tests.asd index 7e12fb2..a9c8729 100644 --- a/clsql-tests.asd +++ b/clsql-tests.asd @@ -33,7 +33,7 @@ ))) (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"))) diff --git a/clsql-uffi.asd b/clsql-uffi.asd index ddd3c91..4235649 100644 --- a/clsql-uffi.asd +++ b/clsql-uffi.asd @@ -16,29 +16,39 @@ ;;;; (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 @@ -46,13 +56,9 @@ (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) @@ -64,11 +70,12 @@ :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")))))) diff --git a/clsql.asd b/clsql.asd index 7ad36fa..15a3249 100644 --- a/clsql.asd +++ b/clsql.asd @@ -2,8 +2,8 @@ ;;;; ************************************************************************* ;;;; 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 ;;;; diff --git a/db-mysql/make.sh b/db-mysql/make.sh index 8ad0950..24412b8 100644 --- a/db-mysql/make.sh +++ b/db-mysql/make.sh @@ -1,26 +1,30 @@ #!/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 diff --git a/db-postgresql/postgresql-loader.lisp b/db-postgresql/postgresql-loader.lisp index 9a3539e..e46ec77 100644 --- a/db-postgresql/postgresql-loader.lisp +++ b/db-postgresql/postgresql-loader.lisp @@ -40,7 +40,10 @@ set to the right path before compiling or loading the system.") "/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 diff --git a/debian/changelog b/debian/changelog index 4c6ecc1..3e54589 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +cl-sql (1.8.2-1) unstable; urgency=low + + * Documentation fixes, MacOSX changes + + -- Kevin M. Rosenberg Wed, 12 Nov 2003 22:52:45 -0700 + +cl-sql (1.8.1-1) unstable; urgency=low + + * Improved shared library building + + -- Kevin M. Rosenberg Tue, 11 Nov 2003 15:26:55 -0700 + cl-sql (1.8.0-1) unstable; urgency=low * Make asdf-installable diff --git a/doc/bookinfo.lisp b/doc/bookinfo.lisp index 594d4c1..d32258f 100644 --- a/doc/bookinfo.lisp +++ b/doc/bookinfo.lisp @@ -1,4 +1,6 @@ -(docbook +(load "docbook") + +(docbook-file "bookinfo2.xml" (:bookinfo (:title "&clsql; Users' Guide") (:authorgroup @@ -7,7 +9,7 @@ (:othername "M.") (:surname "Rosenberg") (:affiliation - (:jobtitle "Maintainer of CLSQL"]]] + (:jobtitle "Maintainer of CLSQL"))) (:author (:firstname "Pierre") (:othername "R.") @@ -43,3 +45,4 @@ "Other brand or product names are the registered trademarks or trademarks of their respective holders.")))))) + diff --git a/doc/entities.xml b/doc/entities.xml index faa9168..2d6731e 100644 --- a/doc/entities.xml +++ b/doc/entities.xml @@ -1,6 +1,5 @@ -Defsystem"> ASDF"> CLOCC"> CCLAN"> @@ -24,7 +23,6 @@ NIL"> NULL"> C"> -defsystem"> diff --git a/doc/intro.xml b/doc/intro.xml index ac54ec4..f227f2f 100644 --- a/doc/intro.xml +++ b/doc/intro.xml @@ -58,7 +58,7 @@ Prerequisites - &defsystem; + &asdf; &clsql; uses &asdf; to compile and load its components. &asdf; is included in the &cclan; collection. @@ -123,11 +123,11 @@ Installation - Ensure &defsystem; is loaded + Ensure &asdf; is loaded - Simply load the file defsystem.lisp. + Simply load the file asdf.lisp. -(load "defsystem.lisp") +(load "asdf.lisp") @@ -168,7 +168,7 @@ make libs Load &uffi; Unzip or untar the &uffi; distribution which creates a directory - for the &uffi; files. Add that directory to Defsystem's asdf:*central-registry*. + for the &uffi; files. Add that directory to &asdf;'s asdf:*central-registry*. 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 /usr/share/lisp/uffi/ @@ -184,7 +184,7 @@ make libs 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 asdf:*central-registry*. + Add that directory to &asdf;'s asdf:*central-registry*. 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 /usr/share/lisp/cl-md5/ @@ -200,7 +200,7 @@ make libs Load &clsql; modules Unzip or untar the &clsql; distribution which creates a directory - for the &clsql; files. Add that directory to Defsystem's asdf:*central-registry*. + for the &clsql; files. Add that directory to &asdf;'s asdf:*central-registry*. 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 /usr/share/lisp/clsql/ @@ -208,12 +208,12 @@ make libs the main :clsql system and at least one interface system. (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 @@ -221,15 +221,19 @@ make libs Run test suite - After loading &clsql;, you can execute the test program in - the directory ./test-suite. The test file, - tester-clsql - has instructions for creating a test.config. - 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 .clsql-test.config must be created + in your home directory. There are instructures on the format of that file + in the tests/tests.lisp file in the &clsql; + source directory. After creating that file, you can run the test suite + with &asdf;: + +(asdf:operate 'asdf:test-op 'clsql) + . . - + + diff --git a/tests/tests.lisp b/tests/tests.lisp index 22e7f69..dd609f0 100644 --- a/tests/tests.lisp +++ b/tests/tests.lisp @@ -55,7 +55,9 @@ (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)) @@ -220,8 +222,11 @@ (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) @@ -231,8 +236,3 @@ )) t) -;(deftest clsql.all (clsql-tests) t) -(clsql-tests) - - - diff --git a/uffi/make.sh b/uffi/make.sh index f239372..8bb895c 100644 --- a/uffi/make.sh +++ b/uffi/make.sh @@ -1,26 +1,30 @@ #!/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 -- 2.34.1