Tuesday, December 2, 2008

The Portable proplib

Past month I decided that I'd like to do something in other OS != NetBSD, and by lack of development tools, performance and support, I decided to go with Linux (X window sucks, but what can we do?). So I was working in a new package system made from scratch with ideas from pkgsrc, ports, Compile from Gobolinux, Archlinux, etc.

The first implementation was called pkgfs, and it was only meant for NetBSD. It used db(1) files to handle build dependencies and registration of installed packages; this also used the native ftp(1) command to fetch source distribution files... after 1 week or so, I had a full X window system with latest Xorg, Gkrellm, GTK+, Firefox and others built with pkgfs.

Thanks to this I found a major bug in NetBSD's pthread library and ported the latest libpciaccess version from OpenBSD to NetBSD (that allows you to use Xorg's xserver 1.5.x on x86), amongst other things. Things were working wonderfully and even pkgfs was something like 30% faster than pkgsrc building from source... of course that was due to only add stuff for NetBSD and not other OSes.

But after some days and thinking about it, NetBSD wasn't suited for what I wanted to do. It's a marvellous OS but still needs many years of development to compare to current's Linux state. So with that idea in mind and some comments from a friend, I decided to give up definitely from NetBSD and switched to Linux.

I had to make radical changes to pkgfs to make it work on Linux, basically replacing the need for db(1) and ftp(1) , that aren't available in most Linux distributions. Talking with the same friend, we decided to go with SQLite to handle dependencies, and the idea wasn't really bad... but thinking about what I needed exactly once again, I thought the best was to use something simpler, without going to the SQL path.

db4 from Sleepycat (now Oracle), seemed ok but after looking at its API it was too complicated for my taste; so I decided to start with NetBSD's proplib! because I'm experienced with this library (see sysmon_envsys(9) and envstat(8) on NetBSD) and it's a very good piece of code. I started removing NetBSD related stuff, plus minor changes like strlcat() -> strncat() and voila, proplib was working fully in userspace on Linux; just what I wanted!

Because I feel bored I thought it was cool to make it build through GNU autotools (autoconf, automake and libtool) and I did it. With those changes the Portable proplib 0.1 version was released via Google Code.

That's the short history of the Portable proplib version. Today I incorported a bugfix that was committed some days ago to NetBSD's tree, changed the autoconf scripts to detect some more pthread required functions and released version 0.2. I'm using it currently for my new build package system for Linux xbps. I will talk about xbps in the next post perhaps.

If you want to use proplib on any other OS than NetBSD, try it! and let me know if it doesn't build or there is any problem, I'll fix it ASAP. Here are the links to the stuff I've been talking about:

The Portable proplib: http://code.google.com/p/portableproplib/
xtraeme's build package system: http://repo.or.cz/w/xbps.git

No comments: