meson: build gir even when cross-compiling if introspection was enabled explicitly

This can be made to work in certain circumstances when
cross-compiling, so default to not building g-i stuff
when cross-compiling, but allow it if introspection was
enabled explicitly via -Dintrospection=enabled.

See gstreamer/gstreamer#454 and gstreamer/gstreamer#381.
This commit is contained in:
Tim-Philipp Müller 2019-10-18 00:39:12 +01:00
parent a40476914d
commit 97a4d0cd7d

View file

@ -411,7 +411,7 @@ python3 = import('python').find_installation()
gir = find_program('g-ir-scanner', required : get_option('introspection')) gir = find_program('g-ir-scanner', required : get_option('introspection'))
gnome = import('gnome') gnome = import('gnome')
build_gir = gir.found() and not meson.is_cross_build() build_gir = gir.found() and (not meson.is_cross_build() or get_option('introspection').enabled())
gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**);' + \ gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**);' + \
'g_setenv("GST_REGISTRY_1.0", "@0@", TRUE);'.format(meson.current_build_dir() + '/gir_empty_registry.reg') + \ 'g_setenv("GST_REGISTRY_1.0", "@0@", TRUE);'.format(meson.current_build_dir() + '/gir_empty_registry.reg') + \
'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \ 'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \