From 39bb5e07eab736b525abfc66eb5ad0dd626aedc6 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Tue, 11 May 2021 09:18:47 -0400 Subject: [PATCH] install_scripts: Restore @SOURCE_ROOT@ and @BUILD_ROOT@ replacements They are not documented for add_install_script() public API, but gnome module relies on it internally. Fixes: #8744 --- mesonbuild/backend/backends.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index ee5f4463a5..ac6d5f0669 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -1429,7 +1429,19 @@ def generate_target_install(self, d: InstallData) -> None: d.targets.append(i) def generate_custom_install_script(self, d: InstallData) -> None: - d.install_scripts = self.build.install_scripts + result: T.List[ExecutableSerialisation] = [] + srcdir = self.environment.get_source_dir() + builddir = self.environment.get_build_dir() + for i in self.build.install_scripts: + fixed_args = [] + for a in i.cmd_args: + a = a.replace('@SOURCE_ROOT@', srcdir) + a = a.replace('@BUILD_ROOT@', builddir) + fixed_args.append(a) + es = copy.copy(i) + es.cmd_args = fixed_args + result.append(es) + d.install_scripts = result def generate_header_install(self, d: InstallData) -> None: incroot = self.environment.get_includedir()