[Mesa-dev] [PATCH mesa] meson: fix windows build

Eric Engestrom eric.engestrom at intel.com
Mon Jul 9 11:12:05 UTC 2018

The python installer on Windows installs two `python.exe`, one for
python2 and one for python3 and no `python2.exe` nor `python3.exe`.

This seems utterly broken to me, but luckily for us meson handles this
craziness for us, but only since version 0.46.

This is higher than we require for now, but since we only need this on
Windows, I suggest bumping the required version only on windows, and
leaving all the other OSes as is.

(Note: some future version of Meson (0.48 probably) will handle this
 internally in the find_program() call.)

Reported-by: Alexander Ashevchenko <sav_ix at ukr.net>
Cc: Mathieu Bridon <bochecha at daitauha.fr>
Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
 meson.build | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index eccf7546108421eedca3..c62cdd0e395259ec984e 100644
--- a/meson.build
+++ b/meson.build
@@ -696,7 +696,15 @@ if with_platform_haiku
   pre_args += '-DHAVE_HAIKU_PLATFORM'
-prog_python2 = find_program('python2')
+if build_machine.system() == 'windows'
+  if meson.version().version_compare('< 0.46')
+    error('Windows requires Meson 0.46+; please update and try again.')
+  else
+    prog_python2 = import('python').find_installation('python2')
+  endif
+  prog_python2 = find_program('python2')
 has_mako = run_command(prog_python2, '-c', 'import mako')
 if has_mako.returncode() != 0
   error('Python (2.x) mako module required to build mesa.')

More information about the mesa-dev mailing list