From b31836193ceb646fa6e4fd7761dff378a9c67385 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Tue, 11 Nov 2003 15:28:36 +0000 Subject: [PATCH] r8153: initial changes to make installable with asdf-install --- ChangeLog | 4 ++ clsql-mysql.asd | 40 +++++++++++++++++- clsql-uffi.asd | 39 ++++++++++++++++- db-mysql/Makefile | 54 ++++++------------------ db-mysql/make.sh | 26 ++++++++++++ db-mysql/mysql-loader.lisp | 2 +- db-mysql/{clsql-mysql.c => mysql.c} | 0 db-mysql/{clsql-mysql.dll => mysql.dll} | Bin db-mysql/{clsql-mysql.lib => mysql.lib} | Bin debian/changelog | 6 +++ uffi/Makefile | 41 +++++------------- uffi/clsql-uffi-loader.lisp | 6 +-- uffi/make.sh | 26 ++++++++++++ uffi/{clsql-uffi.c => uffi.c} | 0 uffi/{clsql-uffi.dll => uffi.dll} | Bin uffi/{clsql-uffi.lib => uffi.lib} | Bin 16 files changed, 162 insertions(+), 82 deletions(-) create mode 100644 db-mysql/make.sh rename db-mysql/{clsql-mysql.c => mysql.c} (100%) rename db-mysql/{clsql-mysql.dll => mysql.dll} (100%) rename db-mysql/{clsql-mysql.lib => mysql.lib} (100%) create mode 100644 uffi/make.sh rename uffi/{clsql-uffi.c => uffi.c} (100%) rename uffi/{clsql-uffi.dll => uffi.dll} (100%) rename uffi/{clsql-uffi.lib => uffi.lib} (100%) diff --git a/ChangeLog b/ChangeLog index 04dde1c..45929d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +11 Nov 2003 Kevin Rosenberg (kevin@rosenberg.net) + * Converted documentation to XML format + * Made package installable with asdf-install + 23 Jul 2003 Kevin Rosenberg (kevin@rosenberg.net) * Add for-each-row macro diff --git a/clsql-mysql.asd b/clsql-mysql.asd index 06d9750..4fcd4eb 100644 --- a/clsql-mysql.asd +++ b/clsql-mysql.asd @@ -19,6 +19,41 @@ (defpackage #:clsql-mysql-system (:use #:asdf #:cl)) (in-package #:clsql-mysql-system) +(defvar *asd-file-dir* (pathname-directory *load-truename*)) + +(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 "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*)))))) + +(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 "uffi")) + (make-pathname + :directory *asd-file-dir*))))) + (error 'operation-error :component c :operation o))) + ;;; System definition #+(or allegro lispworks cmu sbcl openmcl mcl scl) @@ -33,8 +68,9 @@ :components ((:module :db-mysql :components - ((:file "mysql-package") - (:file "mysql-loader" :depends-on ("mysql-package")) + ((:clsql-mysql-source-file "mysql") + (:file "mysql-package") + (:file "mysql-loader" :depends-on ("mysql-package" "mysql")) (:file "mysql-api" :depends-on ("mysql-loader")) (:file "mysql-sql" :depends-on ("mysql-api")) (:file "mysql-usql" :depends-on ("mysql-sql"))))) diff --git a/clsql-uffi.asd b/clsql-uffi.asd index 9cbfd70..ddd3c91 100644 --- a/clsql-uffi.asd +++ b/clsql-uffi.asd @@ -20,6 +20,40 @@ (defpackage #:clsql-uffi-system (:use #:asdf #:cl)) (in-package #:clsql-uffi-system) +(defvar *asd-file-dir* (pathname-directory *load-truename*)) + +(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*)))))) + +(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*))))) + (error 'operation-error :component c :operation o))) #+(or allegro lispworks cmu sbcl openmcl mcl scl) (defsystem clsql-uffi @@ -33,7 +67,8 @@ :components ((:module :uffi :components - ((:file "clsql-uffi-package") - (:file "clsql-uffi-loader" :depends-on ("clsql-uffi-package")) + ((: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)) diff --git a/db-mysql/Makefile b/db-mysql/Makefile index 728c5ee..1f5ea48 100644 --- a/db-mysql/Makefile +++ b/db-mysql/Makefile @@ -1,9 +1,7 @@ -# -*- Mode: Makefile -*- -########################################################################### # FILE IDENTIFICATION -# +# # Name: Makefile -# Purpose: Makefile for the CLSQL MySQL database interface +# Purpose: Makefile for CLSQL MySQL interface # Programer: Kevin M. Rosenberg # Date Started: Mar 2002 # @@ -14,51 +12,23 @@ # CLSQL users are granted the rights to distribute and use this software # as governed by the terms of the Lisp Lesser GNU Public License # (http://opensource.franz.com/preamble.html), also known as the LLGPL. -########################################################################### - -# These variables are correct for GCC -CC=gcc -SHARED_CC_OPT=-fPIC -DPIC -SHARED_LD_OPT=-shared -LD=gcc - -# Use these for Sun's C compiler and Solaris (ACL) -#CC=cc -#SHARED_CC_OPT=-KPIC -#SHARED_LD_OPT=-G -#LD=ld -# May need to change to the directory where you have installed mysql's library -vpath %.so /usr/lib /usr/local/lib /opt/mysql/lib/mysql -vpath %.h /usr/include /usr/include/mysql /usr/local/include /usr/local/include/mysql /opt/mysql/include/mysql -INCLUDE_DIRS=-I/usr/include/mysql -I/usr/local/include/mysql -I/opt/mysql/include/mysql -I/usr/include -I/usr/local/include +SUBDIRS= -# Nothing to configure beyond this point +include ../Makefile.common -base=clsql-mysql +base=mysql source=$(base).c object=$(base).o shared_lib=$(base).so -.PHONY: all clean distclean - -all: compile - -compile: $(shared_lib) +.PHONY: all +all: $(shared_lib) -$(object): $(source) mysql.h - $(CC) ${SHARED_CC_OPT} $(INCLUDE_DIRS) -c $< -o $@ - -$(shared_lib): $(object) - $(LD) ${SHARED_LD_OPT} $^ -o $@ - -mac: $(object) - ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress $(object) -o $(base).dylib - ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress /sw/lib/libmysqlclient.dylib -o libmysqlclient.dylib - ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress /usr/lib/libz.dylib -o libz.dylib - -clean: - @rm -f $(object) $(shared_lib) *~ +$(shared_lib): $(source) Makefile + CFLAGS="-I /usr/include/mysql" LDFLAGS="-lmysqlclient" BASE=$(base) OBJECT=$(object) SOURCE=$(source) SHARED_LIB=$(shared_lib) sh make.sh + rm $(object) +.PHONY: distclean distclean: clean - + rm -f $(base).dylib $(base).dylib $(base).so $(base).o diff --git a/db-mysql/make.sh b/db-mysql/make.sh new file mode 100644 index 0000000..8ad0950 --- /dev/null +++ b/db-mysql/make.sh @@ -0,0 +1,26 @@ +#!/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 + 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 + gcc $CFLAGS -c -D_BSD -D_NO_PROTO -D_NONSTD_TYPES -D_MBI=void $SOURCE + make_shared $LDFLAGS -o $SHARED_LIB $OBJECT +fi + + diff --git a/db-mysql/mysql-loader.lisp b/db-mysql/mysql-loader.lisp index 1dc903d..db40150 100644 --- a/db-mysql/mysql-loader.lisp +++ b/db-mysql/mysql-loader.lisp @@ -27,7 +27,7 @@ (defparameter *clsql-mysql-library-path* (uffi:find-foreign-library - "clsql-mysql" + "mysql" `(,(make-pathname :directory (pathname-directory *load-truename*)) "/usr/lib/clsql/" "/sw/lib/clsql/" diff --git a/db-mysql/clsql-mysql.c b/db-mysql/mysql.c similarity index 100% rename from db-mysql/clsql-mysql.c rename to db-mysql/mysql.c diff --git a/db-mysql/clsql-mysql.dll b/db-mysql/mysql.dll similarity index 100% rename from db-mysql/clsql-mysql.dll rename to db-mysql/mysql.dll diff --git a/db-mysql/clsql-mysql.lib b/db-mysql/mysql.lib similarity index 100% rename from db-mysql/clsql-mysql.lib rename to db-mysql/mysql.lib diff --git a/debian/changelog b/debian/changelog index d02fc72..4c6ecc1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +cl-sql (1.8.0-1) unstable; urgency=low + + * Make asdf-installable + + -- Kevin M. Rosenberg Tue, 11 Nov 2003 08:06:28 -0700 + cl-sql (1.7.9-1) unstable; urgency=low * Add missing documentation file diff --git a/uffi/Makefile b/uffi/Makefile index c2d1b3d..0a0568f 100644 --- a/uffi/Makefile +++ b/uffi/Makefile @@ -1,9 +1,7 @@ -# -*- Mode: Makefile -*- -########################################################################### # FILE IDENTIFICATION -# +# # Name: Makefile -# Purpose: Makefile for the CLSQL UFFI helper package +# Purpose: Makefile for CLSQL UFFI interface # Programer: Kevin M. Rosenberg # Date Started: Mar 2002 # @@ -14,42 +12,23 @@ # CLSQL users are granted the rights to distribute and use this software # as governed by the terms of the Lisp Lesser GNU Public License # (http://opensource.franz.com/preamble.html), also known as the LLGPL. -########################################################################### - - -# These variables are correct for GCC -CC=gcc -SHARED_CC_OPT=-fPIC -DPIC -SHARED_LD_OPT=-shared # For Linux (ALL) and FreeBSD (ACL) -LD=gcc -# Use these for Sun's C compiler and Solaris (ACL) -#CC=cc -#SHARED_CC_OPT=-KPIC -#SHARED_LD_OPT=-G -#LD=ld +SUBDIRS= -# Nothing to configure beyond this point +include ../Makefile.common -base=clsql-uffi +base=uffi source=$(base).c object=$(base).o shared_lib=$(base).so -.PHONY: all clean distclean - +.PHONY: all all: $(shared_lib) $(shared_lib): $(source) Makefile - $(CC) ${SHARED_CC_OPT} -c $(source) -o $(object) - $(LD) ${SHARED_LD_OPT} $(object) -o $(shared_lib) - @rm $(object) - -clean: - @rm -f $(object) $(shared_lib) *~ + BASE=$(base) OBJECT=$(object) SOURCE=$(source) SHARED_LIB=$(shared_lib) sh make.sh + rm $(object) +.PHONY: distclean distclean: clean - -mac: $(source) Makefile - cc -dynamic -c $(source) -o $(object) - ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress -o $(base).dylib $(object) + rm -f $(base).dylib $(base).dylib $(base).so $(base).o diff --git a/uffi/clsql-uffi-loader.lisp b/uffi/clsql-uffi-loader.lisp index c667746..a8f7173 100644 --- a/uffi/clsql-uffi-loader.lisp +++ b/uffi/clsql-uffi-loader.lisp @@ -20,7 +20,7 @@ (defvar *clsql-uffi-library-filename* (uffi:find-foreign-library - "clsql-uffi" + "uffi" `(,(make-pathname :directory (pathname-directory *load-truename*)) "/usr/lib/clsql/" "/opt/lisp/clsql/uffi/" @@ -37,7 +37,7 @@ set to the right path before compiling or loading the system.") (defun load-uffi-foreign-library () (unless (probe-file *clsql-uffi-library-filename*) - (error "Unable to find clsql-uffi.so")) + (error "Unable to find uffi.so")) (if (uffi:load-foreign-library *clsql-uffi-library-filename* :module "clsql-uffi" @@ -48,5 +48,3 @@ set to the right path before compiling or loading the system.") (load-uffi-foreign-library) - - diff --git a/uffi/make.sh b/uffi/make.sh new file mode 100644 index 0000000..f239372 --- /dev/null +++ b/uffi/make.sh @@ -0,0 +1,26 @@ +#!/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 + 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 + 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 + cc -KPIC -c $SOURCE -o $OBJECT + cc -G $OBJECT -o $SHARED_LIB +elif [ $AIX -ne 0 ]; then + gcc -c -D_BSD -D_NO_PROTO -D_NONSTD_TYPES -D_MBI=void $SOURCE + make_shared -o $SHARED_LIB $OBJECT +fi + + diff --git a/uffi/clsql-uffi.c b/uffi/uffi.c similarity index 100% rename from uffi/clsql-uffi.c rename to uffi/uffi.c diff --git a/uffi/clsql-uffi.dll b/uffi/uffi.dll similarity index 100% rename from uffi/clsql-uffi.dll rename to uffi/uffi.dll diff --git a/uffi/clsql-uffi.lib b/uffi/uffi.lib similarity index 100% rename from uffi/clsql-uffi.lib rename to uffi/uffi.lib -- 2.34.1