diff --git a/meson.build b/meson.build index 39daf5ee86..4a324e39e0 100644 --- a/meson.build +++ b/meson.build @@ -85,15 +85,16 @@ if not meson.is_subproject() and cc.get_id() == 'msvc' endif building_full = get_option('default_library') == 'static' -tools_option = [] -if building_full and not get_option('tools').disabled() - # Do not build subprojects tools when we build them against gst-full - tools_option = ['tools=disabled'] +building_full_static = get_option('gst-full-target-type') == 'static_library' +buildind_full_options = [] + +if building_full +buildind_full_options = ['gstreamer-full=enabled'] endif # Ordered list of subprojects (dict has no ordering guarantees) subprojects = [ - ['gstreamer', {'build-hotdoc': true, 'subproject_options': tools_option}], + ['gstreamer', {'build-hotdoc': true, 'subproject_options': buildind_full_options}], ['gst-plugins-base', {'option': get_option('base'), 'build-hotdoc': true}], ['gst-plugins-good', {'option': get_option('good'), 'build-hotdoc': true}], ['libnice', { 'option': get_option('libnice'), 'match_gst_version': false}], @@ -101,9 +102,9 @@ subprojects = [ ['gst-plugins-ugly', { 'option': get_option('ugly'), 'build-hotdoc': true}], ['gst-libav', { 'option': get_option('libav'), 'build-hotdoc': true}], ['gst-rtsp-server', { 'option': get_option('rtsp_server'), 'build-hotdoc': true}], - ['gst-devtools', { 'option': get_option('devtools'), 'build-hotdoc': true, 'subproject_options': tools_option}], + ['gst-devtools', { 'option': get_option('devtools'), 'build-hotdoc': true}], ['gst-integration-testsuites', { 'option': get_option('devtools') }], - ['gst-editing-services', { 'option': get_option('ges'), 'build-hotdoc': true, 'subproject_options': tools_option}], + ['gst-editing-services', { 'option': get_option('ges'), 'build-hotdoc': true}], ['gstreamer-vaapi', { 'option': get_option('vaapi'), 'build-hotdoc': true}], ['gst-omx', { 'option': get_option('omx'), 'build-hotdoc': true}], ['gstreamer-sharp', { 'option': get_option('sharp') }], @@ -421,17 +422,17 @@ if building_full giomodules_deps += dependency(module) endforeach - # Build both shared and static library - gstfull = both_libraries('gstreamer-full-1.0', + # Build shared library + gstfull = build_target('gstreamer-full-1.0', init_static_plugins_c, + target_type: get_option('gst-full-target-type'), link_args: gstfull_link_args, link_whole : exposed_libs, dependencies : [incdir_deps, glib_deps, all_plugins, giomodules_deps], link_depends : link_deps, install : true, ) - - gst_full_dep = declare_dependency(link_with: gstfull.get_shared_lib(), + gst_full_dep = declare_dependency(link_with: gstfull, dependencies : incdir_deps + glib_deps, include_directories: include_directories('.') ) @@ -441,7 +442,12 @@ if building_full warning('The compiler does not support `-Wl,--undefined` linker flag. The method `gst_init_static_plugins` might be dropped during the link stage of an application using libgstreamer-full-1.0.a, preventing plugins registration.') endif - if not get_option('introspection').disabled() + if building_full_static + warning('Introspection is enabled in gst-full static build mode but this is not supported by now. gir generation is now disabled.') + endif + # FIXME: gnome.generate_gir should link with not only gstfull in static gst-full but the whole gstreamer suite. + # tried dependencies without success. + if not get_option('introspection').disabled() and not building_full_static built_girs = {} foreach gir: exposed_girs includes = [] @@ -466,10 +472,9 @@ if building_full if not get_option('tools').disabled() foreach tool, data: all_tools + gst_full_tools += tool exe_name = '@0@-@1@'.format(tool, apiversion) - extra_args = data.get('extra_c_args', []) - sources = data.get('files') - install_tag = data.get('install_tag', 'bin') + deps = [] foreach d : data.get('deps', []) if d not in exposed_deps @@ -477,15 +482,28 @@ if building_full endif endforeach - executable(exe_name, - sources, - install: true, - install_tag: install_tag, - include_directories : [configinc], + exe = executable(exe_name, + data.get('files'), + install: data.get('install', true), + install_tag: data.get('install_tag', 'bin'), + install_dir: data.get('install_dir', get_option('bindir')), + include_directories : data.get('include_directories', [configinc]), dependencies : [gst_full_dep] + deps, - c_args: extra_args + gst_c_args + ['-DG_LOG_DOMAIN="@0@"'.format(exe_name)], + c_args: data.get('extra_c_args', []) + gst_c_args + ['-DG_LOG_DOMAIN="@0@"'.format(exe_name)], + cpp_args: data.get('extra_cpp_args', []), + objc_args: data.get('extra_objc_args', []), + override_options: data.get('override_options', []), ) + if(data.has_key('env')) + env = data.get('env') + value = env[1] + if env[1] == 'exe-full-path' + value = exe.full_path() + endif + meson.add_devenv({env[0]: value}) + endif + if data.has_key('man_page') install_man(data.get('man_page')) endif @@ -537,13 +555,7 @@ endif summary({ 'gstreamer-full library': building_full, + 'gstreamer-full target type': get_option('gst-full-target-type'), + 'Tools': gst_full_tools, + 'Tests and examples disabled': building_full, }, section: 'Build options', bool_yn: true, list_sep: ' ') - -gst_tools = [] -foreach tool, data: all_tools - gst_tools += tool -endforeach - -summary({ - 'Tools': gst_tools, -}, section: 'Build options', list_sep: ', ') diff --git a/meson_options.txt b/meson_options.txt index 273f8767f9..e5eeb4cb32 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -38,6 +38,8 @@ option('gst-full-device-providers', type : 'string', value : '', description : '''List of device providers to expose in gstreamer-full's ABI with the syntax plugin1:dp1;plugin2:dp1:dp2. By default '' will export all device provider of the enabled plugin.''') option('gst-full-dynamic-types', type : 'string', value : '', description : '''List of dynamic types to expose in gstreamer-full's ABI with the syntax plugin:dt1,dt2. By default '' will export all device provider of the enabled plugin.''') +option('gst-full-target-type', type : 'combo', value : 'shared_library', choices: ['static_library', 'shared_library'], + description : '''The type of library of gstreamer-full-1.0.''') option('orc-source', type: 'combo', choices: ['system', 'subproject', 'auto'], value: 'subproject') option('build-tools-source', type: 'combo', choices: ['system', 'subproject'], value: 'subproject') diff --git a/subprojects/gst-devtools/validate/tests/meson.build b/subprojects/gst-devtools/validate/tests/meson.build index ebe43eb3b1..05fccc8000 100644 --- a/subprojects/gst-devtools/validate/tests/meson.build +++ b/subprojects/gst-devtools/validate/tests/meson.build @@ -10,6 +10,10 @@ else endif gst_plugin_scanner_path = join_paths(gst_plugin_scanner_dir, 'gst-plugin-scanner') +if get_option('tests').disabled() or static_build + subdir_done() +endif + # FIXME: make check work on windows if host_machine.system() != 'windows' and gst_check_dep.found() subdir('check') diff --git a/subprojects/gst-devtools/validate/tools/meson.build b/subprojects/gst-devtools/validate/tools/meson.build index 88796e3263..d70dd9da5d 100644 --- a/subprojects/gst-devtools/validate/tools/meson.build +++ b/subprojects/gst-devtools/validate/tools/meson.build @@ -47,7 +47,7 @@ else message('Can not build gst-validate-transcoding-' + apiversion) endif -if not get_option('tools').disabled() +if not get_option('tools').disabled() and not static_build foreach tool, data: gst_tools if not data.has_key('config_data') diff --git a/subprojects/gst-editing-services/examples/meson.build b/subprojects/gst-editing-services/examples/meson.build index 76d1974ff0..b4ce429766 100644 --- a/subprojects/gst-editing-services/examples/meson.build +++ b/subprojects/gst-editing-services/examples/meson.build @@ -1 +1,5 @@ +if get_option('examples').disabled() or static_build + subdir_done() +endif + subdir('c') diff --git a/subprojects/gst-editing-services/meson.build b/subprojects/gst-editing-services/meson.build index 811a87c490..e076844a7d 100644 --- a/subprojects/gst-editing-services/meson.build +++ b/subprojects/gst-editing-services/meson.build @@ -270,9 +270,7 @@ subdir('plugins') subdir('tools') subdir('tests') -if not get_option('examples').disabled() - subdir('examples') -endif +subdir('examples') subdir('docs') pygi_override_dir = get_option('pygi-overrides-dir') diff --git a/subprojects/gst-editing-services/tests/meson.build b/subprojects/gst-editing-services/tests/meson.build index 0ef30b3d30..7a31607833 100644 --- a/subprojects/gst-editing-services/tests/meson.build +++ b/subprojects/gst-editing-services/tests/meson.build @@ -1,3 +1,7 @@ +if get_option('tests').disabled() or static_build + subdir_done() +endif + # FIXME: make check work on windows if host_machine.system() != 'windows' and gstcheck_dep.found() subdir('check') diff --git a/subprojects/gst-examples/meson.build b/subprojects/gst-examples/meson.build index 5ac5c21704..01ee1b9637 100644 --- a/subprojects/gst-examples/meson.build +++ b/subprojects/gst-examples/meson.build @@ -1,5 +1,6 @@ project('gst-examples', 'c', version : '1.23.0.1', license : 'LGPL') +static_build = get_option('default_library') == 'static' cc = meson.get_compiler('c') m_dep = cc.find_library('m', required : false) @@ -34,6 +35,10 @@ gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req, gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req, fallback : ['gst-plugins-base', 'rtp_dep']) +if static_build + subdir_done() +endif + subdir('playback') subdir('network') subdir('webrtc') diff --git a/subprojects/gst-libav/tests/meson.build b/subprojects/gst-libav/tests/meson.build index 3714641a59..89a773bbb5 100644 --- a/subprojects/gst-libav/tests/meson.build +++ b/subprojects/gst-libav/tests/meson.build @@ -1,3 +1,7 @@ -if not get_option('tests').disabled() and gstcheck_dep.found() +if get_option('tests').disabled() or static_build + subdir_done() +endif + +if gstcheck_dep.found() subdir('check') endif diff --git a/subprojects/gst-omx/examples/meson.build b/subprojects/gst-omx/examples/meson.build index 5173880576..edf22bec9b 100644 --- a/subprojects/gst-omx/examples/meson.build +++ b/subprojects/gst-omx/examples/meson.build @@ -1,3 +1,7 @@ +if get_option('examples').disabled() or static_build or host_machine.system() == 'windows' + subdir_done() +endif + if gstgl_dep.found() subdir('egl') endif diff --git a/subprojects/gst-omx/meson.build b/subprojects/gst-omx/meson.build index c33e4cdf35..cd06116a80 100644 --- a/subprojects/gst-omx/meson.build +++ b/subprojects/gst-omx/meson.build @@ -23,6 +23,8 @@ api_version = '1.0' plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir')) cc = meson.get_compiler('c') +static_build = get_option('default_library') == 'static' + if cc.get_id() == 'msvc' msvc_args = [ @@ -410,9 +412,8 @@ if not get_option('tools').disabled() subdir('tools') endif -if not get_option('tests').disabled() and gstcheck_dep.found() - subdir('tests') -endif +subdir('tests') + subdir('docs') # Set release date diff --git a/subprojects/gst-omx/tests/meson.build b/subprojects/gst-omx/tests/meson.build index 76b079162c..e41c33e64d 100644 --- a/subprojects/gst-omx/tests/meson.build +++ b/subprojects/gst-omx/tests/meson.build @@ -1,4 +1,8 @@ # FIXME: make check work on windows -if host_machine.system() != 'windows' -subdir('check') +if get_option('tests').disabled() or static_build or host_machine.system() == 'windows' + subdir_done() endif + +if gstcheck_dep.found() + subdir('check') +endif \ No newline at end of file diff --git a/subprojects/gst-plugins-bad/tests/meson.build b/subprojects/gst-plugins-bad/tests/meson.build index 91c0d18f39..1118a060d9 100644 --- a/subprojects/gst-plugins-bad/tests/meson.build +++ b/subprojects/gst-plugins-bad/tests/meson.build @@ -1,4 +1,8 @@ -if not get_option('tests').disabled() and gstcheck_dep.found() +if get_option('tests').disabled() or static_build + subdir_done() +endif + +if gstcheck_dep.found() subdir('check') subdir('interactive') subdir('validate') diff --git a/subprojects/gst-plugins-base/tests/meson.build b/subprojects/gst-plugins-base/tests/meson.build index e3a97b89db..12c3d9501c 100644 --- a/subprojects/gst-plugins-base/tests/meson.build +++ b/subprojects/gst-plugins-base/tests/meson.build @@ -1,3 +1,7 @@ +if get_option('tests').disabled() or static_build + subdir_done() +endif + pluginsdirs = [] if gst_dep.type_name() == 'pkgconfig' pluginsdirs = [gst_dep.get_variable('pluginsdir')] @@ -7,7 +11,7 @@ else endif gst_plugin_scanner_path = join_paths(gst_plugin_scanner_dir, 'gst-plugin-scanner') -if not get_option('tests').disabled() and gst_check_dep.found() +if gst_check_dep.found() subdir('check') subdir('interactive') subdir('validate') diff --git a/subprojects/gst-plugins-base/tools/meson.build b/subprojects/gst-plugins-base/tools/meson.build index ab49e83909..9dd781c43b 100644 --- a/subprojects/gst-plugins-base/tools/meson.build +++ b/subprojects/gst-plugins-base/tools/meson.build @@ -44,7 +44,7 @@ endif }, } -if not get_option('tools').disabled() +if not get_option('tools').disabled() and not static_build foreach tool, data: gst_tools exe_name = '@0@-@1@'.format(tool, api_version) executable(exe_name, diff --git a/subprojects/gst-plugins-good/gst/multifile/meson.build b/subprojects/gst-plugins-good/gst/multifile/meson.build index 7f7c53fd11..ad0559bc65 100644 --- a/subprojects/gst-plugins-good/gst/multifile/meson.build +++ b/subprojects/gst-plugins-good/gst/multifile/meson.build @@ -22,6 +22,10 @@ gstmultifile = library('gstmultifile', ) plugins += [gstmultifile] +if get_option('tests').disabled() or static_build + subdir_done() +endif + test_splitmuxpartreader_sources = [ 'test-splitmuxpartreader.c', 'gstsplitmuxpartreader.c', diff --git a/subprojects/gst-plugins-good/tests/meson.build b/subprojects/gst-plugins-good/tests/meson.build index 86c90d3f39..7299575125 100644 --- a/subprojects/gst-plugins-good/tests/meson.build +++ b/subprojects/gst-plugins-good/tests/meson.build @@ -1,4 +1,8 @@ -if not get_option('tests').disabled() and gstcheck_dep.found() +if get_option('tests').disabled() or static_build + subdir_done() +endif + +if gstcheck_dep.found() subdir('check') subdir('interactive') endif diff --git a/subprojects/gst-plugins-ugly/tests/meson.build b/subprojects/gst-plugins-ugly/tests/meson.build index 3714641a59..89a773bbb5 100644 --- a/subprojects/gst-plugins-ugly/tests/meson.build +++ b/subprojects/gst-plugins-ugly/tests/meson.build @@ -1,3 +1,7 @@ -if not get_option('tests').disabled() and gstcheck_dep.found() +if get_option('tests').disabled() or static_build + subdir_done() +endif + +if gstcheck_dep.found() subdir('check') endif diff --git a/subprojects/gst-rtsp-server/examples/meson.build b/subprojects/gst-rtsp-server/examples/meson.build index 00a08ae602..100c3f99f3 100644 --- a/subprojects/gst-rtsp-server/examples/meson.build +++ b/subprojects/gst-rtsp-server/examples/meson.build @@ -1,3 +1,7 @@ +if get_option('examples').disabled() or static_build + subdir_done() +endif + examples = [ 'test-appsrc', 'test-appsrc2', diff --git a/subprojects/gst-rtsp-server/meson.build b/subprojects/gst-rtsp-server/meson.build index f1c998b091..d402c5d1ac 100644 --- a/subprojects/gst-rtsp-server/meson.build +++ b/subprojects/gst-rtsp-server/meson.build @@ -192,12 +192,10 @@ static_build = get_option('default_library') == 'static' gst_libraries = [] subdir('gst') -if not get_option('tests').disabled() - subdir('tests') -endif -if not get_option('examples').disabled() - subdir('examples') -endif + +subdir('tests') +subdir('examples') + subdir('docs') # Set release date diff --git a/subprojects/gst-rtsp-server/tests/meson.build b/subprojects/gst-rtsp-server/tests/meson.build index 5374bcba45..3cba2d915a 100644 --- a/subprojects/gst-rtsp-server/tests/meson.build +++ b/subprojects/gst-rtsp-server/tests/meson.build @@ -1,5 +1,9 @@ # FIXME: make check work on windows -if host_machine.system() != 'windows' and gstcheck_dep.found() +if get_option('tests').disabled() or static_build or host_machine.system() == 'windows' + subdir_done() +endif + +if gstcheck_dep.found() subdir('check') endif diff --git a/subprojects/gstreamer-vaapi/tests/meson.build b/subprojects/gstreamer-vaapi/tests/meson.build index 2b8b8155df..a7e337737d 100644 --- a/subprojects/gstreamer-vaapi/tests/meson.build +++ b/subprojects/gstreamer-vaapi/tests/meson.build @@ -1,4 +1,8 @@ -if not get_option('tests').disabled() and gstcheck_dep.found() +if get_option('tests').disabled() or static_build + subdir_done() +endif + +if gstcheck_dep.found() subdir('check') endif diff --git a/subprojects/gstreamer/gst/gst.c b/subprojects/gstreamer/gst/gst.c index c068314d3e..a2df9847a8 100644 --- a/subprojects/gstreamer/gst/gst.c +++ b/subprojects/gstreamer/gst/gst.c @@ -119,6 +119,10 @@ #endif #endif +#ifdef GST_FULL_COMPILATION +void gst_init_static_plugins (); +#endif + #include #include /* for LC_ALL */ @@ -621,19 +625,9 @@ gst_register_core_elements (GstPlugin * plugin) static void init_static_plugins (void) { - GModule *module; - - /* Call gst_init_static_plugins() defined in libgstreamer-full-1.0 in the case - * libgstreamer is static linked with some plugins. */ - module = g_module_open (NULL, G_MODULE_BIND_LOCAL); - if (module) { - void (*func) (void); - if (g_module_symbol (module, "gst_init_static_plugins", - (gpointer *) & func)) { - func (); - } - g_module_close (module); - } +#ifdef GST_FULL_COMPILATION + gst_init_static_plugins (); +#endif } /* diff --git a/subprojects/gstreamer/gst/meson.build b/subprojects/gstreamer/gst/meson.build index 90ef85a867..c88e494cc2 100644 --- a/subprojects/gstreamer/gst/meson.build +++ b/subprojects/gstreamer/gst/meson.build @@ -252,6 +252,10 @@ if not tracer_hooks libgst_c_args += ['-DGST_DISABLE_GST_TRACER_HOOKS'] endif +if get_option('gstreamer-full').enabled() + libgst_c_args += ['-DGST_FULL_COMPILATION'] +endif + # Make sure that subproject building gir files work gst_incdirs = [configinc] gst_gen_sources = [gstenum_h] diff --git a/subprojects/gstreamer/meson.build b/subprojects/gstreamer/meson.build index 727525dfc5..f0d3f742f8 100644 --- a/subprojects/gstreamer/meson.build +++ b/subprojects/gstreamer/meson.build @@ -32,6 +32,7 @@ helpers_install_dir = join_paths(libexecdir, 'gstreamer-1.0') cc = meson.get_compiler('c') host_system = host_machine.system() +static_build = get_option('default_library') == 'static' if host_system == 'darwin' ios_test_code = '''#include @@ -569,7 +570,8 @@ gst_c_args = ['-DHAVE_CONFIG_H'] # FIXME: This is only needed on windows and probably breaks when # default_library = 'both'. We should add this flag to static_c_args instead # when Meson supports it: https://github.com/mesonbuild/meson/issues/3304 -if get_option('default_library') == 'static' + +if static_build gst_c_args += ['-DGST_STATIC_COMPILATION'] endif @@ -634,7 +636,7 @@ if host_system == 'darwin' pkgconfig_libs = ['-Wl,-rpath,${libdir}'] endif -static_build = get_option('default_library') == 'static' + gst_libraries = [] subdir('gst') subdir('libs') diff --git a/subprojects/gstreamer/meson_options.txt b/subprojects/gstreamer/meson_options.txt index 54d222915c..3a34bcaaa3 100644 --- a/subprojects/gstreamer/meson_options.txt +++ b/subprojects/gstreamer/meson_options.txt @@ -24,6 +24,7 @@ option('libdw', type : 'feature', value : 'auto', description : 'Use libdw to ge option('dbghelp', type : 'feature', value : 'auto', description : 'Use dbghelp to generate backtraces') option('bash-completion', type : 'feature', value : 'auto', description : 'Install bash completion files') option('coretracers', type : 'feature', value : 'auto', description : 'Build coretracers plugin') +option('gstreamer-full', type : 'feature', value : 'disabled', description : 'Build with gstreamer-full') # Common feature options option('examples', type : 'feature', value : 'auto', yield : true) diff --git a/subprojects/gstreamer/tests/meson.build b/subprojects/gstreamer/tests/meson.build index f3589a51ef..69541dc0b4 100644 --- a/subprojects/gstreamer/tests/meson.build +++ b/subprojects/gstreamer/tests/meson.build @@ -1,7 +1,11 @@ +if get_option('tests').disabled() or static_build + subdir_done() +endif + if not get_option('benchmarks').disabled() subdir('benchmarks') endif -if not get_option('tests').disabled() and gst_check_dep.found() +if gst_check_dep.found() subdir('validate') subdir('check') endif diff --git a/subprojects/gstreamer/tools/meson.build b/subprojects/gstreamer/tools/meson.build index cc1ec2f6e2..04eedfe019 100644 --- a/subprojects/gstreamer/tools/meson.build +++ b/subprojects/gstreamer/tools/meson.build @@ -31,7 +31,7 @@ foreach tool : tools endif man_page = files('@0@-1.0.1'.format(tool)) - if not get_option('tools').disabled() + if not get_option('tools').disabled() and not static_build executable(exe_name, src_file, install: true,