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*
27 (merge-pathnames "db-mysql/"
28 (make-pathname :name nil :type nil
29 :defaults *load-truename*)))
31 (defclass clsql-mysql-source-file (c-source-file)
34 (defmethod output-files ((o compile-op) (c clsql-mysql-source-file))
35 (let* ((library-file-type
36 (funcall (intern (symbol-name'#:default-foreign-library-type)
37 (symbol-name '#:uffi))))
38 (found (some #'(lambda (dir)
39 (probe-file (make-pathname :directory dir
40 :name (component-name c)
41 :type library-file-type)))
42 '((:absolute "usr" "lib" "clsql")))))
45 (make-pathname :name (component-name c)
46 :type library-file-type
47 :defaults *library-file-dir*)))))
49 (defmethod perform ((o load-op) (c clsql-mysql-source-file))
52 (defmethod operation-done-p ((o load-op) (c clsql-mysql-source-file))
53 (and (symbol-function (intern (symbol-name '#:mysql-get-client-info)
54 (find-package '#:mysql)))
57 (defmethod perform ((o compile-op) (c clsql-mysql-source-file))
58 (unless (operation-done-p o c)
59 #-(or win32 win64 windows mswindows)
60 (unless (zerop (run-shell-command
61 #-freebsd "cd ~A; make"
62 #+freebsd "cd ~A; gmake"
63 (namestring *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/clsql_mysql.so") t)
68 (let ((lib (make-pathname :defaults (component-pathname c)
69 :type (uffi:default-foreign-library-type))))
70 (and (probe-file lib) (probe-file (component-pathname c))
71 (> (file-write-date lib) (file-write-date (component-pathname c)))))))
75 (defsystem :clsql-mysql
77 :author "Kevin M. Rosenberg <kmr@debian.org>"
78 :maintainer "Kevin M. Rosenberg <kmr@debian.org>"
79 :licence "Lessor Lisp General Public License"
80 :description "Common Lisp SQL MySQL Driver"
81 :long-description "cl-sql-mysql package provides a database driver to the MySQL database system."
83 :depends-on (uffi clsql clsql-uffi)
87 ((:file "mysql-package")
88 (:clsql-mysql-source-file "clsql_mysql" :depends-on ("mysql-package"))
89 (:file "mysql-loader" :depends-on ("mysql-package" "clsql_mysql"))
90 (:file "mysql-client-info" :depends-on ("mysql-loader"))
91 (:file "mysql-api" :depends-on ("mysql-client-info"))
92 (:file "mysql-sql" :depends-on ("mysql-api"))
93 (:file "mysql-objects" :depends-on ("mysql-sql"))))))