1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
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
10 ;;;; This file, part of CLSQL, is Copyright (c) 2002-2010 by Kevin M. Rosenberg
12 ;;;; CLSQL users are granted the rights to distribute and use this software
13 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
14 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
15 ;;;; *************************************************************************
19 (defpackage clsql-uffi-system (:use #:asdf #:cl))
20 (in-package clsql-uffi-system)
22 (defvar *clsql-uffi-library-dir*
23 (merge-pathnames "uffi/"
24 (make-pathname :name nil :type nil :defaults *load-truename*)))
26 (defclass clsql-uffi-source-file (c-source-file)
30 (defmethod output-files ((o compile-op) (c clsql-uffi-source-file))
31 (let* ((library-file-type
32 (funcall (intern (symbol-name'#:default-foreign-library-type)
33 (symbol-name '#:uffi))))
36 (probe-file (make-pathname
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 :defaults *clsql-uffi-library-dir*)))))
47 (defmethod perform ((o load-op) (c clsql-uffi-source-file))
48 nil) ;;; library will be loaded by a loader file
50 (defmethod operation-done-p ((o load-op) (c clsql-uffi-source-file))
51 (and (find-package '#:clsql-uffi)
52 (symbol-function (intern (symbol-name '#:atol64)
53 (find-package '#:clsql-uffi)))
56 (defmethod perform ((o compile-op) (c clsql-uffi-source-file))
57 (unless (operation-done-p o c)
58 #-(or win32 win64 windows mswindows)
59 (unless (zerop (run-shell-command
60 #-(or freebsd netbsd) "cd ~A; make"
61 #+(or freebsd netbsd) "cd ~A; gmake"
62 (namestring *clsql-uffi-library-dir*)))
63 (error 'operation-error :component c :operation o))))
65 (defmethod operation-done-p ((o compile-op) (c clsql-uffi-source-file))
66 (or (and (probe-file #p"/usr/lib/clsql/clsql_uffi.so") t)
67 (let ((lib (make-pathname :defaults (component-pathname c)
68 :type (funcall (intern (symbol-name '#:default-foreign-library-type)
69 (find-package '#:uffi))))))
70 (and (probe-file lib) (probe-file (component-pathname c))
71 (> (file-write-date lib) (file-write-date (component-pathname c)))))))
75 :author "Kevin M. Rosenberg <kmr@debian.org>"
76 :maintainer "Kevin M. Rosenberg <kmr@debian.org>"
77 :licence "Lessor Lisp General Public License"
78 :description "Common UFFI Helper functions for Common Lisp SQL Interface Library"
79 :long-description "cl-sql-uffi package provides common helper functions using the UFFI for the CLSQL package."
81 :depends-on (clsql #-:clsql-cffi (:version uffi "2.0")
82 #+:clsql-cffi cffi-uffi-compat)
87 ((:file "clsql-uffi-package")
88 (:clsql-uffi-source-file "clsql_uffi" :depends-on ("clsql-uffi-package"))
89 (:file "clsql-uffi-loader" :depends-on ("clsql-uffi-package" "clsql_uffi"))
90 (:file "clsql-uffi" :depends-on ("clsql-uffi-loader"))))))