From 383c5d1f6d1f6f1df161ebfdf39ebe127ddff04a Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Thu, 4 Aug 2016 17:33:55 -0400 Subject: Add support for Meson as alternative/parallel build system https://github.com/mesonbuild/meson --- .gitignore | 1 + config.h.meson | 13 +++ docs/libs/meson.build | 27 ++++++ docs/meson.build | 11 +++ examples/c/meson.build | 29 +++++++ examples/meson.build | 1 + ges/ges-command-line-formatter.c | 2 +- ges/meson.build | 182 +++++++++++++++++++++++++++++++++++++++ meson.build | 100 +++++++++++++++++++++ pkgconfig/meson.build | 22 +++++ plugins/meson.build | 1 + plugins/nle/meson.build | 17 ++++ tests/check/meson.build | 73 ++++++++++++++++ tests/meson.build | 5 ++ tools/meson.build | 13 +++ 15 files changed, 496 insertions(+), 1 deletion(-) create mode 100644 config.h.meson create mode 100644 docs/libs/meson.build create mode 100644 docs/meson.build create mode 100644 examples/c/meson.build create mode 100644 examples/meson.build create mode 100644 ges/meson.build create mode 100644 meson.build create mode 100644 pkgconfig/meson.build create mode 100644 plugins/meson.build create mode 100644 plugins/nle/meson.build create mode 100644 tests/check/meson.build create mode 100644 tests/meson.build create mode 100644 tools/meson.build diff --git a/.gitignore b/.gitignore index 42d6e30f..06e215c2 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ *.pyc *.page *.swp +build* *~ core.* diff --git a/config.h.meson b/config.h.meson new file mode 100644 index 00000000..d1f3d073 --- /dev/null +++ b/config.h.meson @@ -0,0 +1,13 @@ +#mesondefine VERSION +#mesondefine PACKAGE +#mesondefine PACKAGE_VERSION +#mesondefine PACKAGE_BUGREPORT +#mesondefine PACKAGE_NAME +#mesondefine GETTEXT_PACKAGE +#mesondefine GST_API_VERSION +#mesondefine GST_PACKAGE_NAME +#mesondefine GST_PACKAGE_ORIGIN +#mesondefine GST_LICENSE +#mesondefine LIBDIR + +#mesondefine HAVE_GST_VALIDATE diff --git a/docs/libs/meson.build b/docs/libs/meson.build new file mode 100644 index 00000000..20b46022 --- /dev/null +++ b/docs/libs/meson.build @@ -0,0 +1,27 @@ +configure_file(input : 'ges.types', + output : 'ges.types', + configuration : configuration_data()) + +doc_deps_names = ['glib-2.0', + 'gstreamer-@0@'.format(apiversion), + 'gstreamer-plugins-base-@0@'.format(apiversion)] + +doc_deps = [] +foreach doc_dep : doc_deps_names + runcmd = run_command('pkg-config', '--variable=prefix', doc_dep) + if runcmd.returncode() == 0 + tmp = '--extra-dir=' + runcmd.stdout().strip() + '/share/gtk-doc/html/' + tmp.strip() + doc_deps = doc_deps + [tmp] + endif +endforeach + +gnome.gtkdoc('gst-editing-services-@0@'.format(apiversion), + main_sgml : 'ges-docs.sgml', + src_dir : '@0@/ges'.format(meson.source_root()), + scan_args : ['--deprecated-guards=GST_DISABLE_DEPRECATED', + '--ignore-decorators=GST_EXPORT', + '--ignore-headers=gesmarshal.h ges-internal.h ges-auto-transition.h ges-structured-interface.h ges-structure-parser.h ges-smart-video-mixer.h gstframepositioner.h' + ], + fixxref_args: doc_deps + ['--html-dir=' + get_option('prefix') + '/share/gtk-doc/html/'], + install : true) diff --git a/docs/meson.build b/docs/meson.build new file mode 100644 index 00000000..d0fe6a98 --- /dev/null +++ b/docs/meson.build @@ -0,0 +1,11 @@ +docconf = configuration_data() + +docconf.set('GST_API_VERSION', apiversion) +docconf.set('PACKAGE_VERSION', gst_version) +docconf.set('PLUGINDIR', '@0@/lib/gstreamer-1.0'.format(get_option('prefix'))) + +configure_file(input : 'version.entities.in', + output : 'version.entities', + configuration : docconf) + +subdir('libs') diff --git a/examples/c/meson.build b/examples/c/meson.build new file mode 100644 index 00000000..bcc188f1 --- /dev/null +++ b/examples/c/meson.build @@ -0,0 +1,29 @@ +examples = [ + 'concatenate', + 'simple1', + 'test1', + 'test2', + 'test3', + 'test4', + 'transition', + 'thumbnails', + 'overlays', + 'text_properties', + 'assets', + 'multifilesrc', + 'play_timeline_with_one_clip' +] + +# TODO Properly port to Gtk 3 +# +# if gtk_dep.found() +# examples = examples + ['ges-ui'] +# endif + + +foreach example_name : examples + exe = executable(example_name, '@0@.c'.format(example_name), + c_args : ges_c_args, + dependencies : libges_deps + [ges_dep], + ) +endforeach diff --git a/examples/meson.build b/examples/meson.build new file mode 100644 index 00000000..76d1974f --- /dev/null +++ b/examples/meson.build @@ -0,0 +1 @@ +subdir('c') diff --git a/ges/ges-command-line-formatter.c b/ges/ges-command-line-formatter.c index a3cfec23..ff17e32d 100644 --- a/ges/ges-command-line-formatter.c +++ b/ges/ges-command-line-formatter.c @@ -23,7 +23,7 @@ #include "ges/ges-structured-interface.h" #include "ges-structure-parser.h" #include "ges-internal.h" -#include "parse_lex.h" +#include "ges-parse-lex.h" struct _GESCommandLineFormatterPrivate { diff --git a/ges/meson.build b/ges/meson.build new file mode 100644 index 00000000..f09c6121 --- /dev/null +++ b/ges/meson.build @@ -0,0 +1,182 @@ +ges_sources = [ + 'ges.c', + 'ges-enums.c', + 'ges-meta-container.c', + 'ges-timeline.c', + 'ges-layer.c', + 'ges-clip.c', + 'ges-pipeline.c', + 'ges-source-clip.c', + 'ges-base-effect-clip.c', + 'ges-effect-clip.c', + 'ges-uri-clip.c', + 'ges-operation-clip.c', + 'ges-base-transition-clip.c', + 'ges-transition-clip.c', + 'ges-test-clip.c', + 'ges-title-clip.c', + 'ges-overlay-clip.c', + 'ges-text-overlay-clip.c', + 'ges-track.c', + 'ges-audio-track.c', + 'ges-video-track.c', + 'ges-track-element.c', + 'ges-source.c', + 'ges-operation.c', + 'ges-video-source.c', + 'ges-audio-source.c', + 'ges-video-uri-source.c', + 'ges-audio-uri-source.c', + 'ges-image-source.c', + 'ges-multi-file-source.c', + 'ges-transition.c', + 'ges-audio-transition.c', + 'ges-video-transition.c', + 'ges-video-test-source.c', + 'ges-audio-test-source.c', + 'ges-title-source.c', + 'ges-text-overlay.c', + 'ges-base-effect.c', + 'ges-effect.c', + 'ges-screenshot.c', + 'ges-formatter.c', + 'ges-pitivi-formatter.c', + 'ges-asset.c', + 'ges-uri-asset.c', + 'ges-clip-asset.c', + 'ges-track-element-asset.c', + 'ges-extractable.c', + 'ges-project.c', + 'ges-base-xml-formatter.c', + 'ges-xml-formatter.c', + 'ges-command-line-formatter.c', + 'ges-auto-transition.c', + 'ges-timeline-element.c', + 'ges-container.c', + 'ges-effect-asset.c', + 'ges-smart-adder.c', + 'ges-smart-video-mixer.c', + 'ges-utils.c', + 'ges-group.c', + 'ges-validate.c', + 'ges-structured-interface.c', + 'ges-structure-parser.c', + 'gstframepositioner.c' +] + +ges_headers = [ + 'ges-types.h', + 'ges.h', + 'ges-enums.h', + 'ges-gerror.h', + 'ges-meta-container.h', + 'ges-timeline.h', + 'ges-layer.h', + 'ges-clip.h', + 'ges-pipeline.h', + 'ges-source-clip.h', + 'ges-uri-clip.h', + 'ges-base-effect-clip.h', + 'ges-effect-clip.h', + 'ges-operation-clip.h', + 'ges-base-transition-clip.h', + 'ges-transition-clip.h', + 'ges-test-clip.h', + 'ges-title-clip.h', + 'ges-overlay-clip.h', + 'ges-text-overlay-clip.h', + 'ges-base-effect.h', + 'ges-effect.h', + 'ges-track.h', + 'ges-audio-track.h', + 'ges-video-track.h', + 'ges-track-element.h', + 'ges-source.h', + 'ges-operation.h', + 'ges-video-source.h', + 'ges-audio-source.h', + 'ges-video-uri-source.h', + 'ges-audio-uri-source.h', + 'ges-image-source.h', + 'ges-multi-file-source.h', + 'ges-transition.h', + 'ges-audio-transition.h', + 'ges-video-transition.h', + 'ges-video-test-source.h', + 'ges-audio-test-source.h', + 'ges-title-source.h', + 'ges-text-overlay.h', + 'ges-screenshot.h', + 'ges-formatter.h', + 'ges-pitivi-formatter.h', + 'ges-asset.h', + 'ges-uri-asset.h', + 'ges-clip-asset.h', + 'ges-track-element-asset.h', + 'ges-extractable.h', + 'ges-project.h', + 'ges-base-xml-formatter.h', + 'ges-xml-formatter.h', + 'ges-command-line-formatter.h', + 'ges-timeline-element.h', + 'ges-container.h', + 'ges-effect-asset.h', + 'ges-smart-adder.h', + 'ges-utils.h', + 'ges-group.h' +] + + +version_data = configuration_data() +version_data.set('GES_VERSION_MAJOR', gst_version_major) +version_data.set('GES_VERSION_MINOR', gst_version_minor) +version_data.set('GES_VERSION_MICRO', gst_version_micro) +version_data.set('GES_VERSION_NANO', gst_version_nano) + +configure_file(input : 'ges-version.h.in', + output : 'ges-version.h', + configuration : version_data) + +install_headers(ges_headers + ['ges-version.h'], subdir : 'gstreamer-1.0/ges') + +flex = find_program('flex', required : false) +if not flex.found() + flex = find_program('win_flex', required : false) + if not flex.found() + error('flex not found') + endif +endif + +parser = custom_target('gesparselex', + input : 'parse.l', + output : ['lex.priv_ges_parse_yy.c', 'ges-parse-lex.h'], + command : [flex, '-Ppriv_ges_parse_yy', '--header-file=@OUTPUT1@', '-o', '@OUTPUT0@', '@INPUT@'] +) + +libges = shared_library('ges-1.0', ges_sources, parser, + version : libversion, + soversion : soversion, + c_args : [ges_c_args], + include_directories : [configinc], + install : true, + dependencies : libges_deps +) + +if build_gir + gnome.generate_gir(libges, + sources : ges_sources + ges_headers, + namespace : 'GES', + nsversion : apiversion, + identifier_prefix : 'GES', + symbol_prefix : 'ges', + export_packages : 'ges-1.0', + includes : ['Gst-1.0', 'GstPbutils-1.0', 'GstVideo-1.0', 'Gio-2.0'], + install : true, + dependencies : libges_deps, + extra_args : gir_init_section + ) +endif + +ges_dep = declare_dependency(link_with : libges, + include_directories : [configinc], +) diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..88ffeec2 --- /dev/null +++ b/meson.build @@ -0,0 +1,100 @@ +project('gst-editing-services', 'c', + version : '1.9.1.1', + meson_version : '>= 0.33.0', + default_options : [ 'warning_level=1', + 'c_std=gnu99', + 'buildtype=debugoptimized' ]) + +gst_version = meson.project_version() +version_arr = gst_version.split('.') +gst_version_major = version_arr[0] +gst_version_minor = version_arr[1] +gst_version_micro = version_arr[2] +if version_arr.length() == 4 + gst_version_nano = version_arr[3] +else + gst_version_nano = 0 +endif + +apiversion = '1.0' +soversion = 0 +# maintaining compatibility with the previous libtool versioning +# current = minor * 100 + micro +libversion = '@0@.@1@.0'.format(soversion, gst_version_minor.to_int() * 100 + gst_version_micro.to_int()) + +glib_req = '>= 2.40.0' +gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor) + +cc = meson.get_compiler('c') +# Ignore several spurious warnings for things gstreamer does very commonly +# If a warning is completely useless and spammy, use '/wdXXXX' to suppress it +# If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once +# NOTE: Only add warnings here if you are sure they're spurious +if cc.get_id() == 'msvc' + add_global_arguments('/wd4018', '/wd4244', '/wd4996', language : 'c') +endif + +cdata = configuration_data() +cdata.set('VERSION', '"@0@"'.format(gst_version)) +cdata.set('PACKAGE', '"gst-editing-services"') +cdata.set('PACKAGE_VERSION', '"@0@"'.format(gst_version)) +cdata.set('PACKAGE_BUGREPORT', '"http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer"') +cdata.set('PACKAGE_NAME', '"GStreamer Editing Services"') +cdata.set('GST_PACKAGE_NAME', '"GStreamer Editing Services"') +cdata.set('GST_PACKAGE_ORIGIN', '"Unknown package origin"') +cdata.set('GST_LICENSE', '"LGPL"') +cdata.set('LIBDIR', '"@0@"'.format(get_option('libdir'))) + +# Mandatory GST deps +gst_dep = dependency('gstreamer-' + apiversion, version : gst_req, + fallback : ['gstreamer', 'gst_dep']) +gstpbutils_dep = dependency('gstreamer-pbutils-' + apiversion, version : gst_req, + fallback : ['gst-plugins-base', 'pbutils_dep']) +gstvideo_dep = dependency('gstreamer-video-' + apiversion, version : gst_req, + fallback : ['gst-plugins-base', 'video_dep']) +gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req, + fallback : ['gstreamer', 'gst_base_dep']) +gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req, + fallback : ['gstreamer', 'gst_check_dep']) +gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req, + fallback : ['gstreamer', 'gst_controller_dep']) +gstvalidate_dep = dependency('gst-validate-1.0', version : gst_req, required : false, + fallback : ['gst-devtools', 'validate_dep']) + +gio_dep = dependency('gio-2.0', version : glib_req) +libxml_dep = dependency('libxml-2.0') + +# TODO Properly port to Gtk 3 +# gtk_dep = dependency('gtk+-3.0', required : false) + +libges_deps = [gst_dep, gstbase_dep, gstvideo_dep, gstpbutils_dep, + gstcheck_dep, gstcontroller_dep, gio_dep, libxml_dep] + +if gstvalidate_dep.found() + libges_deps = libges_deps + [gstvalidate_dep] + cdata.set('HAVE_GST_VALIDATE', 1) +endif + +configure_file(input : 'config.h.meson', + output : 'config.h', + configuration : cdata) + + +gir = find_program('g-ir-scanner', required : false) +gnome = import('gnome') + +# Fixme, not very elegant. +build_gir = gir.found() and not meson.is_cross_build() +gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**); gst_init(NULL,NULL);' ] + +ges_c_args = ['-DHAVE_CONFIG_H'] +plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir')) + +configinc = include_directories('.') +subdir('ges') +subdir('plugins') +subdir('tools') +subdir('pkgconfig') +subdir('tests') +subdir('examples') +subdir('docs') diff --git a/pkgconfig/meson.build b/pkgconfig/meson.build new file mode 100644 index 00000000..24af5400 --- /dev/null +++ b/pkgconfig/meson.build @@ -0,0 +1,22 @@ +pkgconf = configuration_data() + +pkgconf.set('prefix', get_option('prefix')) +pkgconf.set('exec_prefix', '${prefix}') +pkgconf.set('libdir', '${prefix}/@0@'.format(get_option('libdir'))) +pkgconf.set('includedir', '${prefix}/@0@'.format(get_option('includedir'))) +pkgconf.set('GST_API_VERSION', apiversion) +pkgconf.set('VERSION', gst_version) + +pkg_install_dir = '@0@/pkgconfig'.format(get_option('libdir')) + +pkg_files = ['gst-editing-services'] + +foreach p : pkg_files + infile = p + '.pc.in' + outfile = p + '-1.0.pc' + configure_file(input : infile, + output : outfile, + configuration : pkgconf, + install_dir : pkg_install_dir) +endforeach + diff --git a/plugins/meson.build b/plugins/meson.build new file mode 100644 index 00000000..8dbfcde3 --- /dev/null +++ b/plugins/meson.build @@ -0,0 +1 @@ +subdir('nle') diff --git a/plugins/nle/meson.build b/plugins/nle/meson.build new file mode 100644 index 00000000..4531c572 --- /dev/null +++ b/plugins/nle/meson.build @@ -0,0 +1,17 @@ +nle_sources = ['nleobject.c', + 'nlecomposition.c', + 'nleghostpad.c', + 'nleoperation.c', + 'nlesource.c', + 'nleurisource.c', + 'gstnle.c' +] + +nle = library('gstnle', nle_sources, + dependencies : [gst_dep, gstbase_dep], + include_directories: [configinc], + c_args : ges_c_args, + install : true, + install_dir : plugins_install_dir, +) + diff --git a/tests/check/meson.build b/tests/check/meson.build new file mode 100644 index 00000000..f79916b9 --- /dev/null +++ b/tests/check/meson.build @@ -0,0 +1,73 @@ +# tests and condition when to skip the test +ges_tests = [ + ['ges/asset'], + ['ges/backgroundsource'], + ['ges/basic'], + ['ges/layer'], + ['ges/effects'], + ['ges/uriclip'], + ['ges/clip'], + ['ges/timelineedition'], + ['ges/titles'], + ['ges/transition'], + ['ges/overlays'], + ['ges/text_properties'], + ['ges/mixers'], + ['ges/group'], + ['ges/project'], + ['ges/track'], + ['ges/tempochange'], + ['nle/simple'], + ['nle/complex'], + ['nle/nleoperation'], + ['nle/nlecomposition'], + ['nle/tempochange'] +] + +test_defines = [ + '-UG_DISABLE_ASSERT', + '-UG_DISABLE_CAST_CHECKS', + '-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_STATE_IGNORE_ELEMENTS"', + '-DTESTFILE="' + meson.current_source_dir() + '/meson.build"', + '-DGST_USE_UNSTABLE_API', +] + +runcmd = run_command('pkg-config', '--variable=pluginsdir', 'gstreamer-1.0', + 'gstreamer-plugins-base-1.0', 'gstreamer-plugins-bad-1.0') +if runcmd.returncode() == 0 + needed_plugins_dirs = meson.build_root() + 'plugins/nle' + foreach path: runcmd.stdout().strip().split(' ') + needed_plugins_dirs = needed_plugins_dirs + ':' + path + endforeach +else + error('Could not determine GStreamer core plugins directory for unit tests.') +endif + +test_env = [ + 'GST_PLUGIN_SYSTEM_PATH_1_0=', + 'GST_PLUGIN_PATH_1_0=' + needed_plugins_dirs, + 'GST_PLUGIN_SCANNER_1_0='+ meson.build_root() + '/libs/gst/helpers/gst-plugin-scanner', + 'GST_STATE_IGNORE_ELEMENTS=', + 'CK_DEFAULT_TIMEOUT=20', +] + +foreach t : ges_tests + test_name = t.get(0) + if t.length() == 2 + skip_test = t.get(1) + else + skip_test = false + endif + + if not skip_test + exe = executable(test_name, '@0@.c'.format(test_name), + 'ges/test-utils.c', 'nle/common.c', + c_args : ges_c_args + test_defines, + include_directories : [configinc], + dependencies : libges_deps + [gstcheck_dep, ges_dep], + ) + test(test_name, exe, + env: test_env + ['GST_REGISTRY=@0@/@1@.registry'.format(meson.current_build_dir(), test_name)] + ) + endif +endforeach diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 00000000..6326d2d5 --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,5 @@ +# FIXME: make check work on windows +if host_machine.system() != 'windows' +subdir('check') +endif + diff --git a/tools/meson.build b/tools/meson.build new file mode 100644 index 00000000..e90d70d9 --- /dev/null +++ b/tools/meson.build @@ -0,0 +1,13 @@ +deps = [ges_dep, gstpbutils_dep, gio_dep] + +ges_tool_args = [ges_c_args] +if gstvalidate_dep.found() + deps = deps + [gstvalidate_dep] + ges_tool_args += ['-DGST_USE_UNSTABLE_API'] +endif + +executable('ges-launch-@0@'.format(apiversion), + 'ges-validate.c', 'ges-launch.c', 'ges-launcher.c', 'utils.c', + c_args : [ges_tool_args], + dependencies : deps +) -- cgit v1.2.3