Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

env2mfile: Generalize handling of architecture-prefixed tools on Debian derivatives #13721

Merged
merged 4 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions mesonbuild/scripts/env2mfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,33 @@ def dpkg_architecture_to_machine_info(output: str, options: T.Any) -> MachineInf
deb_detect_cmake(infos, data)
except ValueError:
pass
try:
infos.binaries['pkg-config'] = locate_path("%s-pkg-config" % host_arch)
except ValueError:
pass # pkg-config is optional
for tool in [
'g-ir-annotation-tool',
'g-ir-compiler',
'g-ir-doc-tool',
'g-ir-generate',
'g-ir-inspect',
'g-ir-scanner',
'pkg-config',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this list would also contain vapigen, but that's blocked on https://bugs.debian.org/1061107

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having said that, one nice thing about the ${gnu_tuple}-${tool} naming convention is that we can be quite confident that if ${gnu_tuple}-${tool} exists, then it is the right substitute for ${tool} to use when compiling code for ${gnu_tuple}. So perhaps I should be speculatively adding vapigen here, on the basis that we already know we are going to need a cross version of it in future (because it needs to use the appropriate search path for the host architecture rather than the build architecture).

]:
try:
infos.binaries[tool] = locate_path("%s-%s" % (host_arch, tool))
except ValueError:
pass # optional
for tool, exe in [
('exe_wrapper', 'cross-exe-wrapper'),
]:
try:
infos.binaries[tool] = locate_path("%s-%s" % (host_arch, exe))
except ValueError:
pass
for tool, exe in [
('vala', 'valac'),
]:
try:
infos.compilers[tool] = locate_path("%s-%s" % (host_arch, exe))
except ValueError:
pass
try:
infos.binaries['cups-config'] = locate_path("cups-config")
except ValueError:
Expand Down
8 changes: 8 additions & 0 deletions unittests/internaltests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1739,6 +1739,7 @@ def expected_compilers(
'cpp': [f'/usr/bin/{gnu_tuple}-g++{gcc_suffix}'],
'objc': [f'/usr/bin/{gnu_tuple}-gobjc{gcc_suffix}'],
'objcpp': [f'/usr/bin/{gnu_tuple}-gobjc++{gcc_suffix}'],
'vala': [f'/usr/bin/{gnu_tuple}-valac'],
}

def expected_binaries(gnu_tuple: str) -> T.Dict[str, T.List[str]]:
Expand All @@ -1750,6 +1751,13 @@ def expected_binaries(gnu_tuple: str) -> T.Dict[str, T.List[str]]:
'cmake': ['/usr/bin/cmake'],
'pkg-config': [f'/usr/bin/{gnu_tuple}-pkg-config'],
'cups-config': ['/usr/bin/cups-config'],
'exe_wrapper': [f'/usr/bin/{gnu_tuple}-cross-exe-wrapper'],
'g-ir-annotation-tool': [f'/usr/bin/{gnu_tuple}-g-ir-annotation-tool'],
'g-ir-compiler': [f'/usr/bin/{gnu_tuple}-g-ir-compiler'],
'g-ir-doc-tool': [f'/usr/bin/{gnu_tuple}-g-ir-doc-tool'],
'g-ir-generate': [f'/usr/bin/{gnu_tuple}-g-ir-generate'],
'g-ir-inspect': [f'/usr/bin/{gnu_tuple}-g-ir-inspect'],
'g-ir-scanner': [f'/usr/bin/{gnu_tuple}-g-ir-scanner'],
}

for title, dpkg_arch, gccsuffix, env, expected in [
Expand Down
Loading