Subject: [PATCH] meson.build: improve handling of vapi
From: "Marty E. Plummer" <[email-masked]>
Date: Sun, 13 Jan 2019 13:33:32 -0600

As it currently stands the vapi files are not generatable on linux
distros which do not provide unversioned valac/vapigen. Use instead
meson's add_languages function to handle detection of existing vala
toolchain, which will check the VALAC and VAPIGEN env vars.

Signed-off-by: Marty E. Plummer <[email-masked]>

--- a/meson.build
+++ b/meson.build
@@ -6,11 +6,9 @@ exiv2 = dependency('exiv2', version : '>
 gobject = dependency('gobject-2.0', version : '>= 2.38.0')
 
 gir = find_program('g-ir-scanner', required: false)
-vapigen = find_program('vapigen', required: false)
-vala = find_program('valac', required: false)
 
 introspection_available = gir.found() and get_option('introspection')
-vapi_available = introspection_available and vapigen.found() and get_option('vapi')
+vapi_available = introspection_available and add_languages('vala', required: false) and get_option('vapi')
 
 subdir('gexiv2')
 
--- a/test/meson.build
+++ b/test/meson.build
@@ -17,15 +17,11 @@ regression_test = executable('gexiv2-reg
 test('regression', regression_test, env : test_env)
 
 if vapi_available
-  valac = find_program('valac')
-  if valac.found()
-    add_languages('vala')
-    executable('gexiv2-dump',
-               'gexiv2-dump.vala',
-               include_directories : include_directories('..'),
-               dependencies : [gobject, vapi],
-               link_with : gexiv2)
-  endif
+  executable('gexiv2-dump',
+             'gexiv2-dump.vala',
+             include_directories : include_directories('..'),
+             dependencies : [gobject, vapi],
+             link_with : gexiv2)
 endif
 
 if python2_available