gnu: python-gst: Fix build with Python 3.8.
[jackhill/guix/guix.git] / gnu / packages / patches / python-gst-fix-build-with-python-3.8.patch
1 Fix build with Python 3.8 by also checking for python-3.X-embed.pc. Since
2 Python 3.8 the normal checks don't include the Python libraries anymore and
3 linking of the gst-python module would fail.
4
5 See also https://github.com/mesonbuild/meson/issues/5629
6 Fixes https://gitlab.freedesktop.org/gstreamer/gst-python/issues/28
7
8 Patch based on upstream commit:
9
10 https://gitlab.freedesktop.org/gstreamer/gst-python/-/commit/10707f437f2fc3632067c6a0efa4432f7ebaf362
11
12 diff --git a/meson.build b/meson.build
13 index 5f13b48..d7c7e66 100644
14 --- a/meson.build
15 +++ b/meson.build
16 @@ -23,7 +23,17 @@ pygobject_dep = dependency('pygobject-3.0', fallback: ['pygobject', 'pygobject_d
17
18 pymod = import('python')
19 python = pymod.find_installation(get_option('python'))
20 -python_dep = python.dependency(required : true)
21 +pythonver = python.language_version()
22 +if pythonver.version_compare('<3.0')
23 + error('Python2 is not supported anymore, please port your code to python3 (@0@ specified)'.format(python.language_version()))
24 +endif
25 +
26 +# Workaround for https://github.com/mesonbuild/meson/issues/5629
27 +# https://gitlab.freedesktop.org/gstreamer/gst-python/issues/28
28 +python_dep = dependency('python-@0@-embed'.format(pythonver), version: '>=3', required: false)
29 +if not python_dep.found()
30 + python_dep = python.dependency(required : true)
31 +endif
32
33 python_abi_flags = python.get_variable('ABIFLAGS', '')
34 pylib_loc = get_option('libpython-dir')
35 --
36 2.26.2