r8153: initial changes to make installable with asdf-install
[clsql.git] / clsql-mysql.asd
1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:          clsql-mysql.asd
6 ;;;; Purpose:       ASDF definition file for CLSQL MySQL backend
7 ;;;; Programmer:    Kevin M. Rosenberg
8 ;;;; Date Started:  Aug 2002
9 ;;;;
10 ;;;; $Id$
11 ;;;;
12 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
13 ;;;;
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 ;;;; *************************************************************************
18
19 (defpackage #:clsql-mysql-system (:use #:asdf #:cl))
20 (in-package #:clsql-mysql-system)
21
22 (defvar *asd-file-dir* (pathname-directory *load-truename*))
23
24 (defclass clsql-mysql-source-file (c-source-file)
25   ())
26
27 (defmethod output-files ((o compile-op) (c clsql-mysql-source-file))
28   (let ((searched (or
29                    (probe-file #p"/usr/lib/clsql/uffi.so")
30                    (probe-file (make-pathname
31                                 :directory *asd-file-dir*
32                                 :name "uffi"
33                                 :type "so")))))
34     (if searched
35         (list searched)
36         (list (merge-pathnames
37                (make-pathname :name (component-name c)
38                               :type "so"
39                               :directory '(:relative "tests"))
40                (make-pathname :directory *asd-file-dir*))))))
41
42 (defmethod perform ((o load-op) (c clsql-mysql-source-file))
43   nil) ;;; library will be loaded by a loader file
44
45 (defmethod perform ((o compile-op) (c clsql-mysql-source-file))
46   (unless (zerop (run-shell-command
47                   "cd ~A; make"
48                   (namestring (merge-pathnames
49                                (make-pathname
50                                 :name nil
51                                 :type nil
52                                 :directory '(:relative "uffi"))
53                                (make-pathname
54                                 :directory *asd-file-dir*)))))
55     (error 'operation-error :component c :operation o)))
56
57 ;;; System definition
58
59 #+(or allegro lispworks cmu sbcl openmcl mcl scl)
60 (defsystem :clsql-mysql
61   :name "cl-sql-mysql"
62   :author "Kevin M. Rosenberg <kmr@debian.org>"
63   :maintainer "Kevin M. Rosenberg <kmr@debian.org>"
64   :licence "Lessor Lisp General Public License"
65   :description "Common Lisp SQL MySQL Driver"
66   :long-description "cl-sql-mysql package provides a database driver to the MySQL database system."
67
68   :components
69   ((:module :db-mysql
70             :components
71             ((:clsql-mysql-source-file "mysql")
72              (:file "mysql-package")
73              (:file "mysql-loader" :depends-on ("mysql-package" "mysql"))
74              (:file "mysql-api" :depends-on ("mysql-loader"))
75              (:file "mysql-sql" :depends-on ("mysql-api"))
76              (:file "mysql-usql" :depends-on ("mysql-sql")))))
77   :depends-on (:uffi :clsql-base :clsql-uffi))