by baggers
It's been an mixed affair this week. The first bit was good news: shipshape, my library for shipping lisp binaries with C dependencies, works on OSX! You can now write a little manifest like this:
(def-shipping-manifest :vacuum vacuum
:compression -1
:libs-to-include (cl-soil::soil
(sdl2-mixer::libsdl2-mixer :recur)
(sdl2::libsdl2 :recur))
"media/")
And it will do the following of the libs-to-include
:
brew
or macports
, copy it too.It also checks if any of the lisp dependencies define their own 'shipping-manifest' and it they do it handles those correctly as well.
This was a bit of a bitch as not only do you have to move the libs you also have to modify them as they contain OSX specific search path info inside them that needs to be corrected. This along with the walking took a long time to get right.
A friend and avid lisp coder had ranted recently on how hard it still is to get good portable libraries in lisp. As he has a bunch of overlapping code with my shipshape project above I made a little project so we could collaborate. He then made it very clear he wasnt interested..so there goes that idea :D
I'm still going to keep it and flesh it out, but it's a bit of a shame.
With that fresh in mind I sat down on Sunday and decided to do something different. I wanted to play with a physics engine. In this case ODE and hooray, there is a library for it already, no docs but it's easy enough to read, so I dived in.
..And it was kind of a bummer. I really wanted to play but I had seen how the sausage was being made, and it was being made very inefficiently. So some sighing later I decide to fix it up, but I cant just change the whole api and send one fucking massive pull request so I start splitting it into a lower-level bindings section and keep the rest as it is.
I spent a good chunk of the day on this. I got confused at one point where I thought that fixing it would be impossible without breaking everything..This caused me to grab swig and start my own bindings.. But then I realised I had read the code wrong so I went back to cleaning.
I finally got it looking ok and spun it off into it's own project: cl-ode-lower-levels. When I was starting to get pretty happy I started thinking that there might be some functions missing. So I grabbed my swig
dump from before and compared the numbers of functions defined. This bloody thing was missing over 400 functions!
FAAAAAACK
I couldn't just add the definitions from swig
as swig
cant read C deftype forms so there were a lot of functions taking pointers when they should have been taking more specific types (these worked but mean lisp cant check the types or tell the user what they should be).
This meant I would have to update all the definitions by hand.. and yeah.. fuck that.
So that was again a bummer, I had wanted to not duplicate work and I had again got to a place where I would just need to do it myself. Ah well.
So today (monday) I tried to use a tool I have never got to build before, autowrap. It uses clang and a small definition file to generate full bindings for a library. I had spent days before trying to compile it on different platforms and failed miserably, however today.. IT WORKED!
I then wrote 40 lines of code and it generate the entire project. Seriously, it's great. And it's a macro so it literally is just written in regular code.
And that's where I am now. I have a project that is just the bindings and I am starting another project called lode
which will provide minimal abstractions over those bindings.
So a mixed but overall successful time. Looking forward to reading your posts now.
Ciao