Source: maxice8
Upstream: not upstreamable in this condition, feel free to tidy it up and send it
Reason: allows cross-compilation

--- libgweather/meson.build
+++ libgweather/meson.build
@@ -65,26 +65,28 @@ lib_libgweather = shared_library('gweather-3',
   install: true,
 )
 
-gweather_gir = gnome.generate_gir(lib_libgweather,
-  sources: introspection_sources,
-  dependencies: deps_libgweather,
-  nsversion: '3.0',
-  namespace: 'GWeather',
-  includes: ['GObject-2.0', 'Gtk-3.0'],
-  symbol_prefix: 'gweather',
-  identifier_prefix: 'GWeather',
-  export_packages: 'gweather-3.0',
-  header: 'libgweather/gweather.h',
-  extra_args: ['--warn-all'],
-  install: true,
-)
-
-libgweather_dep = declare_dependency(
-  sources: [gweather_enum_types[1], gweather_gir],
-  dependencies: deps_libgweather,
-  link_with: lib_libgweather,
-  include_directories: root_inc,
-)
+if get_option('enable_gir')
+  gweather_gir = gnome.generate_gir(lib_libgweather,
+    sources: introspection_sources,
+    dependencies: deps_libgweather,
+    nsversion: '3.0',
+    namespace: 'GWeather',
+    includes: ['GObject-2.0', 'Gtk-3.0'],
+    symbol_prefix: 'gweather',
+    identifier_prefix: 'GWeather',
+    export_packages: 'gweather-3.0',
+    header: 'libgweather/gweather.h',
+    extra_args: ['--warn-all'],
+    install: true,
+  )
+  
+  libgweather_dep = declare_dependency(
+    sources: [gweather_enum_types[1], gweather_gir],
+    dependencies: deps_libgweather,
+    link_with: lib_libgweather,
+    include_directories: root_inc,
+  )
+endif
 
 if enable_vala
   gnome.generate_vapi('gweather-3.0',
@@ -97,31 +99,33 @@ endif
 
 test_cargs = ['-DTEST_SRCDIR="@0@/"'.format(meson.current_source_dir())]
 
-executable('test_locations',
-  ['test_locations.c'],
-  c_args: test_cargs,
-  dependencies: libgweather_dep,
-  install: false)
-executable('test_locations_utc',
-  ['test_locations_utc.c'],
-  c_args: test_cargs,
-  dependencies: libgweather_dep,
-  install: false)
-
-exe = executable('test_libgweather',
-  ['test_libgweather.c'],
-  c_args: test_cargs,
-  dependencies: libgweather_dep,
-  install: false)
-test('test_named_timezones', exe)
-
-executable('test_metar',
-  ['test_metar.c', gweather_c_sources],
-  c_args: test_cargs,
-  dependencies: libgweather_dep,
-  install: false)
-executable('test_sun_moon',
-  ['test_sun_moon.c', 'weather-sun.c', 'weather-moon.c'],
-  c_args: test_cargs,
-  dependencies: libgweather_dep,
-  install: false)
+if get_option('test')
+  executable('test_locations',
+    ['test_locations.c'],
+    c_args: test_cargs,
+    dependencies: libgweather_dep,
+    install: false)
+  executable('test_locations_utc',
+    ['test_locations_utc.c'],
+    c_args: test_cargs,
+    dependencies: libgweather_dep,
+    install: false)
+  
+  exe = executable('test_libgweather',
+    ['test_libgweather.c'],
+    c_args: test_cargs,
+    dependencies: libgweather_dep,
+    install: false)
+  test('test_named_timezones', exe)
+  
+  executable('test_metar',
+    ['test_metar.c', gweather_c_sources],
+    c_args: test_cargs,
+    dependencies: libgweather_dep,
+    install: false)
+  executable('test_sun_moon',
+    ['test_sun_moon.c', 'weather-sun.c', 'weather-moon.c'],
+    c_args: test_cargs,
+    dependencies: libgweather_dep,
+    install: false)
+endif
--- meson_options.txt
+++ meson_options.txt
@@ -8,3 +8,7 @@ option('enable_vala', type: 'combo', choices : ['true', 'false', 'auto'], value
        description: 'Install vala bindings')
 option('gtk_doc', type: 'boolean', value: false,
        description: 'Whether to generate the API reference')
+option('enable_gir', type: 'boolean', value: false,
+       description: 'Whether to generate gobject introspection data')
+option('test', type: 'boolean', value: false,
+       description: 'Whether to build test executables')
