/[elephant]/elephant/ele-bdb.asd
ViewVC logotype

Contents of /elephant/ele-bdb.asd

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.28 - (show annotations)
Mon May 7 20:28:30 2007 UTC (6 years, 11 months ago) by ieslick
Branch: MAIN
CVS Tags: ELEPHANT-0-9, HEAD
Changes since 1.27: +1 -1 lines
Enable -l option for linux builds
1 ;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;
3 ;;; elephant.asd -- ASDF system definition for elephant
4 ;;;
5 ;;; Initial version 8/26/2004 by Ben Lee
6 ;;; <blee@common-lisp.net>
7 ;;;
8 ;;; part of
9 ;;;
10 ;;; Elephant: an object-oriented database for Common Lisp
11 ;;;
12 ;;; Copyright (c) 2004 by Andrew Blumberg and Ben Lee
13 ;;; <ablumberg@common-lisp.net> <blee@common-lisp.net>
14 ;;;
15 ;;; Elephant users are granted the rights to distribute and use this software
16 ;;; as governed by the terms of the Lisp Lesser GNU Public License
17 ;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
18
19 (in-package :cl-user)
20
21 ;; Forward def
22 (defpackage elephant-system
23 (:use :cl :asdf)
24 (:export :elephant-c-source :compiler-options :foreign-libraries-to-load-first :get-config-option))
25
26 (defpackage ele-bdb-system
27 (:use :cl :asdf :elephant-system))
28
29 (in-package :ele-bdb-system)
30
31 ;;
32 ;; Compile bdb lib and load libraries
33 ;;
34
35
36 #+(or windows mswindows)
37 (defun path-for-cygwin (path)
38 "DOS pathname -> cygwin pathname. Replace backslashes with slashes and drive letter with directory.
39 e.g. \"C:\\dir\\\" -> \"/cygdrive/C/dir/\" "
40 (let* ((result (namestring path))
41 (colon-pos (position #\: result))
42 (drive-letter (char result (1- colon-pos))))
43 (setf (char result (1- colon-pos)) #\/)
44 (setf (char result colon-pos) drive-letter)
45 (setf result (concatenate 'string "/cygdrive" result))
46 (substitute #\/ #\\ result)))
47
48 ;; Forward def
49 (defclass elephant-c-source (c-source-file) ())
50
51 (defclass bdb-c-source (elephant-c-source) ())
52
53 (defmethod compiler-options ((compiler (eql :gcc)) (c bdb-c-source) &key &allow-other-keys)
54 (append (library-directories c)
55 (call-next-method)
56 (list (format nil "-l~A" (get-db-name c)))))
57
58 (defun get-db-name (c)
59 (subseq (pathname-name
60 (make-pathname :defaults (get-config-option :berkeley-db-lib c)) )
61 3))
62
63 (defmethod compiler-options ((compiler (eql :cygwin)) (c bdb-c-source) &key &allow-other-keys)
64 (append (library-directories c)
65 (list "-ldb45")
66 (call-next-method)))
67
68 (defun library-directories (c)
69 (let ((include (make-pathname :defaults (get-config-option :berkeley-db-include-dir c)))
70 (lib (make-pathname :defaults (get-config-option :berkeley-db-lib-dir c))))
71 #+(or windows mswindows)
72 (list (format nil "-L'~A'" (path-for-cygwin lib))
73 (format nil "-I'~A'" (path-for-cygwin include)))
74 #-(or windows mswindows)
75 (list (format nil "-L~A" lib) (format nil "-I~A" include))))
76
77 (defmethod foreign-libraries-to-load-first ((c bdb-c-source))
78 (remove-if #'(lambda (x) (null (car x)))
79 (list (cons (get-config-option :pthread-lib c) "pthread")
80 (cons (get-config-option :berkeley-db-lib c)
81 (get-config-option :berkeley-db-lib c)))))
82
83 ;;
84 ;; System definition
85 ;;
86
87 (defsystem ele-bdb
88 :name "elephant"
89 :author "Ben Lee <blee@common-lisp.net>"
90 :version "0.6.0"
91 :maintainer "Ben Lee <blee@common-lisp.net>"
92 :licence "LLGPL"
93 :description "Object database for Common Lisp"
94 :long-description "An object-oriented database based on Berkeley DB, for CMUCL/SBCL, OpenMCL, and Allegro."
95 :components
96 ((:module :src
97 :components
98 ((:module :db-bdb
99 :components
100 ((:file "package")
101 (:bdb-c-source "libberkeley-db")
102 (:file "berkeley-db")
103 (:file "bdb-controller")
104 (:file "bdb-slots")
105 (:file "bdb-collections")
106 (:file "bdb-transactions"))
107 :serial t))))
108 :depends-on (:uffi :elephant))
109

  ViewVC Help
Powered by ViewVC 1.1.5