From 89f9aa044fbca703670cbaa037716112c7f7fefb Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 13 Feb 2017 09:26:57 +0000 Subject: [PATCH 1/3] Remove the shebang from gen_dispatch.py Instead of having Meson determine the invocator through the shebang line we explicitly pass the script file to the Python interpreter. This will allow us to either use Python3 or Python2, or whatever Python.exe is available on Windows. --- include/epoxy/meson.build | 4 ++++ meson.build | 5 ++++- src/gen_dispatch.py | 1 - src/meson.build | 4 ++++ 4 files changed, 12 insertions(+), 2 deletions(-) mode change 100755 => 100644 src/gen_dispatch.py diff --git a/include/epoxy/meson.build b/include/epoxy/meson.build index bf13e9e..809b92c 100644 --- a/include/epoxy/meson.build +++ b/include/epoxy/meson.build @@ -6,6 +6,7 @@ gl_generated = custom_target('gl_generated.h', 'gl_generated.h', ], command: [ + python, gen_dispatch_py, '--header', '--no-source', @@ -25,6 +26,7 @@ if build_egl 'egl_generated.h', ], command: [ + python, gen_dispatch_py, '--header', '--no-source', @@ -44,6 +46,7 @@ if build_glx 'glx_generated.h', ], command: [ + python, gen_dispatch_py, '--header', '--no-source', @@ -63,6 +66,7 @@ if build_wgl 'wgl_generated.h', ], command: [ + python, gen_dispatch_py, '--header', '--no-source', diff --git a/meson.build b/meson.build index 9651a6c..70c417d 100644 --- a/meson.build +++ b/meson.build @@ -202,8 +202,11 @@ configure_file(input: 'epoxy.pc.in', install: true, install_dir: join_paths(epoxy_libdir, 'pkgconfig')) +# Python +python = find_program('python', required: true) + # Generates the dispatch tables -gen_dispatch_py = find_program('src/gen_dispatch.py') +gen_dispatch_py = join_paths(meson.source_root(), 'src/gen_dispatch.py') gl_registry = files('registry/gl.xml') egl_registry = files('registry/egl.xml') diff --git a/src/gen_dispatch.py b/src/gen_dispatch.py old mode 100755 new mode 100644 index 6efa4d6..306a83b --- a/src/gen_dispatch.py +++ b/src/gen_dispatch.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright © 2013 Intel Corporation diff --git a/src/meson.build b/src/meson.build index 596dbe5..fced355 100644 --- a/src/meson.build +++ b/src/meson.build @@ -12,6 +12,7 @@ gl_generated = custom_target('gl_generated_dispatch.c', 'gl_generated_dispatch.c', ], command: [ + python, gen_dispatch_py, '--source', '--no-header', @@ -29,6 +30,7 @@ if build_egl 'egl_generated_dispatch.c', ], command: [ + python, gen_dispatch_py, '--source', '--no-header', @@ -46,6 +48,7 @@ if build_glx 'glx_generated_dispatch.c', ], command: [ + python, gen_dispatch_py, '--source', '--no-header', @@ -63,6 +66,7 @@ if build_wgl 'wgl_generated_dispatch.c', ], command: [ + python, gen_dispatch_py, '--source', '--no-header', From 877fe816a75030c5e82b1b1b72398033011afbec Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 13 Feb 2017 09:33:19 +0000 Subject: [PATCH 2/3] Allow using Python3 to run gen_dispatch.py This way, we don't have to depend on Python2 on newer OSes. --- configure.ac | 2 +- meson.build | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index cc1fc50..34a109f 100644 --- a/configure.ac +++ b/configure.ac @@ -41,7 +41,7 @@ m4_ifndef([XORG_MACROS_VERSION], XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS -AC_CHECK_PROGS([PYTHON], [python2 python]) +AC_CHECK_PROGS([PYTHON], [python3 python2 python]) # Initialize libtool AC_DISABLE_STATIC diff --git a/meson.build b/meson.build index 70c417d..4137646 100644 --- a/meson.build +++ b/meson.build @@ -203,7 +203,10 @@ configure_file(input: 'epoxy.pc.in', install_dir: join_paths(epoxy_libdir, 'pkgconfig')) # Python -python = find_program('python', required: true) +python = find_program('python3', required: false) +if not python.found() + python = find_program('python', required: true) +endif # Generates the dispatch tables gen_dispatch_py = join_paths(meson.source_root(), 'src/gen_dispatch.py') From fa7d140eb524b2f56abc9ced757ef866ff2bb99a Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 15 Feb 2017 16:48:39 +0000 Subject: [PATCH 3/3] Annotate build issues with Meson We depend on an older version of Meson; once we can bump up the minimum version, we'll be able to fix a couple of less than optimal uses of the Meson API. --- meson.build | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meson.build b/meson.build index 4137646..d271d95 100644 --- a/meson.build +++ b/meson.build @@ -203,12 +203,16 @@ configure_file(input: 'epoxy.pc.in', install_dir: join_paths(epoxy_libdir, 'pkgconfig')) # Python +# XXX: Depend on 0.37.1 for: +# python = import('python3').find_python() python = find_program('python3', required: false) if not python.found() python = find_program('python', required: true) endif # Generates the dispatch tables +# XXX: Depend on 0.38.1 for: +# gen_dispatch_py = files('src/gen_dispatch.py') gen_dispatch_py = join_paths(meson.source_root(), 'src/gen_dispatch.py') gl_registry = files('registry/gl.xml')