[libgee/meson: 21/21] Added infrastructure to disable introspection




commit 95877790ece2373d55c184e176c6114f611b77e2
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed Nov 22 18:03:21 2017 -0600

    Added infrastructure to disable introspection
    
    As for Meson 0.43.0, no way to prevent a generated
    GIR file to be installed in the system, even
    if disable-introspection=true is set.
    
    May this is not an issue as libgee generates
    header, VAPI and GIR, all of them needed when
    developing.
    
    Just in case g-ir-compiler is not found
    no typelib is generated and so introspection
    is incomplete any way. g-ir-compiler is
    installed with gobject-introspection package
    in almost all distributions.

 gee/meson.build   | 39 ++++++++++++++++++++++++++-------------
 meson_options.txt |  1 +
 2 files changed, 27 insertions(+), 13 deletions(-)
---
diff --git a/gee/meson.build b/gee/meson.build
index 6faaaf2..63b736f 100644
--- a/gee/meson.build
+++ b/gee/meson.build
@@ -105,6 +105,14 @@ if enable_consistency_check_opt
        enable_consistency_check_args += ['-D','CONSISTENCY_CHECKS']
 endif
 
+# Can't prevent install generated GIR file
+disable_introspection = get_option('disable-introspection')
+introspectiondir=false
+if disable_introspection
+else
+introspectiondir = join_paths (get_option('includedir'),'gee-@0@'.format (API_VERSION))
+endif
+
 gee = library('gee-@0@'.format(API_VERSION),
        valasources + sources,
        version : PROJECT_VERSION,
@@ -116,20 +124,25 @@ gee = library('gee-@0@'.format(API_VERSION),
        install : true,
        install_dir : [
                get_option('libdir'),
-               join_paths (get_option('includedir'),'gee-@0@'.format (API_VERSION)),
+               introspectiondir,
                true,
                true,
        ])
 
-g_ir_compiler = find_program('g-ir-compiler')
-custom_target('typelib',
-       command: [
-               g_ir_compiler,
-               '--shared-library', 'libgee-@0@.so'.format (API_VERSION),
-               '--output', '@OUTPUT@',
-               join_paths(meson.current_build_dir(), 'Gee-@0@.gir'.format(API_VERSION))
-       ],
-       output: 'Gee-@0@.typelib'.format(API_VERSION),
-       depends: gee,
-       install: true,
-       install_dir: join_paths(get_option('libdir'), 'girepository-1.0'))
+if disable_introspection
+else
+       g_ir_compiler = find_program('g-ir-compiler', required: false)
+       if g_ir_compiler.found()
+               custom_target('typelib',
+                       command: [
+                               g_ir_compiler,
+                               '--shared-library', 'libgee-@0@.so'.format (API_VERSION),
+                               '--output', '@OUTPUT@',
+                               join_paths(meson.current_build_dir(), 'Gee-@0@.gir'.format(API_VERSION))
+                       ],
+                       output: 'Gee-@0@.typelib'.format(API_VERSION),
+                       depends: gee,
+                       install: true,
+                       install_dir: join_paths(get_option('libdir'), 'girepository-1.0'))
+       endif
+endif
diff --git a/meson_options.txt b/meson_options.txt
index 70d5cda..3dae714 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -2,3 +2,4 @@ option('enable-benchmark', type : 'boolean', value : false, description : 'Enabl
 option('disable-internal-asserts', type : 'boolean', value : false, description : 'Disables the internal 
asserts')
 option('enable-consistency-check', type : 'boolean', value : false, description : 'Enables (very) expensive 
consistency checks. It might affect the asymptotic performance.')
 option('enable-doc', type : 'boolean', value : false, description : 'Enable documentation generation')
+option('disable-introspection', type : 'boolean', value : false, description : 'Disable introspection 
generation')


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