1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
5 ;;;; Name: clsql-mysql.asd
6 ;;;; Purpose: ASDF definition file for CLSQL MySQL backend
7 ;;;; Programmer: Kevin M. Rosenberg
8 ;;;; Date Started: Aug 2002
12 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
14 ;;;; CLSQL users are granted the rights to distribute and use this software
15 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
16 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
17 ;;;; *************************************************************************
19 (defpackage #:clsql-mysql-system (:use #:asdf #:cl))
20 (in-package #:clsql-mysql-system)
22 (eval-when (:compile-toplevel :load-toplevel :execute)
23 (unless (find-package 'uffi)
24 (asdf:operate 'asdf:load-op 'uffi)))
26 (defvar *library-file-dir* (append (pathname-directory *load-truename*)
29 (defclass clsql-mysql-source-file (c-source-file)
32 (defmethod output-files ((o compile-op) (c clsql-mysql-source-file))
33 (let* ((library-file-type
34 (funcall (intern (symbol-name'#:default-foreign-library-type)
35 (symbol-name '#:uffi))))
36 (found (some #'(lambda (dir)
37 (probe-file (make-pathname :directory dir
38 :name (component-name c)
39 :type library-file-type)))
40 '((:absolute "usr" "lib" "clsql")))))
43 (make-pathname :name (component-name c)
44 :type library-file-type
45 :directory *library-file-dir*)))))
47 (defmethod perform ((o load-op) (c clsql-mysql-source-file))
50 (defmethod operation-done-p ((o load-op) (c clsql-mysql-source-file))
51 (and (symbol-function (intern (symbol-name '#:mysql-get-client-info)
52 (find-package '#:mysql)))
55 (defmethod perform ((o compile-op) (c clsql-mysql-source-file))
56 (unless (operation-done-p o c)
57 #-(or win32 mswindows)
58 (unless (zerop (run-shell-command
59 #-freebsd "cd ~A; make"
60 #+freebsd "cd ~A; gmake"
61 (namestring (make-pathname :name nil
63 :directory *library-file-dir*))))
64 (error 'operation-error :component c :operation o))))
66 (defmethod operation-done-p ((o compile-op) (c clsql-mysql-source-file))
67 (or (and (probe-file #p"/usr/lib/clsql/mysql.so") t)
68 (let ((lib (make-pathname :defaults (component-pathname c)
69 :type (uffi:default-foreign-library-type))))
71 (> (file-write-date lib) (file-write-date (component-pathname c)))))))
75 #+(or allegro lispworks cmu sbcl openmcl mcl scl)
76 (defsystem :clsql-mysql
78 :author "Kevin M. Rosenberg <kmr@debian.org>"
79 :maintainer "Kevin M. Rosenberg <kmr@debian.org>"
80 :licence "Lessor Lisp General Public License"
81 :description "Common Lisp SQL MySQL Driver"
82 :long-description "cl-sql-mysql package provides a database driver to the MySQL database system."
84 :depends-on (uffi clsql clsql-uffi)
88 ((:file "mysql-package")
89 (:clsql-mysql-source-file "mysql" :depends-on ("mysql-package"))
90 (:file "mysql-loader" :depends-on ("mysql-package" "mysql"))
91 (:file "mysql-client-info" :depends-on ("mysql-loader"))
92 (:file "mysql-api" :depends-on ("mysql-client-info"))
93 (:file "mysql-sql" :depends-on ("mysql-api"))
94 (:file "mysql-objects" :depends-on ("mysql-sql"))))))