diff options
author | Jens Georg <mail@jensge.org> | 2017-03-19 13:30:27 +0100 |
---|---|---|
committer | Jens Georg <mail@jensge.org> | 2018-10-26 20:23:13 +0200 |
commit | ed7b8a288b673dac77a8f896477918e913785cd1 (patch) | |
tree | a954eac2e6cd49feb5e77d99c1a24288e81e2832 | |
parent | 6bf3fc5558647e89e46c23b4a80ddb5859d99ceb (diff) | |
download | gssdp-ed7b8a288b673dac77a8f896477918e913785cd1.tar.gz |
meson: Backport meson support
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | doc/Makefile.am | 2 | ||||
-rw-r--r-- | doc/gssdp-sections.txt | 19 | ||||
-rw-r--r-- | doc/meson.build | 19 | ||||
-rw-r--r-- | examples/Makefile.am | 1 | ||||
-rw-r--r-- | examples/meson.build | 2 | ||||
-rw-r--r-- | libgssdp/Makefile.am | 3 | ||||
-rw-r--r-- | libgssdp/meson.build | 59 | ||||
-rw-r--r-- | meson.build | 91 | ||||
-rw-r--r-- | meson_options.txt | 5 | ||||
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/meson.build | 11 | ||||
-rw-r--r-- | tools/Makefile.am | 2 | ||||
-rw-r--r-- | tools/meson.build | 9 | ||||
-rw-r--r-- | vala/Makefile.am | 4 | ||||
-rw-r--r-- | vala/meson.build | 4 |
16 files changed, 214 insertions, 21 deletions
diff --git a/Makefile.am b/Makefile.am index 7363921..d2649a9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,7 +11,7 @@ ACLOCAL_AMFLAGS=${ACLOCAL_FLAGS} -I m4 pkgconfig_DATA= gssdp-1.0.pc pkgconfigdir = $(libdir)/pkgconfig -EXTRA_DIST = gssdp-1.0.pc.in gssdp-1.0-uninstalled.pc.in m4/introspection.m4 +EXTRA_DIST = gssdp-1.0.pc.in gssdp-1.0-uninstalled.pc.in m4/introspection.m4 meson.build meson_options.txt DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-introspection diff --git a/doc/Makefile.am b/doc/Makefile.am index 4cd21d6..80fccd7 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -78,4 +78,4 @@ include $(top_srcdir)/gtk-doc.make # Other files to distribute # e.g. EXTRA_DIST += version.xml.in -EXTRA_DIST += version.xml.in +EXTRA_DIST += version.xml.in meson.build diff --git a/doc/gssdp-sections.txt b/doc/gssdp-sections.txt index 66892aa..9e06efb 100644 --- a/doc/gssdp-sections.txt +++ b/doc/gssdp-sections.txt @@ -4,7 +4,6 @@ GSSDPClient gssdp_client_new gssdp_client_new_with_port -gssdp_client_get_main_context gssdp_client_set_server_id gssdp_client_get_server_id gssdp_client_get_interface @@ -90,6 +89,9 @@ GSSDPResourceBrowserPrivate <TITLE>Error codes</TITLE> GSSDP_ERROR GSSDPError +<SUBSECTION Standard> +GSSDP_TYPE_ERROR +gssdp_error_get_type <SUBSECTION Private> gssdp_error_quark </SECTION> @@ -97,19 +99,4 @@ gssdp_error_quark <SECTION> <FILE>gssdp</FILE> </SECTION> - -<SECTION> -<FILE>gssdp-pktinfo-message</FILE> -<SUBSECTION Standard> -GSSDPPktInfoMessage -GSSDPPktinfoMessage -GSSDPPktinfoMessageClass -GSSDPPktinfoMessagePrivate -GSSDP_IS_PKTINFO_MESSAGE -GSSDP_IS_PKTINFO_MESSAGE_CLASS -GSSDP_PKTINFO_MESAGE_CLASS -GSSDP_PKTINFO_MESSAGE -GSSDP_PKTINFO_MESSAGE_GET_CLASS -GSSDP_TYPE_PKTINFO_MESSAGE -</SUBSECTION> </SECTION> diff --git a/doc/meson.build b/doc/meson.build new file mode 100644 index 0000000..849c091 --- /dev/null +++ b/doc/meson.build @@ -0,0 +1,19 @@ +entities = configuration_data() +entities.set('VERSION', meson.project_version()) +configure_file(input: 'version.xml.in', + output: 'version.xml', configuration: + entities) + +gnome.gtkdoc('gssdp', + main_sgml : 'gssdp-docs.sgml', + src_dir : [join_paths(meson.source_root(), 'libgssdp'), + join_paths(meson.build_root(), 'libgssdp')], + ignore_headers : [ + 'gssdp-socket-source.h', + 'gssdp-client-private.h', + 'gssdp-protocol.h', + 'gssdp-pktinfo-message.h', + 'gssdp-net.h' + ], + dependencies : libgssdp, + install : true) diff --git a/examples/Makefile.am b/examples/Makefile.am index 9f47337..2011d14 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -11,3 +11,4 @@ test_publish_LDADD = $(top_builddir)/libgssdp/libgssdp-1.0.la $(LIBGSSDP_LIBS) CLEANFILES = $(BUILT_SOURCES) DISTCLEANFILES = $(BUILT_SOURCES) MAINTAINERCLEANFILES = Makefile.in $(BUILT_SOURCES) +EXTRA_DIST = meson.build diff --git a/examples/meson.build b/examples/meson.build new file mode 100644 index 0000000..0459334 --- /dev/null +++ b/examples/meson.build @@ -0,0 +1,2 @@ +executable('test-browser', 'test-browser.c', dependencies : gssdp) +executable('test-publish', 'test-publish.c', dependencies: gssdp) diff --git a/libgssdp/Makefile.am b/libgssdp/Makefile.am index 599b20e..60a28ab 100644 --- a/libgssdp/Makefile.am +++ b/libgssdp/Makefile.am @@ -65,7 +65,7 @@ if TARGET_ANDROID libgssdp_1_0_la_LIBADD += -llog endif -EXTRA_DIST = gssdp-marshal.list +EXTRA_DIST = gssdp-marshal.list meson.build CLEANFILES = $(BUILT_SOURCES) @@ -76,6 +76,7 @@ INTROSPECTION_SCANNER_ARGS = \ --identifier-prefix=GSSDP \ --add-include-path=$(top_srcdir) \ --pkg-export=gssdp-1.0 \ + --c-include=gssdp/gssdp.h \ $(WARN_SCANNERFLAGS) INTROSPECTION_COMPILER_ARGS = --includedir=$(top_srcdir) diff --git a/libgssdp/meson.build b/libgssdp/meson.build new file mode 100644 index 0000000..72cbd24 --- /dev/null +++ b/libgssdp/meson.build @@ -0,0 +1,59 @@ +marshall = gnome.genmarshal( + 'gssdp-marshal', + sources : 'gssdp-marshal.list', + prefix : 'gssdp_marshal' +) + +headers = files( + 'gssdp-client.h', + 'gssdp-resource-browser.h', + 'gssdp-resource-group.h', + 'gssdp-error.h', + 'gssdp.h', +) + +install_headers(headers, subdir : 'gssdp-1.0/libgssdp') + +sources = files( + 'gssdp-client.c', + 'gssdp-error.c', + 'gssdp-resource-browser.c', + 'gssdp-resource-group.c', + 'gssdp-socket-source.c', + 'gssdp-socket-functions.c', +) + +if pktinfo_available + sources += 'gssdp-pktinfo-message.c' +endif + +libgssdp = library('gssdp-1.0', sources + marshall, + version : '3.0.1', + dependencies : dependencies + system_deps, + include_directories : include_directories('..'), + install : true) + +gssdp = declare_dependency(link_with : libgssdp, + include_directories: include_directories('..'), + dependencies : dependencies + ) + +pkg.generate(libraries: [ libgssdp ], + subdirs: 'gssdp-1.0', + version: meson.project_version(), + name: 'gssdp-1.0', + filebase : 'gssdp-1.0', + description: 'GObject-based SSDP library', + requires_private: ['gobject-2.0', 'gio-2.0']) + +if get_option('introspection') + gir = gnome.generate_gir(libgssdp, + sources : headers + sources, + namespace : 'GSSDP', + nsversion : '1.0', + symbol_prefix : 'gssdp', + identifier_prefix : 'GSSDP', + export_packages : 'gssdp-1.0', + includes : ['GObject-2.0', 'Gio-2.0', 'Soup-2.4'], + install: true) +endif diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..114978b --- /dev/null +++ b/meson.build @@ -0,0 +1,91 @@ +project('GSSDP', 'c', version: '1.0.3') +pkg = import('pkgconfig') +gnome = import('gnome') + +cc = meson.get_compiler('c') + +conf = configuration_data() +conf.set_quoted('VERSION', meson.project_version()) + +# Check for struct in_pktinfo +pktinfo_test = '''#include <netinet/ip.h> +struct in_pktinfo pktinfo; +''' + +pktinfo_available = cc.compiles(pktinfo_test, + name : 'struct in_pktinfo is available') +conf.set10('HAVE_PKTINFO', pktinfo_available) + +# Check for if_nametoindex +if_nametoindex_test = '''#include <net/if.h> +int main(int argc, char *argv[]) { + (void) argc; + (void) argv; + if_nametoindex("lo"); + return 0; +} +''' + +ifnametoindex_available = cc.compiles(if_nametoindex_test, + name : 'if_nametoindex is available') +conf.set10('HAVE_IFNAMETOINDEX', ifnametoindex_available) + +# Check for SIOCGIFINDEX +siocgifindex_test = '''#include <sys/ioctl.h> +static const int foo = SIOCGIFINDEX; +''' +siocgifindex_available = cc.compiles(siocgifindex_test, + name : 'SIOCGIFINDEX is available') +conf.set10('HAVE_SIOCGIFINDEX', siocgifindex_available) + +configure_file(output : 'config.h', configuration : conf) + +add_global_arguments('-DHAVE_CONFIG_H=1', language : 'c') + +system_deps = [] + +# Check whether we are compiling against Android libc +bionic_test = '''#include <sys/cdefs.h> +#if !defined(__BIONIC__) + #error "Not compiling against Android libc" +#endif''' +bionic_available = cc.compiles(bionic_test, name : 'android libc') +if bionic_available + system_deps += cc.find_library('log', required: true) +endif + +# Check whether we are compiling on/against windows +if host_machine.system() == 'windows' + system_deps += cc.find_library('ws2_32', required: true) + system_deps += cc.find_library('iphlpapi', required: true) +endif + +# Assume "other" unix or linux then +generic_unix = not bionic_available and host_machine.system() != 'windows' + +dependencies = [ + dependency('glib-2.0', version : '>= 2.32'), + dependency('gobject-2.0', version : '>= 2.32'), + dependency('gio-2.0', version : '>= 2.32'), + dependency('libsoup-2.4', version : '>= 2.26.1') +] + +subdir('libgssdp') +subdir('tests') + +if get_option('sniffer') + gtk = dependency('gtk+-3.0', version : '>= 3.12') + subdir('tools') +endif + +if get_option('vapi') and get_option('introspection') + subdir('vala') +endif + +if get_option('gtk_doc') + subdir('doc') +endif + +if get_option('examples') + subdir('examples') +endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..ab1f0bd --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,5 @@ +option('gtk_doc', type: 'boolean', value: false, description: 'Enable generating the API reference (depends on GTK-Doc)') +option('sniffer', type: 'boolean', value: true, description: 'Compile graphical SSDP sniffer') +option('introspection', type: 'boolean', value : true, description: 'Enable or disable GObject Introspection') +option('vapi', type: 'boolean', value: true, description: 'Enable or disable generation of Vala vapi file') +option('examples', type: 'boolean', value: true, description : 'Enable or disable examples') diff --git a/tests/Makefile.am b/tests/Makefile.am index 6c9befc..8c18ea5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -7,6 +7,8 @@ check_PROGRAMS = test-regression test-functional noinst_LIBRARIES = libtestutil.a +EXTRA_DIST = meson.build + libtestutil_a_SOURCES = test-util.h test-util.c test_regression_SOURCES = test-regression.c diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 0000000..09e1e8b --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,11 @@ +functional = executable('test-functional', + ['test-functional.c', 'test-util.c'], + dependencies : gssdp) + +regression = executable('test-regression', + ['test-regression.c', 'test-util.c'], + dependencies : gssdp) + +# Cannot run tests in parallel because both would do UPnP on localhost +test('Functional test', functional, is_parallel: false) +test('Bug regression test', regression, is_parallel: false) diff --git a/tools/Makefile.am b/tools/Makefile.am index 840f9bb..779f1b6 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -5,6 +5,8 @@ AM_CFLAGS = $(LIBGSSDP_CFLAGS) $(LIBGTK_CFLAGS) -I$(top_srcdir) -DUI_DIR='"$(uid bin_PROGRAMS = gssdp-device-sniffer +EXTRA_DIST = meson.build + gssdp_device_sniffer_SOURCES = gssdp-device-sniffer.c gssdp_device_sniffer_LDADD = $(LIBGSSDP_LIBS) $(LIBGTK_LIBS) $(top_builddir)/libgssdp/libgssdp-1.0.la gssdp_device_sniffer_LDFLAGS = -export-dynamic $(WARN_LDFLAGS) diff --git a/tools/meson.build b/tools/meson.build new file mode 100644 index 0000000..b865ba2 --- /dev/null +++ b/tools/meson.build @@ -0,0 +1,9 @@ +sniffer_uidir = join_paths(get_option('datadir'), 'gssdp') + +sniffer = executable('gssdp-device-sniffer', + ['gssdp-device-sniffer.c'], + dependencies : [gssdp, gtk], + install: true, + c_args : '-DUI_DIR="@0@"'.format(sniffer_uidir) + ) +install_data('gssdp-device-sniffer.ui', install_dir : sniffer_uidir) diff --git a/vala/Makefile.am b/vala/Makefile.am index 6d23189..4e7b86e 100644 --- a/vala/Makefile.am +++ b/vala/Makefile.am @@ -1,10 +1,10 @@ +EXTRA_DIST = meson.build if HAVE_INTROSPECTION if HAVE_VAPIGEN gssdp-1.0.vapi: gssdp-1.0.stamp @true gssdp-1.0.stamp: $(top_builddir)/libgssdp/GSSDP-1.0.gir \ - $(srcdir)/GSSDP-1.0.metadata \ $(srcdir)/gssdp-1.0-custom.vala $(AM_V_GEN)$(VAPIGEN) --metadatadir=$(srcdir) \ --library=gssdp-1.0 --pkg=gio-2.0 --pkg=libsoup-2.4 \ @@ -15,6 +15,6 @@ gssdp-1.0.stamp: $(top_builddir)/libgssdp/GSSDP-1.0.gir \ vapidir = $(datadir)/vala/vapi vapi_DATA = gssdp-1.0.vapi $(srcdir)/gssdp-1.0.deps CLEANFILES = gssdp-1.0.vapi gssdp-1.0.stamp -EXTRA_DIST = gssdp-1.0.deps GSSDP-1.0.metadata gssdp-1.0-custom.vala gssdp-1.0.vapi gssdp-1.0.stamp +EXTRA_DIST += gssdp-1.0.deps GSSDP-1.0.metadata gssdp-1.0-custom.vala gssdp-1.0.vapi gssdp-1.0.stamp endif endif diff --git a/vala/meson.build b/vala/meson.build new file mode 100644 index 0000000..4719295 --- /dev/null +++ b/vala/meson.build @@ -0,0 +1,4 @@ +gnome.generate_vapi('gssdp-1.0', + sources : gir.get(0), + packages : ['gio-2.0', 'libsoup-2.4'], + install : true) |