Install python mako via meson directly
The install documentation is clear about the need of the python package Mako installed in order to build Mesa. There is a good check also in the meson.build: https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/meson.build?ref_type=heads#L926
However, installing external python package could be a challenge in limited CI scenario, where you can run meson.build and few more commands.
It would be great if Meson itself could install mako in case not available. Something like:
@@ -920,7 +920,15 @@ if get_option('allow-kcmp') \
pre_args += '-DALLOW_KCMP'
endif
-prog_python = import('python').find_installation('python3')
+packaging_dep = import('python').find_installation('mako', required: false)
+if not packaging_dep.found()
+ install_command = ['python3', '-m', 'pip', 'install', 'mako']
+ install_result = run_command(install_command, check: true, capture: true)
+ if install_result.returncode() != 0
+ error('Failed to install mako library using pip')
+ endif
+endif
+prog_python = import('python').find_installation('python3', modules: ['mako'])
has_mako = run_command(
prog_python, '-c',
'''
@@ -951,7 +959,7 @@ endif
First we check if mako is installed via meson find_installation, then install in case not found. Next, we do a re-check, but now with required=True, so in case not found, meson will stop before running the test under has_mako.
A second approach would be adding an option to meson.build, to install or not mako, but only when not installed yet. The option would be deactivated by default.
I could open a merge request to the project in case the maintainers agree with this feature. Regards!