1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
diff -ur clsql-3.6.3.orig/db-mysql/mysql-loader.lisp clsql-3.6.3/db-mysql/mysql-loader.lisp
--- clsql-3.6.3.orig/db-mysql/mysql-loader.lisp 2005-07-05 19:51:52.000000000 -0500
+++ clsql-3.6.3/db-mysql/mysql-loader.lisp 2006-07-10 00:42:56.000000000 -0500
@@ -18,17 +18,6 @@
(in-package #:mysql)
-(defparameter *clsql-mysql-library-candidate-names*
- (list #+(or 64bit x86-64) "clsql_mysql64"
- #+(or 64bit x86-64) (make-pathname :name "clsql_mysql64"
- :directory (pathname-directory *load-truename*))
- "clsql_mysql"
- (make-pathname :name "clsql_mysql"
- :directory (pathname-directory *load-truename*))))
-
-(defvar *mysql-library-candidate-names*
- '("libmysqlclient" "libmysql"))
-
(defvar *mysql-supporting-libraries* '("c")
"Used only by CMU. List of library flags needed to be passed to ld to
load the MySQL client library succesfully. If this differs at your site,
@@ -41,12 +30,16 @@
*mysql-library-loaded*)
(defmethod clsql-sys:database-type-load-foreign ((database-type (eql :mysql)))
- (clsql-uffi:find-and-load-foreign-library *mysql-library-candidate-names*
- :module "mysql"
- :supporting-libraries *mysql-supporting-libraries*)
- (clsql-uffi:find-and-load-foreign-library *clsql-mysql-library-candidate-names*
- :module "clsql-mysql"
- :supporting-libraries *mysql-supporting-libraries*)
+ (uffi:load-foreign-library (make-pathname :directory '(:absolute "usr" "@LIBDIR@")
+ :name "libmysqlclient"
+ :type "so")
+ :module "mysql"
+ :supporting-libraries *mysql-supporting-libraries*)
+ (uffi:load-foreign-library (make-pathname :directory '(:absolute "usr" "@LIBDIR@" "clsql")
+ :name "clsql_mysql"
+ :type "so")
+ :module "clsql-mysql"
+ :supporting-libraries *mysql-supporting-libraries*)
(setq *mysql-library-loaded* t))
diff -ur clsql-3.6.3.orig/db-postgresql/postgresql-loader.lisp clsql-3.6.3/db-postgresql/postgresql-loader.lisp
--- clsql-3.6.3.orig/db-postgresql/postgresql-loader.lisp 2005-06-08 14:25:33.000000000 -0500
+++ clsql-3.6.3/db-postgresql/postgresql-loader.lisp 2006-07-10 00:47:40.000000000 -0500
@@ -33,9 +33,11 @@
(defmethod clsql-sys:database-type-load-foreign ((database-type
(eql :postgresql)))
- (clsql-uffi:find-and-load-foreign-library "libpq"
- :module "postgresql"
- :supporting-libraries *postgresql-supporting-libraries*)
+ (uffi:load-foreign-library (make-pathname :directory '(:absolute "usr" "@LIBDIR@")
+ :name "libpq"
+ :type "so")
+ :module "postgresql"
+ :supporting-libraries *postgresql-supporting-libraries*)
(setq *postgresql-library-loaded* t))
(clsql-sys:database-type-load-foreign :postgresql)
diff -ur clsql-3.6.3.orig/uffi/clsql-uffi-loader.lisp clsql-3.6.3/uffi/clsql-uffi-loader.lisp
--- clsql-3.6.3.orig/uffi/clsql-uffi-loader.lisp 2006-05-03 09:39:11.000000000 -0500
+++ clsql-3.6.3/uffi/clsql-uffi-loader.lisp 2006-07-10 00:44:58.000000000 -0500
@@ -18,35 +18,6 @@
(in-package #:clsql-uffi)
-(defun find-and-load-foreign-library (filenames &key module supporting-libraries (errorp t))
- "Attempt to load a foreign library. This will search for any of the filenames, as
-well as any of the filenames in any of the clsql:*foreign-library-search-paths*"
- (setq filenames (if (listp filenames) filenames (list filenames)))
-
- (flet ((try-load (testpath)
- (handler-case
- (uffi:load-foreign-library testpath
- :module module
- :supporting-libraries supporting-libraries)
- (error (c) (warn "~A" c) nil))))
- (or
- (loop for type in (uffi:foreign-library-types)
- thereis
- (loop for name in filenames
- for pn = (make-pathname :name name :type type)
- thereis (or
- (loop for search-path in clsql:*foreign-library-search-paths*
- thereis (try-load (merge-pathnames pn search-path)))
- (try-load pn))))
- (when errorp
- (error "Couldn't load foreign librar~@P ~{~S~^, ~}. (searched ~S)"
- (length filenames) filenames
- 'clsql:*foreign-library-search-paths*)))))
-
-(defvar *clsql-uffi-library-filenames*
- (list #+(or 64bit x86-64) "clsql_uffi64"
- "clsql_uffi"))
-
(defvar *clsql-uffi-supporting-libraries* '("c")
"Used only by CMU. List of library flags needed to be passed to ld to
load the MySQL client library succesfully. If this differs at your site,
@@ -57,10 +28,12 @@
(defun load-uffi-foreign-library ()
(clsql:push-library-path clsql-uffi-system::*clsql-uffi-library-dir*)
- (find-and-load-foreign-library *clsql-uffi-library-filenames*
- :module "clsql-uffi"
- :supporting-libraries
- *clsql-uffi-supporting-libraries*)
+ (uffi:load-foreign-library (make-pathname :directory '(:absolute "usr" "@LIBDIR@" "clsql")
+ :name "clsql_uffi"
+ :type "so")
+ :module "clsql-uffi"
+ :supporting-libraries
+ *clsql-uffi-supporting-libraries*)
(setq *uffi-library-loaded* t))
(load-uffi-foreign-library)
|