From 915ab35e96897e1d04cc5205c46e5256e14bd73b Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Thu, 27 Jul 2017 16:48:11 +0800 Subject: [PATCH] meson: Install items according to their relevance The m4 and bash completion items are usable and relevant depending on the host system's configuration. So, we check for the presence of the programs that these items depend on, and only install them when those programs are found. For the Valgrind suppression files, we don't install them on Windows as Valgrind is currently not supported on Windows. Als fix the path where the GDB helpers are installed, as the path is incorrectly constructed. This will fix the "install" stage when building on Visual Studio at least as there are some post-install steps that are related to them, which will make use of these programs. https://bugzilla.gnome.org/show_bug.cgi?id=783270 --- gio/meson.build | 16 +++++++++------- glib/meson.build | 3 ++- gobject/meson.build | 2 +- meson.build | 37 +++++++++++++++++++++++++------------ 4 files changed, 37 insertions(+), 21 deletions(-) diff --git a/gio/meson.build b/gio/meson.build index eae9bada8..325263626 100644 --- a/gio/meson.build +++ b/gio/meson.build @@ -693,13 +693,15 @@ endif # subdir('fam') #endif -install_data([ - 'completion/gapplication', - 'completion/gdbus', - 'completion/gsettings', - 'completion/gresource' -], -install_dir: join_paths(get_option('datadir'), 'bash-completion/completions')) +if have_bash + install_data([ + 'completion/gapplication', + 'completion/gdbus', + 'completion/gsettings', + 'completion/gresource' + ], + install_dir: join_paths(get_option('datadir'), 'bash-completion/completions')) +endif if enable_dtrace gio_dtrace_obj = dtrace_obj_gen.process('gio_probes.d') diff --git a/glib/meson.build b/glib/meson.build index a99201a90..1da0bcd3c 100644 --- a/glib/meson.build +++ b/glib/meson.build @@ -274,6 +274,7 @@ else endif install_data('gtester-report', install_dir : get_option('bindir')) + install_data('glib_gdb.py', install_dir : join_paths(glib_pkgdatadir, 'gdb')) gdb_conf = configuration_data() @@ -283,7 +284,7 @@ configure_file( output: 'libglib-2.0.so.@0@-gdb.py'.format(library_version), configuration: gdb_conf, install: true, - install_dir: join_paths(get_option('datadir'), 'gdb/auto-load' + glib_libdir) + install_dir: join_paths(get_option('datadir'), 'gdb/auto-load' + get_option('libdir')) ) if enable_systemtap diff --git a/gobject/meson.build b/gobject/meson.build index 0d39f2bbc..aecca57c7 100644 --- a/gobject/meson.build +++ b/gobject/meson.build @@ -102,7 +102,7 @@ configure_file( output: 'libgobject-2.0.so.@0@-gdb.py'.format(library_version), configuration: gdb_conf, install: true, - install_dir: join_paths(get_option('datadir'), 'gdb/auto-load/' + glib_libdir) + install_dir: join_paths(get_option('datadir'), 'gdb/auto-load/' + get_option('libdir')) ) if enable_systemtap diff --git a/meson.build b/meson.build index 0c8507d24..0f3f79178 100644 --- a/meson.build +++ b/meson.build @@ -1499,6 +1499,11 @@ endif python = import('python3').find_python() +# Determine which user environment-dependent files that we want to install +have_bash = find_program('bash', required : false).found() # For completion scripts +have_m4 = find_program('m4', required : false).found() # For m4 macros +have_sh = find_program('sh', required : false).found() # For glib-gettextize + # FIXME: defines in config.h that are not actually used anywhere # (we add them for now to minimise the diff) glib_conf.set('HAVE_DLFCN_H', 1) @@ -1608,19 +1613,27 @@ endforeach # NOTE: We skip glib-zip.in because the filenames it assumes don't match ours -# Install glib-gettextize executable -configure_file(input : 'glib-gettextize.in', - install : true, - install_dir : 'bin', - output : 'glib-gettextize', - configuration : glib_conf) +# Install glib-gettextize executable, if a UNIX-style shell is found +if have_sh + configure_file(input : 'glib-gettextize.in', + install : true, + install_dir : 'bin', + output : 'glib-gettextize', + configuration : glib_conf) +endif -# Install m4 macros that other projects use -install_data('m4macros/glib-2.0.m4', 'm4macros/glib-gettext.m4', 'm4macros/gsettings.m4', - install_dir : join_paths(get_option('datadir'), 'aclocal')) -# Install Valgrind suppression file -install_data('glib.supp', - install_dir : join_paths(get_option('datadir'), 'glib-2.0', 'valgrind')) +if have_m4 + # Install m4 macros that other projects use + install_data('m4macros/glib-2.0.m4', 'm4macros/glib-gettext.m4', 'm4macros/gsettings.m4', + install_dir : join_paths(get_option('datadir'), 'aclocal')) +endif + +if host_system != 'windows' + # Install Valgrind suppression file (except on Windows, + # as Valgrind is currently not supported on Windows) + install_data('glib.supp', + install_dir : join_paths(get_option('datadir'), 'glib-2.0', 'valgrind')) +endif configure_file(input : 'config.h.meson', output : 'config.h',