[Mesa-dev] [PATCH v2 45/49] meson: Use python module to find python2 on windows

Dylan Baker dylan at pnwbakers.com
Tue Jul 10 23:47:45 UTC 2018


I did something bad while rebasing this apparently...

Quoting Dylan Baker (2018-07-10 16:18:13)
> 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>
> Reviewed-by: Dylan Baker <dylan.c.baker at intel.com>
> ---
>  meson.build | 31 ++++++++++++++++++++++++++++++-
>  1 file changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index dfb7fe8c900..f63fd9b6926 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -710,7 +710,15 @@ if with_platform_haiku
>    pre_args += '-DHAVE_HAIKU_PLATFORM'
>  endif
>  
> -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
> +else
> +  prog_python2 = find_program('python2')
> +endif
>  has_mako = run_command(prog_python2, '-c', 'import mako')
>  if has_mako.returncode() != 0
>    error('Python (2.x) mako module required to build mesa.')
> @@ -879,6 +887,27 @@ else
>    endforeach
>  endif
>  
> +# set linker arguments
> +if host_machine.system() == 'windows'
> +  if cc.get_id() == 'msvc'
> +    add_project_link_arguments(
> +      '/fixed:no',
> +      '/incremental:no',
> +      '/dynamicbase',
> +      '/nxcompat',
> +      language : ['c', 'cpp'],
> +    )
> +  else
> +    add_project_link_arguments(
> +      '-Wl,--nxcompat',
> +      '-Wl,--dynamicbase',
> +      '-static-libgcc',
> +      '-static-libstdc++',
> +      language : ['c', 'cpp'],
> +    )
> +  endif
> +endif
> +
>  if host_machine.cpu_family().startswith('x86') and cc.get_id() != 'msvc'
>    pre_args += '-DUSE_SSE41'
>    with_sse41 = true
> -- 
> 2.18.0
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180710/04e063e7/attachment.sig>


More information about the mesa-dev mailing list