[gobject-introspection] meson: address review comments



commit 284b4c828a84a776233fc21438640d974c52394d
Author: Alexander Kanavin <alex kanavin gmail com>
Date:   Fri Dec 13 17:33:43 2019 +0100

    meson: address review comments
    
    See here:
    https://gitlab.gnome.org/GNOME/gobject-introspection/merge_requests/64
    
    Particularly, options are renamed to make it more readable and clear.
    
    Signed-off-by: Alexander Kanavin <alex kanavin gmail com>

 gir/meson.build   | 45 ++++++++++++++++++++-------------------------
 meson.build       |  9 ++++++++-
 meson_options.txt | 10 +++++-----
 3 files changed, 33 insertions(+), 31 deletions(-)
---
diff --git a/gir/meson.build b/gir/meson.build
index a0280330..4ee224c7 100644
--- a/gir/meson.build
+++ b/gir/meson.build
@@ -41,29 +41,25 @@ gir_files = [
 typelibdir = join_paths(get_option('libdir'), 'girepository-1.0')
 install_data(gir_files, install_dir: girdir)
 
-if get_option('enable-host-gi')
+if get_option('cross_use_host_gi')
     scanner_command = [
       'g-ir-scanner',
-      '--output=@OUTPUT@',
-      '--no-libtool',
-      '--quiet',
-      '--reparse-validate',
-      '--add-include-path', join_paths(meson.current_build_dir()),
-      '--add-include-path', join_paths(meson.current_source_dir()),
     ]
 else
     scanner_command = [
       python,
       girscanner,
+    ]
+endif
+
+scanner_command += [
       '--output=@OUTPUT@',
       '--no-libtool',
       '--quiet',
       '--reparse-validate',
       '--add-include-path', join_paths(meson.current_build_dir()),
       '--add-include-path', join_paths(meson.current_source_dir()),
-    ]
-endif
-
+]
 
 dep_type = glib_dep.type_name()
 if dep_type == 'internal'
@@ -76,11 +72,11 @@ if dep_type == 'internal'
                       '--extra-library=glib-2.0', '--extra-library=gobject-2.0']
 endif
 
-if get_option('enable-gi-cross-wrapper') != ''
-  scanner_command += ['--use-binary-wrapper=' + get_option('enable-gi-cross-wrapper')]
+if get_option('cross_gi_binary_wrapper') != ''
+  scanner_command += ['--use-binary-wrapper=' + get_option('cross_gi_binary_wrapper')]
 endif
