r8270: fix loading on non-linux platforms
[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 *library-file-dir* (append (pathname-directory *load-truename*)
23                                    (list "db-mysql")))
24
25 (defclass clsql-mysql-source-file (c-source-file)
26   ())
27
28 (defmethod output-files ((o compile-op) (c clsql-mysql-source-file))
29   (let* ((library-file-type
30           (funcall (intern (symbol-name'#:default-foreign-library-type)
31                            (symbol-name '#:uffi))))
32          (found (some #'(lambda (dir)
33                             (probe-file (make-pathname :directory dir
34                                                        :name (component-name c)
35                                                        :type library-file-type)))
36                         '((:absolute "usr" "lib" "clsql"))))) 
37     (list (if found
38               found
39               (make-pathname :name (component-name c)
40                              :type library-file-type
41                              :directory *library-file-dir*)))))
42
43 (defmethod perform ((o load-op) (c clsql-mysql-source-file))
44   nil) ;;; library will be loaded by a loader file
45
46 (defmethod perform ((o compile-op) (c clsql-mysql-source-file))
47   (unless (zerop (run-shell-command
48                   "cd ~A; make"
49                   (namestring (make-pathname :name nil
50                                              :type nil
51                                              :directory *library-file-dir*))))
52     (error 'operation-error :component c :operation o)))
53
54 ;;; System definition
55
56 #+(or allegro lispworks cmu sbcl openmcl mcl scl)
57 (defsystem :clsql-mysql
58   :name "cl-sql-mysql"
59   :author "Kevin M. Rosenberg <kmr@debian.org>"
60   :maintainer "Kevin M. Rosenberg <kmr@debian.org>"
61   :licence "Lessor Lisp General Public License"
62   :description "Common Lisp SQL MySQL Driver"
63   :long-description "cl-sql-mysql package provides a database driver to the MySQL database system."
64
65   :components
66   ((:module :db-mysql
67             :components
68             ((:clsql-mysql-source-file "mysql")
69              (:file "mysql-package")
70              (:file "mysql-loader" :depends-on ("mysql-package" "mysql"))
71              (:file "mysql-api" :depends-on ("mysql-loader"))
72              (:file "mysql-sql" :depends-on ("mysql-api"))
73              (:file "mysql-usql" :depends-on ("mysql-sql")))))
74   :depends-on (:uffi :clsql-base :clsql-uffi))