[PATCH v2] meson: do not use meson.source_root() and meson.build_root()

Allan McRae allan at archlinux.org
Sun Mar 6 06:29:29 UTC 2022


Using meson.source_root() and meson.build_root() are deprectated in
meson-0.56.  Using current_source_dir() or current_build_dir() (which
have been available in all Meson versions) would require manually
adding "../" in some places.  Instead, use project_source_root() and
project_build_root() and require meson-0.56.

Signed-off-by: Allan McRae <allan at archlinux.org>
---

v2: fix testsuite running

 meson.build             | 14 +++++++-------
 scripts/meson.build     |  2 +-
 test/pacman/meson.build |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/meson.build b/meson.build
index b8e64127..b7cca865 100644
--- a/meson.build
+++ b/meson.build
@@ -8,7 +8,7 @@ project('pacman',
           'sysconfdir=/etc',
           'localstatedir=/var',
         ],
-        meson_version : '>= 0.55')
+        meson_version : '>= 0.56')
 
 libalpm_version = '13.0.1'
 
@@ -29,7 +29,7 @@ PKGDATADIR = join_paths(PREFIX, DATAROOTDIR, meson.project_name())
 
 PYTHON = import('python').find_installation('python3')
 LDCONFIG = get_option('ldconfig')
-MESON_MAKE_SYMLINK = join_paths(meson.source_root(), 'build-aux/meson-make-symlink.sh')
+MESON_MAKE_SYMLINK = join_paths(meson.project_source_root(), 'build-aux/meson-make-symlink.sh')
 
 BASH = find_program('bash4', 'bash')
 if BASH.found()
@@ -382,7 +382,7 @@ foreach wrapper : script_wrappers
   # directory. Use configure_file instead of a custom_target to ensure that
   # permissions on the input script wrapper are preserved.
   configure_file(
-    input : join_paths(meson.source_root(), 'build-aux', 'script-wrapper.sh.in'),
+    input : join_paths(meson.project_source_root(), 'build-aux', 'script-wrapper.sh.in'),
     output : wrapper[0],
     configuration : cdata)
 endforeach
@@ -416,10 +416,10 @@ foreach path : [
 endforeach
 
 TEST_ENV = environment()
-TEST_ENV.set('PMTEST_SCRIPTLIB_DIR', join_paths(meson.source_root(), 'scripts/library/'))
-TEST_ENV.set('PMTEST_LIBMAKEPKG_DIR', join_paths(meson.build_root(), 'scripts/libmakepkg/'))
-TEST_ENV.set('PMTEST_UTIL_DIR', meson.build_root() + '/')
-TEST_ENV.set('PMTEST_SCRIPT_DIR', join_paths(meson.build_root(), 'scripts/'))
+TEST_ENV.set('PMTEST_SCRIPTLIB_DIR', join_paths(meson.project_source_root(), 'scripts/library/'))
+TEST_ENV.set('PMTEST_LIBMAKEPKG_DIR', join_paths(meson.project_build_root(), 'scripts/libmakepkg/'))
+TEST_ENV.set('PMTEST_UTIL_DIR', meson.project_build_root() + '/')
+TEST_ENV.set('PMTEST_SCRIPT_DIR', join_paths(meson.project_build_root(), 'scripts/'))
 
 subdir('test/pacman')
 subdir('test/scripts')
diff --git a/scripts/meson.build b/scripts/meson.build
index d2466523..e5b9ff4a 100644
--- a/scripts/meson.build
+++ b/scripts/meson.build
@@ -10,7 +10,7 @@ scripts = [
 ]
 
 SCRIPT_EDITOR = find_program(configure_file(
-  input : join_paths(meson.source_root(), 'build-aux/edit-script.sh.in'),
+  input : join_paths(meson.project_source_root(), 'build-aux/edit-script.sh.in'),
   output : 'edit-script.sh',
   configuration : substs))
 
diff --git a/test/pacman/meson.build b/test/pacman/meson.build
index ecab75b2..7ebdd98e 100644
--- a/test/pacman/meson.build
+++ b/test/pacman/meson.build
@@ -354,7 +354,7 @@ foreach input : pacman_tests
   args = [
     join_paths(meson.current_source_dir(), 'pactest.py'),
     '--scriptlet-shell', get_option('scriptlet-shell'),
-    '--bindir', meson.build_root(),
+    '--bindir', meson.project_build_root(),
     '--ldconfig', LDCONFIG,
     '--verbose',
     join_paths(meson.current_source_dir(), input)
-- 
2.35.1



More information about the pacman-dev mailing list