1 project('gst-python', 'c', 'cpp',
3 meson_version : '>= 0.40.0',
4 default_options : [ 'warning_level=1',
6 'buildtype=debugoptimized' ])
8 gst_version = meson.project_version()
9 version_arr = gst_version.split('.')
10 gst_version_major = version_arr[0]
11 gst_version_minor = version_arr[1]
12 api_version = '@0@.0'.format(gst_version_major)
14 add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
16 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
18 gst_dep = dependency('gstreamer-1.0', version : gst_req,
19 fallback : ['gstreamer', 'gst_dep'])
20 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
21 fallback : ['gstreamer', 'gst_base_dep'])
22 gmodule_dep = dependency('gmodule-2.0')
23 pygobject_dep = dependency('pygobject-3.0', fallback: ['pygobject', 'pygobject_dep'], version : '>= 3.8')
24 python_dep = dependency('python3')
26 pymod = import('python')
27 python = pymod.find_installation(get_option('python'))
28 python_dep = python.dependency(required : true)
30 python_abi_flags = python.get_variable('ABIFLAGS', '')
31 pylib_loc = python.get_variable('LIBPL', '')
32 if host_machine.system() != 'windows'
33 assert(pylib_loc != '', 'Python dynamic library path could not be determined')
35 message('python_abi_flags = @0@'.format(python_abi_flags))
36 message('pylib_loc = @0@'.format(pylib_loc))
38 pygi_override_dir = get_option('pygi-overrides-dir')
39 if pygi_override_dir == ''
40 cres = run_command(python, '-c','''
41 import os, sys, gi.overrides
42 paths = gi.overrides.__path__
43 prefix = os.path.abspath(sys.argv[1])
45 path = os.path.abspath(path)
46 if os.path.commonprefix([path, prefix]) == prefix:
50 ''', get_option('prefix'))
52 if cres.returncode() != 0
53 error('Could not detect PyGObject overrides location' + cres.stdout() + cres.stderr())
55 pygi_override_dir = cres.stdout().strip()
56 if cres.stderr() != ''
57 message(cres.stderr())
60 message('pygobject overrides directory = @0@'.format(pygi_override_dir))
63 if host_machine.system() == 'windows'
65 elif host_machine.system() == 'darwin'
66 pylib_suffix = 'dylib'
68 cdata = configuration_data()
69 cdata.set('PACKAGE', '"gst-python"')
70 cdata.set('VERSION', '"@0@"'.format(gst_version))
71 cdata.set('GST_PACKAGE_NAME', '"GStreamer Python"')
72 cdata.set('PACKAGE_NAME', '"GStreamer Python"')
73 cdata.set('GST_API_VERSION', '"@0@"'.format(api_version))
74 cdata.set('PLUGINDIR', '"@0@/gstreamer-1.0"'.format(get_option('libdir')))
75 cdata.set('PY_LIB_LOC', '"@0@"'.format(pylib_loc))
76 cdata.set('PY_ABI_FLAGS', '"@0@"'.format(python_abi_flags))
77 cdata.set('PY_LIB_SUFFIX', '"@0@"'.format(pylib_suffix))
78 cdata.set('PYTHON_VERSION', '"@0@"'.format(python_dep.version()))
79 configure_file(output : 'config.h', configuration : cdata)
80 configinc = include_directories('.')
86 run_command(python, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')