From 06fe2e23b041224849fd4d1c3e3d44bbf74b4c2b Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Fri, 29 Jul 2022 10:40:54 -0700 Subject: [PATCH] meson: use current_source_dir and current_build_dir instead of *_root The latter doesn't work correctly when being used as a subproject, as it returns the *absolute* root. So if pkgconf is being built as part of muon, then it will return muon's source root. current_source_dir, on the other hand returns the directory correctly whether being built as a subproject or superproject. --- meson.build | 7 +++---- tests/meson.build | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index ef7be6f..161c5ef 100644 --- a/meson.build +++ b/meson.build @@ -51,8 +51,8 @@ cdata.set_quoted('PERSONALITY_PATH', ':'.join(personality_path)) cdata.set_quoted('PACKAGE_NAME', meson.project_name()) cdata.set_quoted('PACKAGE_VERSION', meson.project_version()) cdata.set_quoted('PACKAGE_BUGREPORT', 'https://todo.sr.ht/~kaniini/pkgconf') -cdata.set('abs_top_srcdir', meson.source_root()) -cdata.set('abs_top_builddir', meson.build_root()) +cdata.set('abs_top_srcdir', meson.current_source_dir()) +cdata.set('abs_top_builddir', meson.current_build_dir()) subdir('libpkgconf') @@ -119,8 +119,7 @@ pkgconf_exe = executable('pkgconf', if get_option('tests') kyua_exe = find_program('kyua') atf_sh_exe = find_program('atf-sh') - test('kyua', kyua_exe, args : ['--config=none', 'test', '--kyuafile=' + join_paths(meson.build_root(), 'Kyuafile'), '--build-root=' + meson.build_root()]) - + test('kyua', kyua_exe, args : ['--config=none', 'test', '--kyuafile=' + join_paths(meson.current_build_dir(), 'Kyuafile'), '--build-root=' + meson.current_build_dir()]) configure_file(input : 'Kyuafile.in', output : 'Kyuafile', configuration : cdata) subdir('tests') diff --git a/tests/meson.build b/tests/meson.build index 1f21e04..beaf393 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -19,5 +19,5 @@ tests = [ # yuck foreach test : tests configure_file(input: test + '.sh', output: test, copy: true) - run_command('chmod', '755', join_paths(meson.build_root(), 'tests', test)) + run_command('chmod', '755', join_paths(meson.current_build_dir(), 'tests', test)) endforeach