aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2023-09-05 07:49:18 -0400
committerXavier Claessens <xclaesse@gmail.com>2023-09-07 10:56:37 -0400
commitb2654b2d43089c933e66ab1d3dfb547caecfea71 (patch)
tree3ee812de1bccd87bfeab711634d6a37f2d72509e /mesonbuild/build.py
parent025aea1dab4bcf9aafdd72acf48476d999a729b9 (diff)
downloadmeson-b2654b2d43089c933e66ab1d3dfb547caecfea71.zip
meson-b2654b2d43089c933e66ab1d3dfb547caecfea71.tar.gz
meson-b2654b2d43089c933e66ab1d3dfb547caecfea71.tar.bz2
Fix crash when installing a vala library and python sources
Installing python sources causes the python module to call create_install_data() before Ninja backends adds extra outputs to Vala targets. Target objects are supposed to be immutable, adding outputs that late is totally wrong. Add extra vala outputs immediately, but be careful because the main output is only added later in post_init(). Luckily the base class already puts a placeholder item in self.outputs for the main filename so we can just replace self.outputs[0] instead of replacing the whole list which would contain vala outputs at that stage. This is surprisingly what SharedLibrary was already doing.
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index edec75d..0943703 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -789,6 +789,12 @@ class BuildTarget(Target):
# relocation-model=pic is rustc's default and Meson does not
# currently have a way to disable PIC.
self.pic = True
+ if 'vala' in self.compilers and self.is_linkable_target():
+ self.outputs += [self.vala_header, self.vala_vapi]
+ self.install_tag += ['devel', 'devel']
+ if self.vala_gir:
+ self.outputs.append(self.vala_gir)
+ self.install_tag.append('devel')
def __repr__(self):
repr_str = "<{0} {1}: {2}>"
@@ -1945,7 +1951,7 @@ class Executable(BuildTarget):
self.filename = self.name
if self.suffix:
self.filename += '.' + self.suffix
- self.outputs = [self.filename]
+ self.outputs[0] = self.filename
# The import library this target will generate
self.import_filename = None
@@ -2086,7 +2092,7 @@ class StaticLibrary(BuildTarget):
else:
self.suffix = 'a'
self.filename = self.prefix + self.name + '.' + self.suffix
- self.outputs = [self.filename]
+ self.outputs[0] = self.filename
def get_link_deps_mapping(self, prefix: str) -> T.Mapping[str, str]:
return {}