[librest/wip/nielsdg/meson] Port to the Meson build system
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librest/wip/nielsdg/meson] Port to the Meson build system
- Date: Wed, 8 May 2019 17:13:27 +0000 (UTC)
commit 24036a396ce4931373eb94c0e6d9934ca5528f5a
Author: Niels De Graef <nielsdegraef gmail com>
Date: Wed May 8 08:27:38 2019 +0200
Port to the Meson build system
See the [Meson website] for a full reference. To build, test and/or
install the librest library, you essentially need the following commands:
```
$ meson build
$ ninja -C build
$ meson test -C build
$ ninja -C build install
```
For the GNOME initiative, see
https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
[Meson website]: http://mesonbuild.com/
docs/meson.build | 1 +
docs/reference/meson.build | 1 +
docs/reference/rest/meson.build | 26 +++++++++++
examples/meson.build | 25 ++++++++++
meson.build | 58 +++++++++++++++++++++++
meson_options.txt | 10 ++++
rest-extras/meson.build | 76 ++++++++++++++++++++++++++++++
rest/meson.build | 100 ++++++++++++++++++++++++++++++++++++++++
tests/meson.build | 37 +++++++++++++++
9 files changed, 334 insertions(+)
---
diff --git a/docs/meson.build b/docs/meson.build
new file mode 100644
index 0000000..ead14c4
--- /dev/null
+++ b/docs/meson.build
@@ -0,0 +1 @@
+subdir('reference')
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
new file mode 100644
index 0000000..640e7f6
--- /dev/null
+++ b/docs/reference/meson.build
@@ -0,0 +1 @@
+subdir('rest')
diff --git a/docs/reference/rest/meson.build b/docs/reference/rest/meson.build
new file mode 100644
index 0000000..d02adf3
--- /dev/null
+++ b/docs/reference/rest/meson.build
@@ -0,0 +1,26 @@
+gnome.gtkdoc('rest',
+ src_dir: [
+ include_directories('../../../rest'),
+ include_directories('../../../rest-extras'),
+ ],
+ main_xml: 'rest-docs.xml',
+ module_version: librest_api_version,
+ dependencies: [
+ librest_deps,
+ librest_dep,
+ librest_extras_dep,
+ librest_extras_deps,
+ ],
+ scan_args: [
+ '--rebuild-types',
+ ],
+ ignore_headers: [
+ 'flickr-proxy-private.h',
+ 'lastfm-proxy-private.h',
+ 'oauth-proxy-private.h',
+ 'oauth2-proxy-private.h',
+ 'rest-private.h',
+ 'rest-proxy-call-private.h',
+ 'sha1.h',
+ ],
+)
diff --git a/examples/meson.build b/examples/meson.build
new file mode 100644
index 0000000..7d16dc7
--- /dev/null
+++ b/examples/meson.build
@@ -0,0 +1,25 @@
+example_names = [
+ 'test-raw',
+ 'test-xml',
+ 'dump-xml',
+ 'post-twitter',
+ 'post-twitter-media',
+ 'get-flickr-favorites',
+ 'lastfm-shout',
+ 'continuous-twitter',
+]
+
+example_deps = [
+ glib_dep,
+ libsoup_dep,
+ librest_dep,
+ librest_extras_dep,
+]
+
+foreach name : example_names
+ example = executable(name,
+ '@0@.c'.format(name),
+ dependencies: example_deps,
+ include_directories: config_h_inc,
+ )
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..30c2cb3
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,58 @@
+project('rest', 'c',
+ version: '0.9.0',
+ license: 'LGPL2.1+',
+ meson_version: '>= 0.49',
+)
+
+# API version
+librest_api_version = '1.0'
+librest_pkg_string = 'rest-@0@'.format(librest_api_version)
+
+# Modules
+gnome = import('gnome')
+pkgconfig = import('pkgconfig')
+
+# Dependencies
+glib_dep = dependency('glib-2.0', version: '>= 2.44')
+gobject_dep = dependency('gobject-2.0', version: '>= 2.44')
+libsoup_dep = dependency('libsoup-2.4', version: '>= 2.42')
+libxml_dep = dependency('libxml-2.0')
+
+# config.h
+conf = configuration_data()
+configure_file(output: 'config.h', configuration: conf)
+config_h_inc = include_directories('.')
+
+# Subdirectories
+subdir('rest')
+subdir('rest-extras')
+subdir('tests')
+if get_option('examples')
+ subdir('examples')
+endif
+if get_option('gtk_doc')
+ subdir('docs')
+endif
+
+# pkg-config
+pkgconfig.generate(librest_lib,
+ name: meson.project_name(),
+ filebase: librest_pkg_string,
+ description: 'RESTful web api query library',
+ subdirs: librest_pkg_string,
+ requires: [ glib_dep, libsoup_dep, libxml_dep, ],
+ variables: [
+ 'apiversion=@0@'.format(librest_api_version),
+ ],
+)
+
+pkgconfig.generate(librest_extras_lib,
+ name: meson.project_name(),
+ filebase: librest_extras_pkg_string,
+ description: 'RESTful web api query library',
+ subdirs: librest_pkg_string,
+ requires: [ glib_dep, libsoup_dep, libxml_dep, ],
+ variables: [
+ 'apiversion=@0@'.format(librest_api_version),
+ ],
+)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..e5850fd
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,10 @@
+option('examples',
+ type: 'boolean',
+ value: false,
+ description: 'Build the examples',
+)
+option('gtk_doc',
+ type: 'boolean',
+ value: false,
+ description: 'Build the gtk-doc reference docs',
+)
diff --git a/rest-extras/meson.build b/rest-extras/meson.build
new file mode 100644
index 0000000..fbaf978
--- /dev/null
+++ b/rest-extras/meson.build
@@ -0,0 +1,76 @@
+librest_extras_pkg_string = 'rest-extras-@0@'.format(librest_api_version)
+
+librest_extras_sources = [
+ 'flickr-proxy.c',
+ 'flickr-proxy-call.c',
+ 'lastfm-proxy.c',
+ 'lastfm-proxy-call.c',
+ 'youtube-proxy.c',
+]
+
+librest_extras_headers = [
+ 'flickr-proxy.h',
+ 'flickr-proxy-call.h',
+ 'lastfm-proxy.h',
+ 'lastfm-proxy-call.h',
+ 'youtube-proxy.h',
+]
+
+librest_extras_deps = [
+ glib_dep,
+ libsoup_dep,
+ libxml_dep,
+ librest_dep,
+]
+
+librest_extras_c_args = [
+ '-DG_LOG_DOMAIN="Rest"',
+]
+
+librest_extras_lib = shared_library(librest_extras_pkg_string,
+ librest_extras_sources,
+ dependencies: librest_extras_deps,
+ c_args: librest_extras_c_args,
+ include_directories: config_h_inc,
+ version: librest_api_version,
+ install: true,
+)
+
+install_headers(librest_extras_headers,
+ subdir: librest_pkg_string / 'rest-extras',
+)
+
+librest_extras_gir = gnome.generate_gir(librest_extras_lib,
+ sources: librest_extras_headers,
+ namespace: 'RestExtras',
+ nsversion: librest_api_version,
+ includes: [ 'GObject-2.0', 'Gio-2.0', 'Soup-2.4' ],
+ extra_args: [ '--accept-unprefixed' ],
+ install: true,
+)
+
+librest_extras_vapi = gnome.generate_vapi('RestExtras-@0@'.format(librest_api_version),
+ sources: librest_extras_gir.get(0),
+ packages: [ 'gobject-2.0', 'gio-2.0', 'libsoup-2.4', 'libxml-2.0' ],
+ install: true,
+)
+
+librest_extras_dep = declare_dependency(
+ link_with: librest_extras_lib,
+)
+
+# Test suite
+test_runner_c_args = [
+ '-DBUILD_TESTS',
+]
+
+test_runner_bin = executable('test-runner',
+ [ 'test-runner.c', librest_extras_sources ],
+ dependencies: librest_extras_deps,
+ c_args: test_runner_c_args,
+ include_directories: config_h_inc,
+)
+
+test('test-runner', test_runner_bin,
+ suite: 'rest-extras',
+)
diff --git a/rest/meson.build b/rest/meson.build
new file mode 100644
index 0000000..6059e40
--- /dev/null
+++ b/rest/meson.build
@@ -0,0 +1,100 @@
+librest_enums = gnome.mkenums_simple('rest-enum-types',
+ sources: [ 'rest-proxy.h', 'rest-proxy-call.h' ],
+ install_header: true,
+ install_dir: get_option('includedir') / librest_pkg_string / 'rest',
+)
+
+librest_marshal = gnome.genmarshal('rest-marshal',
+ sources: 'rest-marshal.txt',
+)
+
+librest_sources = [
+ 'rest-param.c',
+ 'rest-params.c',
+ 'rest-proxy.c',
+ 'rest-proxy-auth.c',
+ 'rest-proxy-call.c',
+ 'rest-xml-node.c',
+ 'rest-xml-parser.c',
+ 'rest-main.c',
+ 'oauth-proxy.c',
+ 'oauth-proxy-call.c',
+ 'oauth2-proxy.c',
+ 'oauth2-proxy-call.c',
+ 'sha1.c',
+
+ librest_enums,
+ librest_marshal,
+]
+
+librest_headers = [
+ 'rest-param.h',
+ 'rest-params.h',
+ 'rest-proxy.h',
+ 'rest-proxy-auth.h',
+ 'rest-proxy-call.h',
+ 'oauth-proxy.h',
+ 'oauth-proxy-call.h',
+ 'oauth2-proxy.h',
+ 'oauth2-proxy-call.h',
+ 'rest-xml-node.h',
+ 'rest-xml-parser.h',
+]
+
+librest_deps = [
+ glib_dep,
+ libsoup_dep,
+ libxml_dep,
+]
+
+librest_c_args = [
+ '-DG_LOG_DOMAIN="Rest"',
+]
+
+librest_lib = shared_library('rest-@0@'.format(librest_api_version),
+ librest_sources,
+ dependencies: librest_deps,
+ c_args: librest_c_args,
+ include_directories: config_h_inc,
+ version: librest_api_version,
+ install: true,
+)
+
+install_headers(librest_headers,
+ subdir: librest_pkg_string / 'rest',
+)
+
+librest_gir = gnome.generate_gir(librest_lib,
+ sources: [ librest_headers, librest_enums[1] ],
+ namespace: 'Rest',
+ nsversion: librest_api_version,
+ includes: [ 'GObject-2.0', 'Gio-2.0', 'Soup-2.4' ],
+ extra_args: [ '--accept-unprefixed' ],
+ install: true,
+)
+
+librest_vapi = gnome.generate_vapi(librest_pkg_string,
+ sources: librest_gir.get(0),
+ packages: [ 'gobject-2.0', 'gio-2.0', 'libsoup-2.4', 'libxml-2.0' ],
+ install: true,
+)
+
+librest_dep = declare_dependency(
+ link_with: librest_lib,
+)
+
+# Test suite
+test_runner_c_args = [
+ '-DBUILD_TESTS',
+]
+
+test_runner_bin = executable('test-runner',
+ [ 'test-runner.c', librest_sources ],
+ dependencies: librest_deps,
+ c_args: test_runner_c_args,
+ include_directories: config_h_inc,
+)
+
+test('test-runner', test_runner_bin,
+ suite: 'rest',
+)
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..0025fd9
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,37 @@
+test_suites = {
+ 'rest': [
+ 'proxy',
+ 'proxy-continuous',
+ 'threaded',
+ 'oauth',
+ 'oauth-async',
+ 'oauth2',
+ 'xml',
+ 'custom-serialize',
+ ],
+ 'rest-extras': [
+ 'flickr',
+ 'lastfm',
+ ],
+}
+
+test_deps = [
+ glib_dep,
+ libsoup_dep,
+ librest_dep,
+ librest_extras_dep,
+]
+
+foreach suite, test_names : test_suites
+ foreach name : test_names
+ test_bin = executable(name,
+ '@0@.c'.format(name),
+ dependencies: test_deps,
+ include_directories: config_h_inc,
+ )
+
+ test(name, test_bin,
+ suite: suite,
+ )
+ endforeach
+endforeach
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]