Re: How CLSQL finds and loads foreign libraries
Kevin Rosenberg <kevin-HJRc7zDS/[email protected]>
| Newsgroups | gmane.lisp.clsql.devel |
|---|---|
| Message-ID | <[email protected]> |
Edi Weitz wrote: > So, this technique would be rather easy to implement. But do I > understand you correctly that you wouldn't accept it because of the > Debian issues? No, I still think it's a good method to allow programatic end-user modification of the search paths. For Debian, or other pre-configured CLSQL packages which depends on a site specific path, and for which those paths are to be automatically available, a different technique will be required. 1. Define a universal CLSQL pathname that holds the site-specific files. Such as "/etc/clsql-library-paths.lisp" and have CLSQL add the directories specified in that file on startup. I suppose this could replace the above clsql:push-library-path method. But, I think it's reasonable to have this in addition. 2. Maintain a local patch for the site-specific package. For example, the debian package would have a patch as below[1]. What do you think of the these alternatives? Kevin [1] diff -ur clsql/db-mysql/mysql-loader.lisp clsql-debian/db-mysql/mysql-loader.lisp --- clsql/db-mysql/mysql-loader.lisp 2005-06-08 18:23:40.000000000 -0600 +++ clsql-debian/db-mysql/mysql-loader.lisp 2005-06-08 18:17:29.000000000 -0600 @@ -42,12 +42,14 @@ (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*) - (setq *mysql-library-loaded* t)) + :module "mysql" + :supporting-libraries *mysql-supporting-libraries*) + (if (probe-file #p"/usr/lib/clsql/clsql_mysql.so") + (uffi:load-foreign-library #p"/usr/lib/clsql/clsql_mysql.so") + (clsql-uffi:find-and-load-foreign-library *clsql-mysql-library-candidate-names* + :module "clsql-mysql" + :supporting-libraries *mysql-supporting-libraries*)) + (setq *mysql-library-loaded* t)) (clsql-sys:database-type-load-foreign :mysql) diff -ur clsql/uffi/clsql-uffi-loader.lisp clsql-debian/uffi/clsql-uffi-loader.lisp --- clsql/uffi/clsql-uffi-loader.lisp 2005-06-08 13:38:14.000000000 -0600 +++ clsql-debian/uffi/clsql-uffi-loader.lisp 2005-06-08 18:30:27.000000000 -0600 @@ -51,10 +51,12 @@ "T if foreign library was able to be loaded successfully") (defun load-uffi-foreign-library () - (find-and-load-foreign-library *clsql-uffi-library-filenames* - :module "clsql-uffi" - :supporting-libraries - *clsql-uffi-supporting-libraries*) + (if (probe-file #p"/usr/lib/clsql/clsql_uffi.so") + (uffi:load-foreign-library #p"/usr/lib/clsql/clsql_uffi.so") + (find-and-load-foreign-library *clsql-uffi-library-filenames* + :module "clsql-uffi" + :supporting-libraries + *clsql-uffi-supporting-libraries*)) (setq *uffi-library-loaded* t)) (load-uffi-foreign-library) -- Kevin Rosenberg kevin-HJRc7zDS/[email protected]