Release 1.22.0
[platform/upstream/gstreamer.git] / subprojects / gst-editing-services / meson.build
index 81fc109..f97b65b 100644 (file)
@@ -1,6 +1,6 @@
 project('gst-editing-services', 'c',
-  version : '1.19.2',
-  meson_version : '>= 0.54',
+  version : '1.22.0',
+  meson_version : '>= 0.62',
   default_options : [ 'warning_level=1',
                       'buildtype=debugoptimized' ])
 
@@ -16,6 +16,8 @@ gst_version_micro = version_arr[2].to_int()
 else
   gst_version_nano = 0
 endif
+gst_version_is_stable = gst_version_minor.is_even()
+gst_version_is_dev = gst_version_minor.is_odd() and gst_version_micro < 90
 
 apiversion = '1.0'
 soversion = 0
@@ -25,8 +27,13 @@ curversion = gst_version_minor * 100 + gst_version_micro
 libversion = '@0@.@1@.0'.format(soversion, curversion)
 osxversion = curversion + 1
 
-glib_req = '>= 2.56.0'
-gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
+glib_req = '>= 2.62.0'
+
+if gst_version_is_stable
+  gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
+else
+  gst_req = '>= ' + gst_version
+endif
 
 cc = meson.get_compiler('c')
 mathlib = cc.find_library('m', required : false)
@@ -60,19 +67,17 @@ if cc.has_link_argument('-Wl,-Bsymbolic-functions')
   add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
 endif
 
+# glib doesn't support unloading, which means that unloading and reloading
+# any library that registers static types will fail
+if cc.has_link_argument('-Wl,-z,nodelete')
+  add_project_link_arguments('-Wl,-z,nodelete', language: 'c')
+endif
+
 # Symbol visibility
-if cc.get_id() == 'msvc'
-  export_define = '__declspec(dllexport) extern'
-elif cc.has_argument('-fvisibility=hidden')
+if cc.has_argument('-fvisibility=hidden')
   add_project_arguments('-fvisibility=hidden', language: 'c')
-  export_define = 'extern __attribute__ ((visibility ("default")))'
-else
-  export_define = 'extern'
 endif
 
-# Passing this through the command line would be too messy
-cdata.set('GST_API_EXPORT', export_define)
-
 # Disable strict aliasing
 if cc.has_argument('-fno-strict-aliasing')
   add_project_arguments('-fno-strict-aliasing', language: 'c')
@@ -108,7 +113,8 @@ gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
 gstvalidate_dep = dependency('gst-validate-1.0', version : gst_req, required : get_option('validate'),
   fallback : ['gst-devtools', 'validate_dep'])
 
-gio_dep = dependency('gio-2.0', version: glib_req, fallback: ['glib', 'libgio_dep'])
+gio_dep = dependency('gio-2.0', version: glib_req)
+gmodule_dep = dependency('gmodule-no-export-2.0')
 libxml_dep = dependency('libxml-2.0', required: get_option('xptv'))
 cdata.set('DISABLE_XPTV', not libxml_dep.found())
 
@@ -139,7 +145,14 @@ gir_init_section = [ '--add-init-section=' + \
     'ges_init();', '--quiet']
 
 has_python = false
-if build_gir
+static_build = get_option('default_library') == 'static'
+if static_build
+  if get_option('python').enabled()
+    error('Want to build python based modules but it is not supported while static building')
+  else
+    message('Disabling python support as it is not supported on static builds')
+  endif
+elif build_gir
   pymod = import('python')
   python = pymod.find_installation(required: get_option('python'))
   if python.found()
@@ -160,18 +173,17 @@ if build_gir
     if not cc.compiles('#include <Python.h>', dependencies: [python_dep])
       error_msg = 'Could not compile a simple program against python'
     elif pylib_loc == ''
-      check_path_exists = 'import os, sys; assert(os.path.exists(sys.argv[1]))'
+      fsmod = import('fs')
       pylib_loc = python.get_variable('LIBPL', '')
       if host_machine.system() != 'windows' and host_machine.system() != 'darwin'
         pylib_ldlibrary = python.get_variable('LDLIBRARY', '')
-        if run_command(python, '-c', check_path_exists, join_paths(pylib_loc, pylib_ldlibrary)).returncode() != 0
+        if not fsmod.exists(pylib_loc / pylib_ldlibrary)
           # Workaround for Fedora
           pylib_loc = python.get_variable('LIBDIR', '')
           message('pylib_loc = @0@'.format(pylib_loc))
         endif
 
