On Sun, 2010-01-24 at 21:02 +0100, Tamas Papp wrote:
Hi,
I am the author of the cl-cairo2 library. Cairo itself is a graphics library, and my library provides a Lisp interface.
Some of the features (eg drawing in X11, Windows or Quartz) are platform dependent. Currently, the approach of cl-cairo2 is to provide extra system definitions for these, eg an X11 user would load the systems cl-cairo2 and cl-cairo2-x11 manually. I am wondering if there is a better way to do platform-dependent loading.
The solution I was thinking of was to try loading the platform dependent shared C libraries using CFFI, and set some flag (or push something to *features*) if they succeed, but if they fail, capture the condition with handler-case and just proceed with a warning. Then I could load platform-dependent code conditionally on this --- but I don't know how to do that in ASDF.
Please tell me what is the "right way" to do these things (ie stuff that I put in features). Examples of libraries that load platform-dependent code conditionally with ASDF would also help.
I'd suggest something like this: rename cl-cairo2 to cl-cairo2-base, make cl-cairo2-{mac,win,x11} depend on cl-cairo2-base and add an empty system cl-cairo2 that :depends-on (#+darwin :cl-cairo2-mac #+windows :cl-cairo2-win #+(and unix (not darwin)) :cl-cairo2-x11)