diff options
author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2023-04-05 17:07:58 +0200 |
---|---|---|
committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2023-04-14 19:20:51 +0200 |
commit | fcad56e3133c8d2e829f125c3d051eeb98474879 (patch) | |
tree | 1015a811cbe387b5eb61bef930a5d04d5573b243 | |
parent | 7fec23ed5e47992ae99c317b07733350280a3b84 (diff) | |
download | glib-fcad56e3133c8d2e829f125c3d051eeb98474879.tar.gz |
meson: Add glib_valgrind_suppressions variable to glib pkg-config file
Various projects are running tests under valgrind, and they are using
the GLib suppresions to avoid false-positive results.
While this is stored in a well-known path for some years, and easy to
figure out from the GLib prefix, it's better to expose it through a
proper pkgconfig variable so that it's easy to get it from any build
system.
-rw-r--r-- | glib/meson.build | 7 | ||||
-rw-r--r-- | meson.build | 9 | ||||
-rw-r--r-- | tools/meson.build | 4 |
3 files changed, 14 insertions, 6 deletions
diff --git a/glib/meson.build b/glib/meson.build index da76fc005..71427012a 100644 --- a/glib/meson.build +++ b/glib/meson.build @@ -441,9 +441,14 @@ pkg.generate(libglib, subdirs : ['glib-2.0'], extra_cflags : ['-I${libdir}/glib-2.0/include'] + win32_cflags, variables : ['bindir=' + join_paths('${prefix}', get_option('bindir')), + 'datadir=' + join_paths('${prefix}', get_option('datadir')), 'glib_genmarshal=' + join_paths('${bindir}', 'glib-genmarshal'), 'gobject_query=' + join_paths('${bindir}', 'gobject-query'), - 'glib_mkenums=' + join_paths('${bindir}', 'glib-mkenums')], + 'glib_mkenums=' + join_paths('${bindir}', 'glib-mkenums'), + 'glib_valgrind_suppressions=' + join_paths('${datadir}', + valgrind_suppression_file_install_subdir, + fs.name(valgrind_suppression_file)), + ], version : glib_version, install_dir : glib_pkgconfigreldir, filebase : 'glib-2.0', diff --git a/meson.build b/meson.build index 3576c5e6f..f1a959fb1 100644 --- a/meson.build +++ b/meson.build @@ -9,6 +9,8 @@ project('glib', 'c', ] ) +fs = import('fs') + cc = meson.get_compiler('c') c_standards = {} @@ -175,9 +177,10 @@ add_test_setup('unstable_tests', # Allow the tests to be easily run under valgrind using --setup=valgrind valgrind = find_program('valgrind', required: false) -if valgrind.found() - suppression_file = files('tools' / 'glib.supp') +valgrind_suppression_file = files('tools' / 'glib.supp')[0] +valgrind_suppression_file_install_subdir = 'glib-2.0' / 'valgrind' +if valgrind.found() add_test_setup('valgrind', exclude_suites: [ 'no-valgrind', 'flaky' ], exe_wrapper: [ @@ -191,7 +194,7 @@ if valgrind.found() '--show-leak-kinds=definite,possible', '--show-error-list=yes', '--suppressions=@0@'.format(meson.project_source_root() / - '@0@'.format(suppression_file[0])), + '@0@'.format(valgrind_suppression_file)), ], env: common_test_env, timeout_multiplier: 20, diff --git a/tools/meson.build b/tools/meson.build index 2d4192e46..e80d4be98 100644 --- a/tools/meson.build +++ b/tools/meson.build @@ -17,8 +17,8 @@ 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 : get_option('datadir') / 'glib-2.0' / 'valgrind', + install_data(fs.name(valgrind_suppression_file), + install_dir : get_option('datadir') / valgrind_suppression_file_install_subdir, install_tag : 'devel', ) endif |