From 22f28155d86e27c4134de4ed2861264003fcfd23 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com>
Date: Fri, 13 Dec 2019 10:46:20 +0200
Subject: [PATCH] Fix build with Python 3.8 by also checking for
 python-3.X-embed.pc

Since Python 3.8 the normal checks don't include the Python libraries
anymore and linking of the gst-python module would fail.

See also https://github.com/mesonbuild/meson/issues/5629

Fixes https://gitlab.freedesktop.org/gstreamer/gst-python/issues/28
---
 meson.build | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 744b7ce..fe4ca7a 100644
--- a/meson.build
+++ b/meson.build
@@ -24,7 +24,14 @@ pygobject_dep = dependency('pygobject-3.0', fallback: ['pygobject', 'pygobject_d
 
 pymod = import('python')
 python = pymod.find_installation(get_option('python'))
-python_dep = python.dependency(required : true)
+pythonver = python.language_version()
+
+# Workaround for https://github.com/mesonbuild/meson/issues/5629
+# https://gitlab.freedesktop.org/gstreamer/gst-python/issues/28
+python_dep = dependency('python-@0@-embed'.format(pythonver), version: '>=3', required: false)
+if not python_dep.found()
+  python_dep = python.dependency(required : true)
+endif
 
 python_abi_flags = python.get_variable('ABIFLAGS', '')
 pylib_loc = get_option('libpython-dir')
-- 
2.20.1