-if get_option('enable-gi-ldd-wrapper') != ''
-  scanner_command += ['--use-ldd-wrapper=' + get_option('enable-gi-ldd-wrapper')]
+if get_option('cross_gi_ldd_wrapper') != ''
+  scanner_command += ['--use-ldd-wrapper=' + get_option('cross_gi_ldd_wrapper')]
 endif
 # Take a glob and print to newlines
 globber = '''
@@ -108,8 +104,8 @@ glib_command = scanner_command + [
 
 if dep_type == 'pkgconfig'
   glib_command += ['--external-library', '--pkg=glib-2.0']
-  glib_libdir = get_option('pkgconfig-sysroot-path') + glib_dep.get_pkgconfig_variable('libdir')
-  glib_incdir = get_option('pkgconfig-sysroot-path') + 
join_paths(glib_dep.get_pkgconfig_variable('includedir'), 'glib-2.0')
+  glib_libdir = get_option('cross_pkgconfig_sysroot_path') + glib_dep.get_pkgconfig_variable('libdir')
+  glib_incdir = get_option('cross_pkgconfig_sysroot_path') + 
join_paths(glib_dep.get_pkgconfig_variable('includedir'), 'glib-2.0')
   glib_libincdir = join_paths(glib_libdir, 'glib-2.0', 'include')
   glib_files += join_paths(glib_incdir, 'gobject', 'glib-types.h')
   glib_files += join_paths(glib_libincdir, 'glibconfig.h')
@@ -364,7 +360,7 @@ if giounix_dep.found()
   dep_type = giounix_dep.type_name()
   if dep_type == 'pkgconfig'
     gio_command += ['--pkg=gio-unix-2.0']
-    giounix_includedir = get_option('pkgconfig-sysroot-path') + 
join_paths(giounix_dep.get_pkgconfig_variable('includedir'), 'gio-unix-2.0')
+    giounix_includedir = get_option('cross_pkgconfig_sysroot_path') + 
join_paths(giounix_dep.get_pkgconfig_variable('includedir'), 'gio-unix-2.0')
     # Get the installed gio-unix header list
     ret = run_command(python, '-c', globber.format(join_paths(giounix_includedir, 'gio', '*.h')))
     if ret.returncode() != 0
@@ -447,17 +443,16 @@ gir_files += custom_target('gir-girepository',
 )
 
 typelibs = []
-if get_option('enable-gi-cross-wrapper') != ''
-    gircompiler_command = [get_option('enable-gi-cross-wrapper'), gircompiler.full_path(), '-o', '@OUTPUT@', 
'@INPUT@',
-              '--includedir', meson.current_build_dir(),
-              '--includedir', meson.current_source_dir(),
-    ]
+if get_option('cross_gi_binary_wrapper') != ''
+    gircompiler_command = [get_option('cross_gi_binary_wrapper'), gircompiler.full_path(), ]
 else
-    gircompiler_command = [gircompiler, '-o', '@OUTPUT@', '@INPUT@',
+    gircompiler_command = [gircompiler, ]
+endif
+
+gircompiler_command += [ '-o', '@OUTPUT@', '@INPUT@',
               '--includedir', meson.current_build_dir(),
               '--includedir', meson.current_source_dir(),
-    ]
-endif
+]
 
 foreach gir : gir_files
   typelibs += custom_target('generate-typelib-@0@'.format(gir).underscorify(),
diff --git a/meson.build b/meson.build
index 03ab4176..031af630 100644
--- a/meson.build
+++ b/meson.build
@@ -196,10 +196,17 @@ endif
 subdir('girepository')
 subdir('tools')
 subdir('giscanner')
-if get_option('enable-introspection-data') == true
+
+# Not building gir data might be useful in cross-compilation
+# scenarios where running target binaries through software emulation
+# is not possible (due to the SW emulation missing support for target HW).
+if get_option('build_introspection_data') == true
     subdir('gir')
 endif
 subdir('docs')
+
+# The tests will also run, which is not possible if they
+# were built for a different architecture.
 if not meson.is_cross_build()
     subdir('tests')
 endif
diff --git a/meson_options.txt b/meson_options.txt
index 98491032..03096f5e 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -26,22 +26,22 @@ option('gir_dir_prefix', type: 'string',
   description: 'Intermediate prefix for gir installation under ${prefix}'
 )
 
-option('enable-host-gi', type: 'boolean', value : false,
+option('cross_use_host_gi', type: 'boolean', value : false,
   description: 'Use gobject introspection tools installed in the host system (useful when cross-compiling)'
 )
 
-option('enable-gi-cross-wrapper', type: 'string',
+option('cross_gi_binary_wrapper', type: 'string',
   description: 'Use a wrapper to run gicompiler and binaries produced by giscanner (useful when 
cross-compiling)'
 )
 
-option('enable-gi-ldd-wrapper', type: 'string',
+option('cross_gi_ldd_wrapper', type: 'string',
   description: 'Use a ldd wrapper instead of system ldd command in giscanner (useful when cross-compiling)'
 )
 
-option('enable-introspection-data', type: 'boolean', value : true,
+option('build_introspection_data', type: 'boolean', value : true,
   description: 'Build introspection data (.gir and .typelib files) in addition to library and tools'
 )
 
-option('pkgconfig-sysroot-path', type: 'string',
+option('cross_pkgconfig_sysroot_path', type: 'string',
   description: 'Specify a sysroot path to prepend to pkgconfig output (useful when cross-compiling)'
 )


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