X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=clsql-mysql.asd;h=72b961f0108b54e10a399d70ac3c4fc23e35075b;hb=614e68954c499aa0424c70245b4b33c8b5ba8687;hp=06d975036b9c09cfb8e51a9f19889f54f9ceb42b;hpb=bada52b7a8fd2cc484dee33cccd64ca09a52ec3d;p=clsql.git diff --git a/clsql-mysql.asd b/clsql-mysql.asd index 06d9750..72b961f 100644 --- a/clsql-mysql.asd +++ b/clsql-mysql.asd @@ -19,6 +19,53 @@ (defpackage #:clsql-mysql-system (:use #:asdf #:cl)) (in-package #:clsql-mysql-system) +(eval-when (:compile-toplevel :load-toplevel :execute) + #+common-lisp-controller (require 'uffi) + #-common-lisp-controller (asdf:operate 'asdf:load-op 'uffi)) + +(defvar *library-file-dir* (append (pathname-directory *load-truename*) + (list "db-mysql"))) + +(defclass clsql-mysql-source-file (c-source-file) + ()) + +(defmethod output-files ((o compile-op) (c clsql-mysql-source-file)) + (let* ((library-file-type + (funcall (intern (symbol-name'#:default-foreign-library-type) + (symbol-name '#:uffi)))) + (found (some #'(lambda (dir) + (probe-file (make-pathname :directory dir + :name (component-name c) + :type library-file-type))) + '((:absolute "usr" "lib" "clsql"))))) + (list (if found + found + (make-pathname :name (component-name c) + :type library-file-type + :directory *library-file-dir*))))) + +(defmethod perform ((o load-op) (c clsql-mysql-source-file)) + nil) ;;; library will be loaded by a loader file + +(defmethod operation-done-p ((o load-op) (c clsql-mysql-source-file)) + nil) + +(defmethod perform ((o compile-op) (c clsql-mysql-source-file)) + #-(or win32 mswindows) + (unless (zerop (run-shell-command + #-freebsd "cd ~A; make" + #+freebsd "cd ~A; gmake" + (namestring (make-pathname :name nil + :type nil + :directory *library-file-dir*)))) + (error 'operation-error :component c :operation o))) + +(defmethod operation-done-p ((o compile-op) (c clsql-mysql-source-file)) + (let ((lib (make-pathname :defaults (component-pathname c) + :type (uffi:default-foreign-library-type)))) + (and (probe-file lib) + (> (file-write-date lib) (file-write-date (component-pathname c)))))) + ;;; System definition #+(or allegro lispworks cmu sbcl openmcl mcl scl) @@ -30,12 +77,13 @@ :description "Common Lisp SQL MySQL Driver" :long-description "cl-sql-mysql package provides a database driver to the MySQL database system." + :depends-on (uffi clsql-base clsql-uffi) :components ((:module :db-mysql :components - ((:file "mysql-package") - (:file "mysql-loader" :depends-on ("mysql-package")) - (:file "mysql-api" :depends-on ("mysql-loader")) - (:file "mysql-sql" :depends-on ("mysql-api")) - (:file "mysql-usql" :depends-on ("mysql-sql"))))) - :depends-on (:uffi :clsql-base :clsql-uffi)) + ((:clsql-mysql-source-file "mysql") + (:file "mysql-package") + (:file "mysql-loader" :depends-on ("mysql-package" "mysql")) + (:file "mysql-client-info" :depends-on ("mysql-loader")) + (:file "mysql-api" :depends-on ("mysql-client-info")) + (:file "mysql-sql" :depends-on ("mysql-api"))))))