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