May 17, 2008

Forking cl-sdl

Yes, the title says it all: I'm going to work on a custom version of cl-sdl. Hold your "shenanigans", because I will do it in the easiest way possible. First question is why do it at all ? Well, I want to integrate my sdl/aqua fix (see previous post) into cl-sdl, but that's not really a good reason. A much better reason is that cl-sdl is not being actively maintained anymore. The last release stems from end 2002, and the mailing lists are virtually dormant. OpenGL support is stuck at version 1.2, with a comment on 1.3 but no further development. This last fact is especially bothersome as I want to use any OpenGL functionality I have available on my machine, not just what cl-sdl is offering. The most important reason however, is to fix the installation problems I have had. I'll need this when I want to start sharing my engine with other people. If they can't even get the OpenGL binding going then I'll have a hard time getting them to test my real code. So how to do it easily and keep the effort at a minimum ? As for integrating the sdl/aqua fix and correcting the installation, I think that is just a one-time investment and I should just do it. The bigger bother is keeping the package to move along with new versions of OpenGL, but I think I can automate much of that process. You see, at the core of cl-sdl are UFFI bindings which basically offer a lispy description of whatever is in the OpenGL library. Someone needs to make this description and then you can use whatever is in that library. Really cool, but maintaining that description can be quite bothersome. It should however be possible to generate most of that description automatically. Simply parse the relevant header file and translate it into the equivalent UFFI code. This is what I have been experimenting with, and it seems to be quite doable. Sofar I have a tool which processes most of the gl.h header, and which generates a UFFI which is close enough to what is in cl-sdl to be almost indistinguishable; except that it now also has OpenGL 1.3 functionality. This is giving me good hopes of getting it working, and will mean that when there is a new OpenGL header I can just rerun my tool and I'll be instantly up-to-date. (As a possible bonus it might be possible to use the same generator script against other headers which will allow me to interface with many other interesting C libraries. There's nothing I need right away, but it might prove a time-saver in the future.) The todo now is to finish of a first version of the tool and then verify that its output still produces a working cl-sdl.

No comments: