After some time I decided to modify the generated .vapi file manually, started reading the Vala Tutorial, and *et voilĂ *! the human modified vapi file works enough for simple test code.
This is the test code I used (please don't laugh, I've just started playing with Vala). This code just prints the value of the "pkgver" string object from plist file specified in argv[1]. The .vapi files is what specifies how to transform the Vala code into C code. The Vala bindings for the portable proplib can be found on: http://xbps.nopcode.org/distfiles/proplib.vapi
using PropLib;To compile the source code use the following command (make sure that you have portable proplib installed with pkgconfig support):
int main(string[] args) {
unowned PDict pkgd;
string val = null;
pkgd = prop_dictionary_internalize_from_zfile(args[1]);
if (prop_dictionary_get_cstring_nocopy(pkgd, "pkgver", out val) == false) {
stderr.printf("Missing pkgver obj\n");
return 1;
}
prop_object_release((PObject)pkgd);
stdout.printf("%s\n", val);
return 0;
}
$ valac --pkg proplib --vapidir=. test.valaIf you've built successfully it should print something like:
$ ./test /var/db/xbps/metadata/kernel/props.plist
kernel-3.2.1
$