I use the following wscript_build snippet to build a vala library with its gir file:
lib = bld.shlib (
features = 'c cshlib',
target = 'sample',
name = 'libsample',
vnum = '0.0.0',
vapi_dirs = '../vapi',
uselib = 'GTK',
cflags = ['-include', 'config.h'],
gir = 'Sample-1.0',
packages = 'gtk+-3.0',
packages_private = 'config',
source = bld.path.ant_glob (incl='**/*.vala'))
However now I'm wondering how to build a typelib from this gir file with waf?
The tool g-ir-compiler available in the debian package gobject-introspection converts a gir file to a typelib (also see this question)
Following task definition can be used within wscript_build to use this tool to build a typelib within waf and install such to /usr/lib/girepository-1.0 where it belongs.
lib_typelib = bld.new_task_gen(
name = 'libsample_typelib',
after = 'libsample',
source = 'Sample-1.0.gir',
target = 'Sample-1.0.typelib',
install_path = '${LIBDIR}/girepository-1.0',
rule='g-ir-compiler ${SRC} -o ${TGT}')
For a complete sample also see here