From eb6765d57cfabc63bdb02375ec2e788783b88a0f Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Sat, 27 Jul 2024 13:53:14 +0300 Subject: [PATCH] Support absolute bindir/libdir in regression tests with meson Passing an absolute bindir/libdir will install the binaries and libraries to /tmp_install/ and /tmp_install/ respectively. This path is correctly passed to the regression test suite via configure/make, but not via meson, yet. This is because the "/" operator in the following expression throws away the whole left side when the right side is an absolute path: test_install_location / get_option('libdir') This was already correctly handled for dir_prefix, which is likely absolute as well. This patch handles both bindir and libdir in the same way - prefixing absolute paths with the tmp_install path correctly. Author: Wolfgang Walther Reviewed-by: Nazir Bilal Yavuz, Alvaro Herrera, Peter Eisentraut Reviewed-by: Tristan Partin Discussion: https://www.postgresql.org/message-id/ca8f37e1-a2c3-40e2-91f6-59c3d3652ad4@technowledgy.de Backpatch: 16-, where meson support was added --- meson.build | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 387b043ebf4..4da082e541a 100644 --- a/meson.build +++ b/meson.build @@ -3268,15 +3268,17 @@ test_install_destdir = meson.build_root() / 'tmp_install/' if build_system != 'windows' # On unixoid systems this is trivial, we just prepend the destdir assert(dir_prefix.startswith('/')) # enforced by meson - test_install_location = '@0@@1@'.format(test_install_destdir, dir_prefix) + temp_install_bindir = '@0@@1@'.format(test_install_destdir, dir_prefix / dir_bin) + temp_install_libdir = '@0@@1@'.format(test_install_destdir, dir_prefix / dir_lib) else # drives, drive-relative paths, etc make this complicated on windows, call # into a copy of meson's logic for it command = [ python, '-c', 'import sys; from pathlib import PurePath; d1=sys.argv[1]; d2=sys.argv[2]; print(str(PurePath(d1, *PurePath(d2).parts[1:])))', - test_install_destdir, dir_prefix] - test_install_location = run_command(command, check: true).stdout().strip() + test_install_destdir] + temp_install_bindir = run_command(command, dir_prefix / dir_bin, check: true).stdout().strip() + temp_install_libdir = run_command(command, dir_prefix / dir_lib, check: true).stdout().strip() endif meson_install_args = meson_args + ['install'] + { @@ -3313,7 +3315,6 @@ testport = 40000 test_env = environment() -temp_install_bindir = test_install_location / get_option('bindir') test_initdb_template = meson.build_root() / 'tmp_install' / 'initdb-template' test_env.set('PG_REGRESS', pg_regress.full_path()) test_env.set('REGRESS_SHLIB', regress_module.full_path()) @@ -3328,7 +3329,7 @@ test_env.set('PG_TEST_EXTRA', get_option('PG_TEST_EXTRA')) # that works (everything but windows, basically). On windows everything # library-like gets installed into bindir, solving that issue. if library_path_var != '' - test_env.prepend(library_path_var, test_install_location / get_option('libdir')) + test_env.prepend(library_path_var, temp_install_libdir) endif