-        res = run_command(python, '-c', check_path_exists, join_paths(pylib_loc, pylib_ldlibrary))
-        if res.returncode() != 0
+        if not fsmod.exists(pylib_loc / pylib_ldlibrary)
           error_msg = '@0@ doesn\' exist, can\'t use python'.format(join_paths(pylib_loc, pylib_ldlibrary))
         endif
       endif
@@ -183,7 +195,6 @@ if build_gir
           pylib_suffix = 'dylib'
         endif
 
-        gmodule_dep = dependency('gmodule-2.0')
         libges_deps = libges_deps + [python_dep, gmodule_dep]
         has_python = true
         message('python_abi_flags = @0@'.format(python_abi_flags))
@@ -238,7 +249,6 @@ warning_flags = [
   '-Wmissing-include-dirs',
   '-Waddress',
   '-Wno-multichar',
-  '-Wdeclaration-after-statement',
   '-Wvla',
   '-Wpointer-arith',
 ]
@@ -254,72 +264,35 @@ pkgconfig = import('pkgconfig')
 pkgconfig_subdirs = ['gstreamer-1.0']
 
 configinc = include_directories('.')
+gst_libraries = []
+
 subdir('ges')
 subdir('plugins')
-if not get_option('tools').disabled()
-  subdir('tools')
-endif
+subdir('tools')
+
 subdir('tests')
 if not get_option('examples').disabled()
   subdir('examples')
 endif
 subdir('docs')
 
-override_detector = '''
-import sys
-import os
-
-prefix = sys.argv[1]
-version = sys.version_info
-
-# If we are installing in the same prefix as PyGobject
-# make sure to install in the right place.
-import gi.overrides
-
-overrides_path = os.path.dirname(gi.overrides.__file__)
-if os.path.commonprefix([overrides_path, prefix]) == prefix:
-    print(overrides_path)
-    exit(0)
-
-# Otherwise follow python's way of install site packages inside
-# the provided prefix
-if os.name == 'posix':
-    print(os.path.join(
-        prefix, 'lib', 'python%d.%d' % (version.major, version.minor),
-        'site-packages', 'gi', 'overrides'))
-else:
-    print(os.path.join(
-        prefix, 'Lib', 'Python%d%d' % (version.major, version.minor),
-        'site-packages', 'gi', 'overrides'))
-'''
 pygi_override_dir = get_option('pygi-overrides-dir')
 if pygi_override_dir == ''
-    cres = run_command(python3, '-c', override_detector, get_option('prefix'))
-    if cres.returncode() == 0
-      pygi_override_dir = cres.stdout().strip()
-    endif
-    if cres.stderr() != ''
-        message(cres.stderr())
-    endif
+  pygi_override_dir = python3.get_install_dir(
+    subdir : join_paths('gi', 'overrides')
+  )
 endif
 
-if pygi_override_dir != ''
-  message('pygobject overrides directory ' + pygi_override_dir)
-  subdir('bindings/python')
-endif
+message('pygobject overrides directory = @0@'.format(pygi_override_dir))
+subdir('bindings/python')
 
 # Set release date
 if gst_version_nano == 0
   extract_release_date = find_program('scripts/extract-release-date-from-doap-file.py')
-  run_result = run_command(extract_release_date, gst_version, files('gst-editing-services.doap'))
-  if run_result.returncode() == 0
-    release_date = run_result.stdout().strip()
-    cdata.set_quoted('GST_PACKAGE_RELEASE_DATETIME', release_date)
-    message('Package release date: ' + release_date)
-  else
-    # Error out if our release can't be found in the .doap file
-    error(run_result.stderr())
-  endif
+  run_result = run_command(extract_release_date, gst_version, files('gst-editing-services.doap'), check: true)
+  release_date = run_result.stdout().strip()
+  cdata.set_quoted('GST_PACKAGE_RELEASE_DATETIME', release_date)
+  message('Package release date: ' + release_date)
 endif
 
 if gio_dep.version().version_compare('< 2.67.4')
@@ -328,4 +301,22 @@ endif
 
 configure_file(output: 'config.h', configuration: cdata)
 
-run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')
+meson.add_dist_script('scripts/gen-changelog.py', meson.project_name(), '1.20.0', meson.project_version())
+
+plugin_names = []
+gst_plugins = []
+foreach plugin: plugins
+  pkgconfig.generate(plugin, install_dir: plugins_pkgconfig_install_dir)
+  dep = declare_dependency(link_with: plugin, variables: {'full_path': plugin.full_path()})
+  meson.override_dependency(plugin.name(), dep)
+  gst_plugins += [dep]
+  if plugin.name().startswith('gst')
+    plugin_names += [plugin.name().substring(3)]
+  else
+    plugin_names += [plugin.name()]
+  endif
+endforeach
+
+summary({
+    'Plugins': plugin_names,
+}, list_sep: ', ')