X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=meson.build;h=28c1f4ba11362547b89ea36ead045b4457d80fa3;hb=3ff44eabc3589584ed73ba77ce34e62042d6e578;hp=3361dbcee1b0592cc9a12dfaa939d9a7f88ca315;hpb=121e8e62106b6b791744dbbfec866f7c811db126;p=platform%2Fupstream%2Fgstreamer.git diff --git a/meson.build b/meson.build index 3361dbc..28c1f4b 100644 --- a/meson.build +++ b/meson.build @@ -1,40 +1,58 @@ project('gst-plugins-ugly', 'c', - version : '1.13.0.1', - meson_version : '>= 0.36.0', + version : '1.19.0.1', + meson_version : '>= 0.54', default_options : [ 'warning_level=1', '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] +gst_version_major = version_arr[0].to_int() +gst_version_minor = version_arr[1].to_int() +gst_version_micro = version_arr[2].to_int() + if version_arr.length() == 4 + gst_version_nano = version_arr[3].to_int() else gst_version_nano = 0 endif +gst_version_is_dev = gst_version_minor % 2 == 1 and gst_version_micro < 90 -glib_req = '>= 2.40.0' +have_cxx = add_languages('cpp', native: false, required: false) + +glib_req = '>= 2.44.0' gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor) api_version = '1.0' -plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir')) +plugins_install_dir = join_paths(get_option('libdir'), 'gstreamer-1.0') +plugins = [] cc = meson.get_compiler('c') +if have_cxx + cxx = meson.get_compiler('cpp') +endif if cc.get_id() == 'msvc' - # 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 - add_project_arguments( + msvc_args = [ + # 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 '/wd4018', # implicit signed/unsigned conversion '/wd4146', # unary minus on unsigned (beware INT_MIN) '/wd4244', # lossy type conversion (e.g. double -> int) '/wd4305', # truncating type conversion (e.g. double -> float) - language : 'c') + cc.get_supported_arguments(['/utf-8']), # set the input encoding to utf-8 + + # Enable some warnings on MSVC to match GCC/Clang behaviour + '/w14062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled + '/w14101', # 'identifier' : unreferenced local variable + '/w14189', # 'identifier' : local variable is initialized but not referenced + ] + if have_cxx + add_project_arguments(msvc_args, language: ['c', 'cpp']) + else + add_project_arguments(msvc_args, language: 'c') + endif # Disable SAFESEH with MSVC for plugins and libs that use external deps that # are built with MinGW noseh_link_args = ['/SAFESEH:NO'] @@ -42,6 +60,13 @@ else noseh_link_args = [] endif +if cc.has_link_argument('-Wl,-Bsymbolic-functions') + add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c') +endif +if have_cxx and cxx.has_link_argument('-Wl,-Bsymbolic-functions') + add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'cpp') +endif + cdata = configuration_data() check_headers = [ ['HAVE_DLFCN_H', 'dlfcn.h'], @@ -65,25 +90,7 @@ foreach h : check_headers endforeach check_functions = [ -# check token HAVE_CPU_ALPHA -# check token HAVE_CPU_ARM -# check token HAVE_CPU_CRIS -# check token HAVE_CPU_CRISV32 -# check token HAVE_CPU_HPPA -# check token HAVE_CPU_I386 -# check token HAVE_CPU_IA64 -# check token HAVE_CPU_M68K -# check token HAVE_CPU_MIPS -# check token HAVE_CPU_PPC -# check token HAVE_CPU_PPC64 -# check token HAVE_CPU_S390 -# check token HAVE_CPU_SPARC -# check token HAVE_CPU_X86_64 - ['HAVE_DCGETTEXT', 'dcgettext'], -# check token HAVE_EXPERIMENTAL -# check token HAVE_EXTERNAL -# check token HAVE_GETTEXT -# check token HAVE_VALGRIND + ['HAVE_DCGETTEXT', 'dcgettext'], # FIXME: this looks unused ] foreach f : check_functions @@ -98,13 +105,14 @@ cdata.set('SIZEOF_LONG', cc.sizeof('long')) cdata.set('SIZEOF_SHORT', cc.sizeof('short')) cdata.set('SIZEOF_VOIDP', cc.sizeof('void*')) -cdata.set('VERSION', '"@0@"'.format(gst_version)) -cdata.set('PACKAGE', '"gst-plugins-ugly"') -cdata.set('GETTEXT_PACKAGE', '"gst-plugins-ugly-1.0"') -cdata.set('GST_LICENSE', '"LGPL"') +cdata.set_quoted('VERSION', gst_version) +cdata.set_quoted('PACKAGE', 'gst-plugins-ugly') +cdata.set_quoted('GST_LICENSE', 'LGPL') +cdata.set_quoted('GETTEXT_PACKAGE', 'gst-plugins-ugly-1.0') +cdata.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir'))) # GStreamer package name and origin url -gst_package_name = get_option('with-package-name') +gst_package_name = get_option('package-name') if gst_package_name == '' if gst_version_nano == 0 gst_package_name = 'GStreamer Ugly Plug-ins source release' @@ -115,7 +123,7 @@ if gst_package_name == '' endif endif cdata.set_quoted('GST_PACKAGE_NAME', gst_package_name) -cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('with-package-origin')) +cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('package-origin')) # Mandatory GST deps gst_dep = dependency('gstreamer-1.0', version : gst_req, @@ -144,55 +152,163 @@ gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req, fallback : ['gst-plugins-base', 'sdp_dep']) gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req, fallback : ['gst-plugins-base', 'rtsp_dep']) -if host_machine.system() != 'windows' - gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req, +gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req, + required : get_option('tests'), fallback : ['gstreamer', 'gst_check_dep']) -endif gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req, fallback : ['gstreamer', 'gst_controller_dep']) -orc_dep = dependency('orc-0.4', version : '>= 0.4.16', required : false) +orc_dep = dependency('orc-0.4', version : '>= 0.4.16', required : get_option('orc'), + fallback : ['orc', 'orc_dep']) if orc_dep.found() cdata.set('HAVE_ORC', 1) # used by a52dec for cpu detection else cdata.set('DISABLE_ORC', 1) endif -configure_file(output : 'config.h', configuration : cdata) +gmodule_dep = dependency('gmodule-2.0', fallback : ['glib', 'libgmodule_dep']) ugly_args = ['-DHAVE_CONFIG_H'] configinc = include_directories('.') libsinc = include_directories('gst-libs') +# Disable compiler warnings for unused variables and args if gst debug system is disabled if gst_dep.type_name() == 'internal' - gst_proj = subproject('gstreamer') + gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug') +else + # We can't check that in the case of subprojects as we won't + # be able to build against an internal dependency (which is not built yet) + gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep) +endif - if gst_proj.get_variable('disable_gst_debug') - message('GStreamer debug system is disabled') - add_project_arguments('-Wno-unused', language: 'c') - else - message('GStreamer debug system is enabled') - endif +if gst_debug_disabled + message('GStreamer debug system is disabled') + if cc.has_argument('-Wno-unused') + add_project_arguments('-Wno-unused', language: 'c') + endif + if have_cxx and cxx.has_argument ('-Wno-unused') + add_project_arguments('-Wno-unused', language: 'cpp') + endif else - # We can't check that in the case of subprojects as we won't - # be able to build against an internal dependency (which is not built yet) - if not cc.compiles(''' -#include -#ifdef GST_DISABLE_GST_DEBUG -#error "debugging disabled, make compiler fail" -#endif''' , dependencies: gst_dep) - message('GStreamer debug system is disabled') - add_global_arguments('-Wno-unused', language: 'c') - else - message('GStreamer debug system is enabled') - endif + message('GStreamer debug system is enabled') +endif + +warning_flags = [ + '-Wmissing-declarations', + '-Wredundant-decls', + '-Wwrite-strings', + '-Wformat', + '-Wformat-nonliteral', + '-Wformat-security', + '-Winit-self', + '-Wmissing-include-dirs', + '-Waddress', + '-Wno-multichar', + '-Wvla', + '-Wpointer-arith', + '-Waggregate-return', + '-fno-strict-aliasing', + # Symbol visibility + '-fvisibility=hidden', +] + +warning_c_flags = [ + '-Wmissing-prototypes', + '-Wold-style-definition', + '-Wdeclaration-after-statement', + '-Wnested-externs' +] + +foreach extra_arg : warning_flags + if cc.has_argument (extra_arg) + add_project_arguments([extra_arg], language: 'c') + endif + if have_cxx and cxx.has_argument (extra_arg) + add_project_arguments([extra_arg], language: 'cpp') + endif +endforeach + +foreach extra_arg : warning_c_flags + if cc.has_argument (extra_arg) + add_project_arguments([extra_arg], language: 'c') + endif +endforeach + +# Define G_DISABLE_DEPRECATED for development versions +if gst_version_is_dev + message('Disabling deprecated GLib API') + add_project_arguments('-DG_DISABLE_DEPRECATED', language: 'c') +endif + +cast_checks = get_option('gobject-cast-checks') +if cast_checks.disabled() or (cast_checks.auto() and not gst_version_is_dev) + message('Disabling GLib cast checks') + add_project_arguments('-DG_DISABLE_CAST_CHECKS', language: 'c') +endif + +glib_asserts = get_option('glib-asserts') +if glib_asserts.disabled() or (glib_asserts.auto() and not gst_version_is_dev) + message('Disabling GLib asserts') + add_project_arguments('-DG_DISABLE_ASSERT', language: 'c') +endif + +glib_checks = get_option('glib-checks') +if glib_checks.disabled() or (glib_checks.auto() and not gst_version_is_dev) + message('Disabling GLib checks') + add_project_arguments('-DG_DISABLE_CHECKS', language: 'c') endif presetdir = join_paths(get_option('datadir'), 'gstreamer-' + api_version, 'presets') + +pkgconfig = import('pkgconfig') +plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig') +if get_option('default_library') == 'shared' + # If we don't build static plugins there is no need to generate pc files + plugins_pkgconfig_install_dir = disabler() +endif + +python3 = import('python').find_installation() subdir('gst') subdir('ext') subdir('tests') -subdir('po') -python3 = import('python3').find_python() +# xgettext is optional (on Windows for instance) +if find_program('xgettext', required : get_option('nls')).found() + cdata.set('ENABLE_NLS', 1) + subdir('po') +endif +subdir('docs') +subdir('scripts') + +# 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-plugins-ugly.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 +endif + +configure_file(output : 'config.h', configuration : cdata) + run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")') + +if meson.version().version_compare('>= 0.54') + plugin_names = [] + foreach plugin: plugins + # FIXME: Use str.subtring() when we can depend on Meson 0.56 + split = plugin.name().split('gst') + if split.length() == 2 + plugin_names += [split[1]] + else + warning('Need substring API in meson >= 0.56 to properly parse plugin name: ' + plugin.name()) + plugin_names += [plugin.name()] + endif + endforeach + summary({'Plugins':plugin_names}, list_sep: ', ') +endif