[gtksourceview: 1/3] meson: Use a feature option for introspection




commit d8ba9e40018154bb86cf5b900a9432a714c48153
Author: Xavier Claessens <xavier claessens collabora com>
Date:   Mon Mar 8 19:39:26 2021 -0500

    meson: Use a feature option for introspection
    
    This copy the same behaviour as in gtk4 and all its dependencies. It fix
    the build for example on Windows where gobject-introspection is not
    usually available.

 .gitlab-ci.yml    | 2 +-
 README.win32      | 1 -
 meson.build       | 3 ++-
 meson_options.txt | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e0c8164e..d1cbc0cb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -31,7 +31,7 @@ reference:
         - dnf update -y --nogpgcheck
         - dnf install -y --nogpgcheck $FEDORA_DEPS
         - mkdir -p pfx/
-        - meson ${MESON_FLAGS} --prefix=${PWD}/pfx -Dgtk_doc=true -Dgir=false _build
+        - meson ${MESON_FLAGS} --prefix=${PWD}/pfx -Dgtk_doc=true _build
         - ninja -C _build install
         - mkdir -p _reference/
         - mv pfx/share/gtk-doc/html/gtksourceview-5.0 _reference/
diff --git a/README.win32 b/README.win32
index 891671ef..7e327fcc 100644
--- a/README.win32
+++ b/README.win32
@@ -48,7 +48,6 @@ To build GtkSourceView, do the following:
   --backend=vs: Generate Visual Studio projects for building on Visual Studio 2010, 2015
                 2017, 2019.  This will remove the need for Ninja.  Please note that the
                 generated project files are only valid on the machine they are generated.
-  -Dgir=false: Disable introspection builds.
 
 -If the previous command completed successfully, carry out the build by running 'ninja' or
  by opening and building the projects with the generated Visual Studio projects, if using
diff --git a/meson.build b/meson.build
index 72308550..678c16a5 100644
--- a/meson.build
+++ b/meson.build
@@ -59,7 +59,8 @@ testdatadir = join_paths(datadir, 'installed-tests', package_string)
 docpath = join_paths(datadir, 'gtk-doc', 'html', package_string)
 
 # Options
-generate_gir = get_option('gir')
+gir = find_program('g-ir-scanner', required : get_option('introspection'))
+generate_gir = gir.found() and (not meson.is_cross_build() or get_option('introspection').enabled())
 generate_vapi = generate_gir and get_option('vapi')
 build_gtk_doc = get_option('gtk_doc')
 
diff --git a/meson_options.txt b/meson_options.txt
index 443f0476..292a41a9 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -2,8 +2,8 @@ option('install_tests',
        type: 'boolean', value: false,
        description: 'Install test programs')
 
-option('gir',
-       type: 'boolean', value: true,
+option('introspection',
+       type: 'feature', value: 'auto',
        description: 'Generate gir data (requires gobject-introspection)')
 
 option('vapi',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]