2009-12-23

Messing up with Vala (again)

First some good news. I didn't look close enough into the possibilities offered by Automake 1.11 when I first wrote the post about building Vala projects. Automake 1.11 is all about making releases without the end-users having to compile Vala! Just like it is written in the Automake documentation. From now on I will always apply this wherever it is possible.

I updated the Xfce4 Vala bindings with libraries from the 4.7 stack. In there I have updated the panel plugin example, and as you can see the Automake file is extremely short. When there is a SOURCES defined with a Vala file, Automake will create targets for each compiled program or library with Vala compilation, and generate one vala.stamp file per target. This has its pros and cons. In the case of the Notes plugin, this disallowed me to have a mix of only C written software and Vala inside the same directory. In reality I used to have a single main file for the panel plugin to compile to C either for the 4.7 version or prior. Automake makes the Vala specific targets visible outside the scope of the "if PANEL47 ... else ... end" block. I ended up with self-compiled Vala for each target in maintainer mode only, as previously, which is a small overhead for the specific targets.

Other nice thing about Vala is that bindings are just files. I compiled the Notes plugin for the Xfce 4.6 panel on my netbook just to verify everything is alright but unfortunately there were some problems. I bumped the required version of Vala to 0.7.8 which has GTK+ bindings for 2.18 already while I only have GTK+ 2.16 available. The simple thing to do was to download the GTK+ bindings from the version of Vala I used previously and copy them into a location of the project (or system wide).  As long as the Vala compiler knows where to pick them up (with "--vapidir=") it will choose them and not the ones provided by default. This makes it awesomely easy to provide customized bindings for example.

Vala can always be very time consuming, but I still like it! Just like git merge by the way.