+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
(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)
: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")))))
(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
: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))
-# -*- 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
#
# 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
+++ /dev/null
-/****************************************************************************
- * FILE IDENTIFICATION
- *
- * Name: clsql-mysql.c
- * Purpose: Helper functions for mysql.cl to handle 64-bit parts of API
- * Programmer: Kevin M. Rosenberg
- * Date Started: Mar 2002
- *
- * $Id$
- *
- * This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
- *
- * 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.
- ***************************************************************************/
-
-#ifdef WIN32
-#include <windows.h>
-
-BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll, DWORD fdwReason,
- LPVOID lpvReserved)
-{
- return 1;
-}
-
-#define DLLEXPORT __declspec(dllexport)
-
-#else
-#define DLLEXPORT
-#endif
-
-
-#include <mysql.h>
-
-/* Need to assemble a 64-bit integer to send to MySQL */
-DLLEXPORT
-void
-clsql_mysql_data_seek (MYSQL_RES* res, unsigned int offset_high32,
- unsigned int offset_low32)
-{
- my_ulonglong offset;
-
- offset = offset_high32;
- offset = offset << 32;
- offset += offset_low32;
-
- mysql_data_seek (res, offset);
-}
-
-/* The following functions are used to return 64-bit integers to Lisp.
- They return the 32-bit low part and store in upper 32-bits in a
- located sent via a pointer */
-
-static const unsigned int bitmask_32bits = 0xFFFFFFFF;
-#define lower_32bits(int64) ((unsigned int) int64 & bitmask_32bits)
-#define upper_32bits(int64) ((unsigned int) (int64 >> 32))
-
-DLLEXPORT
-unsigned int
-clsql_mysql_num_rows (MYSQL_RES* res, unsigned int* pHigh32)
-{
- my_ulonglong nRows = mysql_num_rows (res);
- *pHigh32 = upper_32bits(nRows);
- return lower_32bits(nRows);
-}
-
-DLLEXPORT
-unsigned int
-clsql_mysql_affected_rows (MYSQL* res, unsigned int* pHigh32)
-{
- my_ulonglong nAffected = mysql_affected_rows (res);
- *pHigh32 = upper_32bits(nAffected);
- return lower_32bits(nAffected);
-}
-
-DLLEXPORT
-unsigned int
-clsql_mysql_insert_id (MYSQL* mysql, unsigned int* pHigh32)
-{
- my_ulonglong insert_id = mysql_insert_id (mysql);
- *pHigh32 = upper_32bits(insert_id);
- return lower_32bits(insert_id);
-}
-
-
--- /dev/null
+#!/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
+
+
(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/"
--- /dev/null
+/****************************************************************************
+ * FILE IDENTIFICATION
+ *
+ * Name: clsql-mysql.c
+ * Purpose: Helper functions for mysql.cl to handle 64-bit parts of API
+ * Programmer: Kevin M. Rosenberg
+ * Date Started: Mar 2002
+ *
+ * $Id$
+ *
+ * This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
+ *
+ * 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.
+ ***************************************************************************/
+
+#ifdef WIN32
+#include <windows.h>
+
+BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll, DWORD fdwReason,
+ LPVOID lpvReserved)
+{
+ return 1;
+}
+
+#define DLLEXPORT __declspec(dllexport)
+
+#else
+#define DLLEXPORT
+#endif
+
+
+#include <mysql.h>
+
+/* Need to assemble a 64-bit integer to send to MySQL */
+DLLEXPORT
+void
+clsql_mysql_data_seek (MYSQL_RES* res, unsigned int offset_high32,
+ unsigned int offset_low32)
+{
+ my_ulonglong offset;
+
+ offset = offset_high32;
+ offset = offset << 32;
+ offset += offset_low32;
+
+ mysql_data_seek (res, offset);
+}
+
+/* The following functions are used to return 64-bit integers to Lisp.
+ They return the 32-bit low part and store in upper 32-bits in a
+ located sent via a pointer */
+
+static const unsigned int bitmask_32bits = 0xFFFFFFFF;
+#define lower_32bits(int64) ((unsigned int) int64 & bitmask_32bits)
+#define upper_32bits(int64) ((unsigned int) (int64 >> 32))
+
+DLLEXPORT
+unsigned int
+clsql_mysql_num_rows (MYSQL_RES* res, unsigned int* pHigh32)
+{
+ my_ulonglong nRows = mysql_num_rows (res);
+ *pHigh32 = upper_32bits(nRows);
+ return lower_32bits(nRows);
+}
+
+DLLEXPORT
+unsigned int
+clsql_mysql_affected_rows (MYSQL* res, unsigned int* pHigh32)
+{
+ my_ulonglong nAffected = mysql_affected_rows (res);
+ *pHigh32 = upper_32bits(nAffected);
+ return lower_32bits(nAffected);
+}
+
+DLLEXPORT
+unsigned int
+clsql_mysql_insert_id (MYSQL* mysql, unsigned int* pHigh32)
+{
+ my_ulonglong insert_id = mysql_insert_id (mysql);
+ *pHigh32 = upper_32bits(insert_id);
+ return lower_32bits(insert_id);
+}
+
+
+cl-sql (1.8.0-1) unstable; urgency=low
+
+ * Make asdf-installable
+
+ -- Kevin M. Rosenberg <kmr@debian.org> Tue, 11 Nov 2003 08:06:28 -0700
+
cl-sql (1.7.9-1) unstable; urgency=low
* Add missing documentation file
-# -*- 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
#
# 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
(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/"
(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"
(load-uffi-foreign-library)
-
-
+++ /dev/null
-/****************************************************************************
- * FILE IDENTIFICATION
- *
- * Name: clsql-uffi.c
- * Purpose: Helper functions for common interfaces using UFFI
- * Programmer: Kevin M. Rosenberg
- * Date Started: Mar 2002
- *
- * $Id$
- *
- * This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
- *
- * 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.
- ***************************************************************************/
-
-#ifdef WIN32
-#include <windows.h>
-
-BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll, DWORD fdwReason,
- LPVOID lpvReserved)
-{
- return 1;
-}
-
-#define DLLEXPORT __declspec(dllexport)
-
-#else
-#define DLLEXPORT
-#endif
-
-
-const unsigned int bitmask_32bits = 0xFFFFFFFF;
-#define lower_32bits(int64) ((unsigned int) int64 & bitmask_32bits)
-#define upper_32bits(int64) ((unsigned int) (int64 >> 32))
-
-/* Reads a 64-bit integer string, returns result as two 32-bit integers */
-
-DLLEXPORT
-unsigned int
-atol64 (const unsigned char* str, int* pHigh32)
-{
-#ifdef WIN32
- __int64 result = 0;
-#else
- long long result = 0;
-#endif
- int minus = 0;
- int first_char = *str;
- if (first_char == '+')
- ++str;
- else if (first_char == '-') {
- minus = 1;
- ++str;
- }
-
- while (*str) {
- int i = *str - '0';
- if (i < 0 || i > 9) /* Non-numeric character -- quit */
- break;
- result = i + (10 * result);
- str++;
- }
- if (minus)
- result = -result;
-
- *pHigh32 = upper_32bits(result);
- return lower_32bits(result);
-}
-
-
-
-
-
--- /dev/null
+#!/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
+
+
--- /dev/null
+/****************************************************************************
+ * FILE IDENTIFICATION
+ *
+ * Name: clsql-uffi.c
+ * Purpose: Helper functions for common interfaces using UFFI
+ * Programmer: Kevin M. Rosenberg
+ * Date Started: Mar 2002
+ *
+ * $Id$
+ *
+ * This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
+ *
+ * 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.
+ ***************************************************************************/
+
+#ifdef WIN32
+#include <windows.h>
+
+BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll, DWORD fdwReason,
+ LPVOID lpvReserved)
+{
+ return 1;
+}
+
+#define DLLEXPORT __declspec(dllexport)
+
+#else
+#define DLLEXPORT
+#endif
+
+
+const unsigned int bitmask_32bits = 0xFFFFFFFF;
+#define lower_32bits(int64) ((unsigned int) int64 & bitmask_32bits)
+#define upper_32bits(int64) ((unsigned int) (int64 >> 32))
+
+/* Reads a 64-bit integer string, returns result as two 32-bit integers */
+
+DLLEXPORT
+unsigned int
+atol64 (const unsigned char* str, int* pHigh32)
+{
+#ifdef WIN32
+ __int64 result = 0;
+#else
+ long long result = 0;
+#endif
+ int minus = 0;
+ int first_char = *str;
+ if (first_char == '+')
+ ++str;
+ else if (first_char == '-') {
+ minus = 1;
+ ++str;
+ }
+
+ while (*str) {
+ int i = *str - '0';
+ if (i < 0 || i > 9) /* Non-numeric character -- quit */
+ break;
+ result = i + (10 * result);
+ str++;
+ }
+ if (minus)
+ result = -result;
+
+ *pHigh32 = upper_32bits(result);
+ return lower_32bits(result);
+}
+
+
+
+
+