mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 23:16:14 +01:00
Merge branch 'valgrind-variable' into 'main'
meson: Add glib_valgrind_suppressions variable to glib pkg-config file See merge request GNOME/glib!3361
This commit is contained in:
commit
9f111c3416
@ -875,18 +875,20 @@ libgio_dep = declare_dependency(link_with : libgio,
|
||||
|
||||
pkg.generate(libgio,
|
||||
requires : ['glib-2.0', 'gobject-2.0'],
|
||||
variables : ['datadir=' + join_paths('${prefix}', get_option('datadir')),
|
||||
'schemasdir=' + join_paths('${datadir}', schemas_subdir),
|
||||
'bindir=' + join_paths('${prefix}', get_option('bindir')),
|
||||
'giomoduledir=' + pkgconfig_giomodulesdir,
|
||||
'gio=' + join_paths('${bindir}', 'gio'),
|
||||
'gio_querymodules=@0@'.format(pkgconfig_multiarch_bindir / 'gio-querymodules'),
|
||||
'glib_compile_schemas=@0@'.format(pkgconfig_multiarch_bindir / 'glib-compile-schemas'),
|
||||
'glib_compile_resources=' + join_paths('${bindir}', 'glib-compile-resources'),
|
||||
'gdbus=' + join_paths('${bindir}', 'gdbus'),
|
||||
'gdbus_codegen=' + join_paths('${bindir}', 'gdbus-codegen'),
|
||||
'gresource=' + join_paths('${bindir}', 'gresource'),
|
||||
'gsettings=' + join_paths('${bindir}', 'gsettings')],
|
||||
variables : [
|
||||
'datadir=' + '${prefix}' / get_option('datadir'),
|
||||
'schemasdir=' + '${datadir}' / schemas_subdir,
|
||||
'bindir=' + '${prefix}' / get_option('bindir'),
|
||||
'giomoduledir=' + pkgconfig_giomodulesdir,
|
||||
'gio=' + '${bindir}' / 'gio',
|
||||
'gio_querymodules=' + pkgconfig_multiarch_bindir / 'gio-querymodules',
|
||||
'glib_compile_schemas=' + pkgconfig_multiarch_bindir / 'glib-compile-schemas',
|
||||
'glib_compile_resources=' + '${bindir}' / 'glib-compile-resources',
|
||||
'gdbus=' + '${bindir}' /'gdbus',
|
||||
'gdbus_codegen=' + '${bindir}' / 'gdbus-codegen',
|
||||
'gresource=' + '${bindir}' / 'gresource',
|
||||
'gsettings=' + '${bindir}' / 'gsettings',
|
||||
],
|
||||
version : glib_version,
|
||||
install_dir : glib_pkgconfigreldir,
|
||||
filebase : 'gio-2.0',
|
||||
|
@ -1096,4 +1096,72 @@ if installed_tests_enabled
|
||||
)
|
||||
endif
|
||||
|
||||
if have_bash and have_pkg_config
|
||||
prefix = get_option('prefix')
|
||||
if prefix.endswith(':/')
|
||||
prefix += '/'
|
||||
endif
|
||||
|
||||
pkg_config_tests = [
|
||||
'pkg-config --validate gio-2.0',
|
||||
'test "$(pkg-config --modversion gio-2.0)" = "@0@"'.format(glib_version),
|
||||
'test "$(pkg-config --variable=prefix gio-2.0)" = "@0@"'.format(
|
||||
get_option('prefix')),
|
||||
'test "$(pkg-config --variable=datadir gio-2.0)" = "@0@"'.format(
|
||||
prefix / get_option('datadir')),
|
||||
'test "$(pkg-config --variable=schemasdir gio-2.0)" = "@0@"'.format(
|
||||
prefix / get_option('datadir') / schemas_subdir),
|
||||
'test "$(pkg-config --variable=giomoduledir gio-2.0)" = "@0@"'.format(
|
||||
get_option('gio_module_dir') != '' ?
|
||||
prefix / get_option('gio_module_dir') :
|
||||
prefix / get_option('libdir') / 'gio' / 'modules'),
|
||||
]
|
||||
|
||||
gio_binaries = [
|
||||
'gio',
|
||||
'gio-querymodules',
|
||||
'glib-compile-schemas',
|
||||
'glib-compile-resources',
|
||||
'gdbus',
|
||||
'gdbus-codegen',
|
||||
'gresource',
|
||||
'gsettings',
|
||||
]
|
||||
|
||||
foreach binary: gio_binaries
|
||||
pkg_config_tests += [
|
||||
'test "$(pkg-config --variable=@0@ gio-2.0)" = "@1@"'.format(
|
||||
binary.underscorify(),
|
||||
prefix / get_option('bindir') / binary)
|
||||
]
|
||||
endforeach
|
||||
|
||||
test('gio-2.0-pkg-config',
|
||||
bash,
|
||||
args: [ '-xe', '-c', '\n'.join(pkg_config_tests) ],
|
||||
suite: ['gio', 'no-valgrind', 'pkg-config'],
|
||||
env: {
|
||||
'PKG_CONFIG_PATH': meson.project_build_root() / 'meson-private',
|
||||
},
|
||||
)
|
||||
|
||||
platform_module = host_system == 'windows' ? 'gio-windows-2.0' : 'gio-unix-2.0'
|
||||
pkg_config_tests = [
|
||||
'pkg-config --validate ' + platform_module,
|
||||
'test "$(pkg-config --modversion @0@)" = "@1@"'.format(platform_module,
|
||||
glib_version),
|
||||
'test "$(pkg-config --variable=prefix @0@)" = "@1@"'.format(platform_module,
|
||||
get_option('prefix')),
|
||||
]
|
||||
|
||||
test(platform_module + '-pkg-config',
|
||||
bash,
|
||||
args: [ '-xe', '-c', '\n'.join(pkg_config_tests) ],
|
||||
suite: ['gio', 'no-valgrind', 'pkg-config'],
|
||||
env: {
|
||||
'PKG_CONFIG_PATH': meson.project_build_root() / 'meson-private',
|
||||
},
|
||||
)
|
||||
endif
|
||||
|
||||
subdir('services')
|
||||
|
@ -444,10 +444,16 @@ pkg.generate(libglib,
|
||||
libraries_private : [win32_ldflags],
|
||||
subdirs : ['glib-2.0'],
|
||||
extra_cflags : ['-I${libdir}/glib-2.0/include'] + win32_cflags,
|
||||
variables : ['bindir=' + join_paths('${prefix}', get_option('bindir')),
|
||||
'glib_genmarshal=' + join_paths('${bindir}', 'glib-genmarshal'),
|
||||
'gobject_query=' + join_paths('${bindir}', 'gobject-query'),
|
||||
'glib_mkenums=' + join_paths('${bindir}', 'glib-mkenums')],
|
||||
variables : [
|
||||
'bindir=' + '${prefix}' / get_option('bindir'),
|
||||
'datadir=' + '${prefix}' / get_option('datadir'),
|
||||
'glib_genmarshal=' + '${bindir}' / 'glib-genmarshal',
|
||||
'gobject_query=' + '${bindir}' / 'gobject-query',
|
||||
'glib_mkenums=' + '${bindir}' / 'glib-mkenums',
|
||||
'glib_valgrind_suppressions=' + '${datadir}' /
|
||||
valgrind_suppression_file_install_subdir /
|
||||
fs.name(valgrind_suppression_file),
|
||||
],
|
||||
version : glib_version,
|
||||
install_dir : glib_pkgconfigreldir,
|
||||
filebase : 'glib-2.0',
|
||||
|
@ -491,3 +491,34 @@ if not meson.is_cross_build() and host_system != 'windows'
|
||||
endif
|
||||
endif
|
||||
|
||||
if have_bash and have_pkg_config
|
||||
prefix = get_option('prefix')
|
||||
if prefix.endswith(':/')
|
||||
prefix += '/'
|
||||
endif
|
||||
test('glib-2.0-pkg-config',
|
||||
bash,
|
||||
args: [
|
||||
'-xe', '-c',
|
||||
'\n'.join([
|
||||
'pkg-config --validate glib-2.0',
|
||||
'test "$(pkg-config --modversion glib-2.0)" = "@0@"'.format(glib_version),
|
||||
'test "$(pkg-config --variable=prefix glib-2.0)" = "@0@"'.format(
|
||||
get_option('prefix')),
|
||||
'test "$(pkg-config --variable=datadir glib-2.0)" = "@0@"'.format(
|
||||
prefix / get_option('datadir')),
|
||||
'test "$(pkg-config --variable=gobject_query glib-2.0)" = "@0@"'.format(
|
||||
prefix / get_option('bindir') / 'gobject-query'),
|
||||
'test "$(pkg-config --variable=glib_mkenums glib-2.0)" = "@0@"'.format(
|
||||
prefix / get_option('bindir') / 'glib-mkenums'),
|
||||
'test "$(pkg-config --variable=glib_valgrind_suppressions glib-2.0)" = "@0@"'.format(
|
||||
prefix / get_option('datadir') /
|
||||
valgrind_suppression_file_install_subdir / fs.name(valgrind_suppression_file)),
|
||||
]),
|
||||
],
|
||||
suite: ['glib', 'core', 'no-valgrind', 'pkg-config'],
|
||||
env: {
|
||||
'PKG_CONFIG_PATH': meson.project_build_root() / 'meson-private',
|
||||
},
|
||||
)
|
||||
endif
|
||||
|
@ -124,3 +124,31 @@ foreach test_name, extra_args : gmodule_tests
|
||||
suite : suite,
|
||||
)
|
||||
endforeach
|
||||
|
||||
if have_bash and have_pkg_config
|
||||
modules = [
|
||||
'gmodule-no-export-2.0',
|
||||
'gmodule-export-2.0',
|
||||
'gmodule-2.0',
|
||||
]
|
||||
|
||||
foreach module: modules
|
||||
test(module + '-pkg-config',
|
||||
bash,
|
||||
args: [
|
||||
'-xe', '-c',
|
||||
'\n'.join([
|
||||
'pkg-config --validate ' + module,
|
||||
'test "$(pkg-config --modversion @0@)" = "@1@"'.format(
|
||||
module, glib_version),
|
||||
'test "$(pkg-config --variable=prefix @0@)" = "@1@"'.format(
|
||||
module, get_option('prefix')),
|
||||
]),
|
||||
],
|
||||
suite: ['gmodule', 'no-valgrind', 'pkg-config'],
|
||||
env: {
|
||||
'PKG_CONFIG_PATH': meson.project_build_root() / 'meson-private',
|
||||
},
|
||||
)
|
||||
endforeach
|
||||
endif
|
||||
|
@ -52,3 +52,22 @@ foreach test_name, extra_args : gthread_tests
|
||||
suite : suite,
|
||||
)
|
||||
endforeach
|
||||
|
||||
if have_bash and have_pkg_config
|
||||
test('gthread-2.0-pkg-config',
|
||||
bash,
|
||||
args: [
|
||||
'-xe', '-c',
|
||||
'\n'.join([
|
||||
'pkg-config --validate gthread-2.0',
|
||||
'test "$(pkg-config --modversion gthread-2.0)" = "@0@"'.format(glib_version),
|
||||
'test "$(pkg-config --variable=prefix gthread-2.0)" = "@0@"'.format(
|
||||
get_option('prefix')),
|
||||
]),
|
||||
],
|
||||
suite: ['gthread', 'no-valgrind', 'pkg-config'],
|
||||
env: {
|
||||
'PKG_CONFIG_PATH': meson.project_build_root() / 'meson-private',
|
||||
},
|
||||
)
|
||||
endif
|
||||
|
13
meson.build
13
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,
|
||||
@ -2285,9 +2288,11 @@ if not python_version.version_compare(python_version_req)
|
||||
endif
|
||||
|
||||
# Determine which user environment-dependent files that we want to install
|
||||
have_bash = find_program('bash', required : false).found() # For completion scripts
|
||||
bash = find_program('bash', required : false)
|
||||
have_bash = bash.found() # For completion scripts
|
||||
bash_comp_dep = dependency('bash-completion', version: '>=2.0', required: false)
|
||||
have_sh = find_program('sh', required : false).found() # For glib-gettextize
|
||||
have_pkg_config = find_program('pkg-config', required: false).found()
|
||||
|
||||
# Some installed tests require a custom environment
|
||||
env_program = find_program('env', required: installed_tests_enabled)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user