diff options
-rw-r--r-- | docs/reference/meson.build | 33 | ||||
-rw-r--r-- | lib/meson.build | 13 | ||||
-rw-r--r-- | meson.build | 280 | ||||
-rw-r--r-- | meson_options.txt | 10 | ||||
-rw-r--r-- | plparse/meson.build | 140 | ||||
-rw-r--r-- | plparse/plparser-mini.map | 9 | ||||
-rw-r--r-- | plparse/plparser.map | 52 | ||||
-rw-r--r-- | plparse/tests/meson.build | 12 | ||||
-rw-r--r-- | plparse/totem-pl-parser-builtins.c.template | 37 | ||||
-rw-r--r-- | plparse/totem-pl-parser-builtins.h.template | 24 | ||||
-rw-r--r-- | po/meson.build | 3 |
11 files changed, 613 insertions, 0 deletions
diff --git a/docs/reference/meson.build b/docs/reference/meson.build new file mode 100644 index 0000000..1fef1e6 --- /dev/null +++ b/docs/reference/meson.build @@ -0,0 +1,33 @@ +private_headers = [ +] + +configure_file(input: 'version.xml.in', + output: 'version.xml', + configuration: version_cdata) + +glib_prefix = glib_dep.get_pkgconfig_variable('prefix') +glib_docpath = join_paths(glib_prefix, 'share', 'plparse-doc', 'html') + +plparse_prefix = get_option('prefix') +plparse_datadir = join_paths(plparse_prefix, get_option('datadir')) + + +docpath = join_paths(plparse_datadir, 'gtk-doc', 'html') + +gnome.gtkdoc('totem-pl-parser', + main_xml: 'totem-pl-parser-docs.xml', + src_dir: [ + join_paths(meson.source_root(), 'plparse'), + join_paths(meson.build_root(), 'plparse'), + ], + dependencies: plparser_dep, + scan_args: [ + '--ignore-headers=' + ' '.join(private_headers), + ], + fixxref_args: [ + '--html-dir=@0@'.format(docpath), + '--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')), + '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')), + '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')), + ], + install: true) diff --git a/lib/meson.build b/lib/meson.build new file mode 100644 index 0000000..2ab00db --- /dev/null +++ b/lib/meson.build @@ -0,0 +1,13 @@ +totem_glibc_sources = ['stub.c'] + +if not cc.has_function('asprintf') + # FIXME: this is untested + totem_glibc_sources += ['asprintf.c'] + cdata.set('asprintf', 'totem_private_asprintf') +else + cdata.set('HAVE_ASPRINTF', true) +endif + +totem_glibc_lib = static_library('totem_glibc', + totem_glibc_sources, + install: false) diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..1ad2002 --- /dev/null +++ b/meson.build @@ -0,0 +1,280 @@ +project('totem-pl-parser', 'c', + version: '3.10.7', # Don't forget to also change plparser_lt_version! + default_options: [ + 'buildtype=debugoptimized', + 'warning_level=1', + ], + meson_version : '>= 0.40.1', + license: 'LGPLv2.0+') + +# Before making a release, the plparser_lt_version string should be modified. +# The string is of the form C:R:A. +# - If interfaces have been changed or added, but binary compatibility has +# been preserved, change to C+1:0:A+1 +# - If binary compatibility has been broken (eg removed or changed interfaces) +# change to C+1:0:0 +# - If the interface is the same as the previous version, change to C:R+1:A +plparser_lt_version='19:0:1' + +plparse_version = meson.project_version() +plparse_major_version = plparse_version.split('.')[0].to_int() +plparse_minor_version = plparse_version.split('.')[1].to_int() +plparse_micro_version = plparse_version.split('.')[2].to_int() + +plparse_soversion = '.'.join(plparser_lt_version.split(':')) + +# Requirements +glib_req = '>= 2.36.0' +gio_req = '>= 2.24.0' +quvi_req = '>= 0.9.1' +archive_req = '>= 3.0' +soup_req = '>= 2.43.0' + +# Dependencies +glib_dep = dependency('glib-2.0', version : glib_req) +gthread_dep = dependency('gthread-2.0', version : glib_req) +gio_dep = dependency('gio-2.0', version : gio_req) +xml_dep = dependency('libxml-2.0') +soup_dep = dependency('libsoup-2.4', version: soup_req) + +totem_pl_parser_deps = [glib_dep, xml_dep, gthread_dep, gio_dep, soup_dep] + +# project-wide cflags +add_project_arguments('-D_GNU_SOURCE', language: 'c') + +localedir = join_paths(get_option('prefix'), get_option('datadir'), 'locale') +add_project_arguments('-DGNOMELOCALEDIR="@0@"'.format(localedir), language: 'c') + +# configuration data for config.h +cdata = configuration_data() +cdata.set_quoted('GETTEXT_PACKAGE', 'totem-pl-parser') + +config_inc = include_directories('.') + +# configuration data for pkg-config .pc.in files +pkgconf = configuration_data() + +# common warning flags +cc = meson.get_compiler('c') + +# Compiler flags +if cc.get_id() == 'msvc' + # Compiler options taken from msvc_recommended_pragmas.h + # in GLib, based on _Win32_Programming_ by Rector and Newcomer + test_cflags = [ + '-we4002', # too many actual parameters for macro + '-we4003', # not enough actual parameters for macro + '-w14010', # single-line comment contains line-continuation character + '-we4013', # 'function' undefined; assuming extern returning int + '-w14016', # no function return type; using int as default + '-we4020', # too many actual parameters + '-we4021', # too few actual parameters + '-we4027', # function declared without formal parameter list + '-we4029', # declared formal parameter list different from definition + '-we4033', # 'function' must return a value + '-we4035', # 'function' : no return value + '-we4045', # array bounds overflow + '-we4047', # different levels of indirection + '-we4049', # terminating line number emission + '-we4053', # an expression of type void was used as an operand + '-we4071', # no function prototype given + '-we4819', # the file contains a character that cannot be represented in the current code page + ] +elif cc.get_id() == 'gcc' or cc.get_id() == 'clang' + test_cflags = [ + '-fno-strict-aliasing', + '-Wpointer-arith', + '-Wmissing-declarations', + '-Wimplicit-function-declaration', + '-Wformat=2', + '-Wformat-nonliteral', + '-Wformat-security', + '-Wstrict-prototypes', + '-Wmissing-prototypes', + '-Wnested-externs', + '-Wold-style-definition', + '-Wundef', + '-Wunused', + '-Wcast-align', + '-Wmissing-noreturn', + '-Wmissing-format-attribute', + '-Wmissing-include-dirs', + '-Wlogical-op', + '-Wno-uninitialized', + '-Wno-shadow', + '-Wno-int-conversion', + '-Wno-discarded-qualifiers', + '-Werror=redundant-decls', + '-Werror=implicit', + '-Werror=nonnull', + '-Werror=init-self', + '-Werror=main', + '-Werror=missing-braces', + '-Werror=sequence-point', + '-Werror=return-type', + '-Werror=trigraphs', + '-Werror=array-bounds', + '-Werror=write-strings', + '-Werror=address', + '-Werror=int-to-pointer-cast', + '-Werror=pointer-to-int-cast', + '-Werror=empty-body', + '-Werror=write-strings', + ] +else + test_cflags = [] +endif + +extra_warning_cflags = [] +foreach cflag: test_cflags + if cc.has_argument(cflag) + extra_warning_cflags += [ cflag ] + endif +endforeach + +# gmime dependency +enable_gmime = not get_option('disable-gmime-i-know-what-im-doing') +if enable_gmime + have_gmime3 = false + gmime_dep = dependency('gmime-3.0', required : false) + if gmime_dep.found() + cdata.set('HAVE_GMIME3', true, + description: 'GMime 3.0 available in the system') + pkgconf.set('GMIME', 'gmime-3.0') + else + gmime_dep = dependency('gmime-2.6', required : false) + if not gmime_dep.found() + error('libgmime is required to compile totem-pl-parser.') + endif + pkgconf.set('GMIME', 'gmime-2.6') + endif + pkgconf.set('USEGMIME', 'yes') + cdata.set('HAVE_GMIME', true, + description: 'GMime available in the system') + totem_pl_parser_deps += [gmime_dep] +else + message(''' +************************************************************** + Compiling totem-pl-parser without libgmime. + This will break podcast support and is completely unsupported. +************************************************************** + ''') + pkgconf.set('USEGMIME', 'no') + pkgconf.set('GMIME', '') +endif + +# quvi dependency +enable_quvi = get_option('enable-quvi') +have_quvi = false +pkgconf.set('QUVI', '') +if enable_quvi != 'no' + quvi_dep = dependency('libquvi-0.9', version: quvi_req, required: false) + if enable_quvi == 'yes' and not quvi_dep.found() + error('Quvi support requested but not available.') + endif + if quvi_dep.found() + pkgconf.set('QUVI', 'libquvi-0.9') + cdata.set('HAVE_QUVI', true, + description: 'libquvi available in the system') + have_quvi = true + totem_pl_parser_deps += [quvi_dep] + endif +endif + +# libarchive dependency +enable_libarchive = get_option('enable-libarchive') +have_libarchive = false +pkgconf.set('ARCHIVE', '') +if enable_libarchive != 'no' + libarchive_dep = dependency('libarchive', version: archive_req, required: false) + if enable_libarchive == 'yes' and not libarchive_dep.found() + error('libarchive support requested but not available.') + endif + if libarchive_dep.found() + pkgconf.set('ARCHIVE', 'libarchive') + cdata.set('HAVE_LIBARCHIVE', true, + description: 'libarchive available in the system') + have_libarchive = true + totem_pl_parser_deps += [libarchive_dep] + endif +endif + +# libgcrypt dependency +enable_libgcrypt = get_option('enable-libgcrypt') +have_libgcrypt = false +pkgconf.set('GCRYPT', '') +if enable_libgcrypt != 'no' + # presented without further comment: https://dev.gnupg.org/T2037 + libgcrypt_dep = cc.find_library('gcrypt', required : false) + + if enable_libgcrypt == 'yes' and not libgcrypt_dep.found() + error('libgcrypt support requested but not available.') + endif + if libgcrypt_dep.found() + # FIXME: we just assume it's in the standard path. We can't really parse + # the output of libgcrypt-config in any meaningful way, since if any of + # the paths have spaces in them it's all going to break. + pkgconf.set('LIBGCRYPT_LIBS', '-lgcrypt') + pkgconf.set('LIBGCRYPT_CFLAGS', '') + cdata.set('HAVE_LIBGCRYPT', true, + description: 'libgcrypt available in the system') + have_libgcrypt = true + totem_pl_parser_deps += [libgcrypt_dep] + endif +endif + +# uninstalled tests +enable_uninstalled_tests = get_option('enable-uninstalled-tests') +if enable_uninstalled_tests + cdata.set('UNINSTALLED_TESTS', true, + description: 'Uninstalled tests') +endif + +# subdirs + +plparser_inc = include_directories('plparse') + +subdir('lib') +subdir('plparse') +subdir('docs/reference') +subdir('po') + +# config.h +configure_file(output: 'config.h', configuration: cdata) + +# pkg-config files +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('VERSION', meson.project_version()) + +pkg_install_dir = join_paths(get_option('libdir'), 'pkgconfig') + +# FIXME: skipping uninstalled .pc files because they unnecessarily +# reference .la libtool archives directly, this needs fixing first +pkg_files = [ + 'totem-pl-parser.spec', + 'totem-plparser.pc', + 'totem-plparser-mini.pc', +] + +foreach pkg: pkg_files + configure_file(input: pkg + '.in', + output: pkg, + configuration: pkgconf, + install_dir: pkg_install_dir) +endforeach + +# configuration summary +message(''' + + Configuration summary: + + Quvi video link parsing : @0@ + ISO detection with libarchive : @1@ + AmazonAMZ decoding with libgcrypt : @2@ +'''.format(have_quvi.to_string('yes', 'no'), + have_libarchive.to_string('yes', 'no'), + have_libgcrypt.to_string('yes', 'no'))) + diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..b212221 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,10 @@ +option('disable-gmime-i-know-what-im-doing', type: 'boolean', value: 'false', + description : 'Disable libgmime (Unsupported, breaks Podcast support).') +option('enable-quvi', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', + description : 'Enable libquvi support.') +option('enable-libarchive', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', + description : 'Enable libarchive support.') +option('enable-libgcrypt', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', + description : 'Enable libgcrypt support.') +option('enable-uninstalled-tests', type: 'boolean', value: 'false', + description : 'Enable uninstalled tests.') diff --git a/plparse/meson.build b/plparse/meson.build new file mode 100644 index 0000000..52384ec --- /dev/null +++ b/plparse/meson.build @@ -0,0 +1,140 @@ +gnome = import('gnome') + +plparser_public_headers = [ + 'totem-pl-parser.h', + 'totem-pl-playlist.h', + 'totem-pl-parser-mini.h', +] +install_headers(plparser_public_headers, subdir : 'totem-pl-parser/1/plparser') + +# generate totem-pl-parser-features.h +version_cdata = configuration_data() +version_cdata.set('TOTEM_PL_PARSER_VERSION_MAJOR', plparse_major_version) +version_cdata.set('TOTEM_PL_PARSER_VERSION_MINOR', plparse_minor_version) +version_cdata.set('TOTEM_PL_PARSER_VERSION_MICRO', plparse_micro_version) +features_h = configure_file(output: 'totem-pl-parser-features.h', + install_dir: 'include/totem-pl-parser/1/plparser', + configuration: version_cdata) + +totem_pl_parser_builtins = gnome.mkenums('totem-pl-parser-builtins', + sources: 'totem-pl-parser.h', + c_template : 'totem-pl-parser-builtins.c.template', + h_template : 'totem-pl-parser-builtins.h.template', + install_dir : 'include/totem-pl-parser/1/plparser', + install_header : true) + +totem_pl_parser_builtins_h = totem_pl_parser_builtins[1] + +totem_pl_parser_marshalers = gnome.genmarshal('totemplparser-marshal', + sources : 'totemplparser-marshal.list', + prefix : '_totemplparser_marshal') + +plparser_sources = [ + 'totem-disc.c', + 'totem-pl-parser.c', + 'totem-pl-parser-amz.c', + 'totem-pl-parser-lines.c', + 'totem-pl-parser-media.c', + 'totem-pl-parser-misc.c', + 'totem-pl-parser-pla.c', + 'totem-pl-parser-pls.c', + 'totem-pl-parser-podcast.c', + 'totem-pl-parser-qt.c', + 'totem-pl-parser-smil.c', + 'totem-pl-parser-videosite.c', + 'totem-pl-parser-wm.c', + 'totem-pl-parser-xspf.c', + 'totem-pl-playlist.c', + 'xmlparser.c', + 'xmllexer.c', +] + +totemlib_inc = include_directories('../lib') + +libexecdir = join_paths(get_option('prefix'), get_option('libexecdir')) + +plparser_cflags = extra_warning_cflags + ['-DLIBEXECDIR="@0@"'.format(libexecdir)] + +symbol_map = 'plparser.map' +symbol_link_args = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), symbol_map) + +plparser_lib = library('totem-plparser', + plparser_sources, features_h, + totem_pl_parser_builtins, + totem_pl_parser_marshalers, + include_directories: [config_inc, totemlib_inc], + c_args: plparser_cflags, + dependencies: totem_pl_parser_deps, + link_args : symbol_link_args, + link_with: totem_glibc_lib, + link_depends : symbol_map, + soversion: plparse_soversion, + install: true) + +plparser_dep = declare_dependency(sources: [totem_pl_parser_builtins_h, features_h], + include_directories: [config_inc, plparser_inc], + dependencies: gio_dep, + link_with: plparser_lib) + +plparser_mini_sources = [ + 'totem-pl-parser.c', + 'totem-pl-parser-lines.c', + 'totem-pl-parser-misc.c', + 'totem-pl-parser-pls.c', + 'totem-pl-parser-podcast.c', + 'totem-pl-parser-qt.c', + 'totem-pl-parser-smil.c', + 'totem-pl-parser-videosite.c', + 'totem-pl-parser-wm.c', + 'totem-pl-parser-xspf.c', + 'totem-pl-parser-amz.c', + 'totem-pl-playlist.c', +] + +mini_symbol_map = 'plparser-mini.map' +mini_symbol_link_args = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mini_symbol_map) + +plparser_mini_lib = library('totem-plparser-mini', + plparser_mini_sources, + totem_pl_parser_builtins, features_h, + include_directories: [config_inc, totemlib_inc], + c_args: plparser_cflags + ['-DTOTEM_PL_PARSER_MINI'], + dependencies: gio_dep, + link_args : mini_symbol_link_args, + link_with: totem_glibc_lib, + link_depends : mini_symbol_map, + soversion: plparse_soversion, + install: true) + +if have_quvi + executable('99-totem-pl-parser-videosite', + 'videosite-parser.c', totem_pl_parser_builtins_h, + c_args: '-DLIBEXECDIR="@0@"'.format(libexecdir), + include_directories: [config_inc, totemlib_inc], + dependencies: [quvi_dep, glib_dep], + install_dir: join_paths(libexecdir, 'totem-pl-parser'), + install: true) +endif + +# Introspection +if not meson.is_cross_build() + gnome.generate_gir(plparser_lib, + sources: plparser_public_headers + plparser_sources + [ + totem_pl_parser_marshalers[1], + totem_pl_parser_builtins_h, + features_h, + ], + namespace: 'TotemPlParser', + nsversion: '1.0', + identifier_prefix: 'TotemPl', + symbol_prefix: 'totem_pl', + includes: ['GObject-2.0', 'Gio-2.0'], + extra_args: ['--identifier-prefix=TotemDisc', + '--symbol-prefix=totem_disc', + '--identifier-prefix=TotemCd', + '--symbol-prefix=totem_cd', + '--quiet'], + install: true) +endif + +subdir('tests') diff --git a/plparse/plparser-mini.map b/plparse/plparser-mini.map new file mode 100644 index 0000000..a61e50b --- /dev/null +++ b/plparse/plparser-mini.map @@ -0,0 +1,9 @@ +LIBTOTEM_PL_PARSER_MINI_1.0 { + global: + totem_pl_parser_can_parse_from_data; totem_pl_parser_can_parse_from_filename; totem_pl_parser_can_parse_from_uri; + + local: + *; +}; + + diff --git a/plparse/plparser.map b/plparse/plparser.map new file mode 100644 index 0000000..de28e97 --- /dev/null +++ b/plparse/plparser.map @@ -0,0 +1,52 @@ +LIBTOTEM_PL_PARSER_MINI_1.0 { + global: + totem_cd_detect_type; + totem_cd_detect_type_from_dir; + totem_cd_detect_type_with_url; + totem_cd_get_human_readable_name; + totem_cd_has_medium; + totem_cd_mrl_from_type; + totem_disc_media_type_get_type; + totem_disc_media_type_quark; + totem_pl_parser_add_ignored_mimetype; + totem_pl_parser_add_ignored_scheme; + totem_pl_parser_can_parse_from_data; + totem_pl_parser_can_parse_from_filename; + totem_pl_parser_can_parse_from_uri; + totem_pl_parser_error_get_type; + totem_pl_parser_error_quark; + totem_pl_parser_get_type; + totemplparser_marshal_VOID__STRING_STRING_STRING; + totem_pl_parser_new; + totem_pl_parser_parse; + totem_pl_parser_parse_async; + totem_pl_parser_parse_finish; + totem_pl_parser_parse_date; + totem_pl_parser_parse_duration; + totem_pl_parser_parse_with_base; + totem_pl_parser_parse_with_base_async; + totem_pl_parser_relative; + totem_pl_parser_resolve_uri; + totem_pl_parser_result_get_type; + totem_pl_parser_type_get_type; + totem_pl_parser_save; + totem_pl_parser_metadata_get_type; + totem_pl_playlist_get_type; + totem_pl_playlist_new; + totem_pl_playlist_size; + totem_pl_playlist_prepend; + totem_pl_playlist_append; + totem_pl_playlist_insert; + totem_pl_playlist_iter_first; + totem_pl_playlist_iter_next; + totem_pl_playlist_iter_prev; + totem_pl_playlist_get_value; + totem_pl_playlist_get_valist; + totem_pl_playlist_get; + totem_pl_playlist_set_value; + totem_pl_playlist_set_valist; + totem_pl_playlist_set; + + local: + *; +}; diff --git a/plparse/tests/meson.build b/plparse/tests/meson.build new file mode 100644 index 0000000..80faec2 --- /dev/null +++ b/plparse/tests/meson.build @@ -0,0 +1,12 @@ +test_cargs = ['-DTEST_SRCDIR="@0@/"'.format(meson.current_source_dir())] + +tests = ['parser', 'disc'] + +foreach test_name : tests + exe = executable(test_name, '@0@.c'.format(test_name), + c_args: test_cargs, + include_directories: [config_inc, totemlib_inc], + dependencies: plparser_dep) + + test(test_name, exe) +endforeach diff --git a/plparse/totem-pl-parser-builtins.c.template b/plparse/totem-pl-parser-builtins.c.template new file mode 100644 index 0000000..1f2a627 --- /dev/null +++ b/plparse/totem-pl-parser-builtins.c.template @@ -0,0 +1,37 @@ +/*** BEGIN file-header ***/ +#include "config.h" +#include "totem-pl-parser.h" +#include "totem-pl-parser-builtins.h" + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@basename@" */ +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type (void) +{ + static GType etype = 0; + if (G_UNLIKELY(etype == 0)) { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + etype = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); + } + return etype; +} + +/*** END value-tail ***/ + +/*** BEGIN file-tail ***/ + /**/ +/*** END file-tail ***/ diff --git a/plparse/totem-pl-parser-builtins.h.template b/plparse/totem-pl-parser-builtins.h.template new file mode 100644 index 0000000..7f60541 --- /dev/null +++ b/plparse/totem-pl-parser-builtins.h.template @@ -0,0 +1,24 @@ +/*** BEGIN file-header ***/ +#ifndef __TOTEM_PL_PARSER_BUILTINS_H__ +#define __TOTEM_PL_PARSER_BUILTINS_H__ + +#include <glib-object.h> + +G_BEGIN_DECLS +/*** END file-header ***/ + +/*** BEGIN file-production ***/ + +/* enumerations from "@basename@" */ +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType @enum_name@_get_type (void) G_GNUC_CONST; +#define TOTEM_TYPE_@ENUMSHORT@ (@enum_name@_get_type ()) +/*** END value-header ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* __TOTEM_PL_PARSER_BUILTINS_H__ */ +/*** END file-tail ***/ diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 0000000..b624377 --- /dev/null +++ b/po/meson.build @@ -0,0 +1,3 @@ +i18n = import('i18n') + +i18n.gettext('totem-pl-parser', preset : 'glib') |