Some Arch Linux packages

I've got a few packages in AUR. A couple of days ago someone emailed me about my package for osm-gps-map, asking why the Python bindings weren't installed - simple, they're in a separate source tarball. So, I set about figuring out how to get them to work in Arch since they expect Python 2.x and Arch uses Python 3 by default.

The first thing I noticed was that someone had flagged my osm-gps-map package as being out of date. As indeed it was, since 0.7.3 had come out and I was still packaging 0.7.2! So, a quick tweak of the PKGBUILD file to give it the new version number and new md5sum for the source tarball, and it was all up to date again. Now, Arch has a package of developer tools that allow you to set up a clean chroot for building packages. This means that your package is treated as if it's being installed on a brand-new bare install of Arch, and it must specify all its dependencies. If you don't do this, it's easy to miss off some deps, especially if they're ones you add early on when you install a machine. So, I checked it against a clean chroot, it build correctly, I built the source package, great. Done.

So onto the Python libs. The README for it suggests using the normal autotools ./configure && make && make install dance for Linux, and python setup.py install for Windows. A long sojourn into the depths of autotools got it to the point where it would try to build against Python 3, because that's what AM_PATH_PYTHON() detected. You can specify a version, but it only picks up a minimum version number, so setting it to 2.7 meant that 3 was detected and off it went, using Python 3. Not what I wanted. Suffice it to say that this sort of nonsense took up quite a lot of my evening and depleted both my patience and stock of not-recently-used rude words. Out of interest I tried the normal Python setuptools stuff with python2 setup.py install and it worked. Hrm. I should try the totally obvious first, shouldn't I? I grabbed the Python PKGBUILD proto file (the pacman package comes with a bunch of these, for various different use cases) and set it all up. ran it through the clean chroot, and that worked. Great, job done, so I uploaded the python-osmgpsmap package to AUR.

Now, I've been playing about with displaying APRS tracks on an osm-gps-map layer, and to get the APRS data I've been using APRS-IS and just pulling it from that interwebs, and running it through libfap (stop sniggering) to parse out the packets. Of course libfap had come on quite a bit since I last played with it so I updated from 0.9 to 1.1 and this was also not without its drama. I did actually test my libfap package in the clean chroot, and it built correctly. I'd done something stupid, though. Lots of packages use pkg-config to describe the flags needed to compile and link properly. This saves you having to code a lot of stuff into your configure scripts, since then you can say (you can try this at home) pkg-config zlib --libs which should respond -lz which is what you'd pass to gcc to compile in zlib supprt. Awesome. Of course I'd forgotten to change the version in the libfap.pc file I'd created from 0.9 to 1.1 so it wasn't detected as the right version, but I changed that and uploaded a corrected PKGBUILD.

The last package of the evening was Xastir 2.0.0 which presented a really interesting problem when I went to build it. The Arch Linux packaging system sets the DESTDIR environment variable before calling make install but it turns out that Xastir's configure script doesn't obey DESTDIR entirely. After a bit of faffing I discovered the problem where a couple of paths were incorrectly defined. Of course simply editing a local copy of Makefile.am won't do it, so I used diff to create a patch, and added a line in the PKGBUILD to automatically patch it for me. Once again, a quick trot through the clean chroot build process, and I had a working Xastir 2.0.0 package.

One of the great things about Arch and AUR is that it's so immediate and accessible if you want to create your own packages. I always found the Debian package building process a bit tedious and user-opaque - there seems to be a lot of mystic lore around it, although I haven't looked at it for a while and it might have changed.

It's nice to be able to directly contribute back to the distro I use.

Posted by gordonjcp on May 3, 2011

Comments

Comments are closed

To prevent spam, comments are no longer allowed after sixty days.