aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2022-10-26 10:25:29 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2022-11-02 14:53:35 +0200
commitf5871e240d6d06e7e8ab0f0ded5d944e8b780cd3 (patch)
treea4d9f10a769bb3cada1f4db07be7617e163edd58
parent43e274c73365ed7c84553af4c51369db8714871e (diff)
downloadmeson-f5871e240d6d06e7e8ab0f0ded5d944e8b780cd3.zip
meson-f5871e240d6d06e7e8ab0f0ded5d944e8b780cd3.tar.gz
meson-f5871e240d6d06e7e8ab0f0ded5d944e8b780cd3.tar.bz2
backends: Try guessing install tag for all installed files
It was only trying to guess install tag, and log missing tags, for files installed by install_data(). Do it also for all other files, especially custom_taget() that commonly installs generated headers.
-rw-r--r--mesonbuild/backend/backends.py14
-rw-r--r--test cases/unit/98 install all targets/meson.build16
-rw-r--r--unittests/allplatformstests.py5
3 files changed, 32 insertions, 3 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 32f24e9..fa635f4 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -1654,6 +1654,7 @@ class Backend:
if num_outdirs == 1 and num_out > 1:
if first_outdir is not False:
for output, tag in zip(t.get_outputs(), t.install_tag):
+ tag = tag or self.guess_install_tag(output, first_outdir)
f = os.path.join(self.get_target_dir(t), output)
i = TargetInstallData(f, first_outdir, first_outdir_name,
False, {}, set(), None, install_mode,
@@ -1665,6 +1666,7 @@ class Backend:
# User requested that we not install this output
if outdir is False:
continue
+ tag = tag or self.guess_install_tag(output, outdir)
f = os.path.join(self.get_target_dir(t), output)
i = TargetInstallData(f, outdir, outdir_name,
False, {}, set(), None, install_mode,
@@ -1674,6 +1676,9 @@ class Backend:
def generate_custom_install_script(self, d: InstallData) -> None:
d.install_scripts = self.build.install_scripts
+ for i in d.install_scripts:
+ if not i.tag:
+ mlog.debug('Failed to guess install tag for install script:', ' '.join(i.cmd_args))
def generate_header_install(self, d: InstallData) -> None:
incroot = self.environment.get_includedir()
@@ -1723,7 +1728,8 @@ class Backend:
def generate_emptydir_install(self, d: InstallData) -> None:
emptydir: T.List[build.EmptyDir] = self.build.get_emptydir()
for e in emptydir:
- i = InstallEmptyDir(e.path, e.install_mode, e.subproject, e.install_tag)
+ tag = e.install_tag or self.guess_install_tag(e.path)
+ i = InstallEmptyDir(e.path, e.install_mode, e.subproject, tag)
d.emptydir.append(i)
def generate_data_install(self, d: InstallData) -> None:
@@ -1752,7 +1758,8 @@ class Backend:
assert isinstance(l, build.SymlinkData)
install_dir = l.install_dir
name_abs = os.path.join(install_dir, l.name)
- s = InstallSymlinkData(l.target, name_abs, install_dir, l.subproject, l.install_tag)
+ tag = l.install_tag or self.guess_install_tag(name_abs)
+ s = InstallSymlinkData(l.target, name_abs, install_dir, l.subproject, tag)
d.symlinks.append(s)
def generate_subdir_install(self, d: InstallData) -> None:
@@ -1772,7 +1779,8 @@ class Backend:
if not sd.strip_directory:
dst_dir = os.path.join(dst_dir, os.path.basename(src_dir))
dst_name = os.path.join(dst_name, os.path.basename(src_dir))
- i = SubdirInstallData(src_dir, dst_dir, dst_name, sd.install_mode, sd.exclude, sd.subproject, sd.install_tag)
+ tag = sd.install_tag or self.guess_install_tag(os.path.join(sd.install_dir, 'dummy'))
+ i = SubdirInstallData(src_dir, dst_dir, dst_name, sd.install_mode, sd.exclude, sd.subproject, tag)
d.install_subdirs.append(i)
def get_introspection_data(self, target_id: str, target: build.Target) -> T.List['TargetIntrospectionData']:
diff --git a/test cases/unit/98 install all targets/meson.build b/test cases/unit/98 install all targets/meson.build
index c90632a..3065b5f 100644
--- a/test cases/unit/98 install all targets/meson.build
+++ b/test cases/unit/98 install all targets/meson.build
@@ -31,6 +31,22 @@ configure_file(input: 'foo.in', output: 'foo2-devel.h',
static_library('static', 'lib.c',
install: true,
)
+custom_target('ct-header1',
+ output: ['ct-header1.h'],
+ command: ['script.py', '@OUTPUT@'],
+ install_dir: get_option('includedir'),
+ install: true,
+)
+custom_target('ct-header2',
+ output: ['ct-header2.h', 'ct-header3.h'],
+ command: ['script.py', '@OUTPUT@'],
+ install_dir: [false, get_option('includedir')],
+ install: true,
+)
+install_emptydir(get_option('includedir') / 'subdir-devel')
+install_subdir('custom_files',
+ install_dir: get_option('includedir'),
+)
# Those files should have 'runtime' tag
executable('app', 'main.c',
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index d90153c..1ecbf18 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -4054,6 +4054,11 @@ class AllPlatformTests(BasePlatformTests):
Path(installpath, 'usr/lib/libstatic.a'),
Path(installpath, 'usr/lib/libboth.a'),
Path(installpath, 'usr/lib/libboth2.a'),
+ Path(installpath, 'usr/include/ct-header1.h'),
+ Path(installpath, 'usr/include/ct-header3.h'),
+ Path(installpath, 'usr/include/subdir-devel'),
+ Path(installpath, 'usr/include/custom_files'),
+ Path(installpath, 'usr/include/custom_files/data.txt'),
}
if cc.get_id() in {'msvc', 'clang-cl'}: