[libnotify/wip/3v1n0/meson: 1/2] meson: build with the new cool stuff



commit 30ce7e605e38b8fd5c8b5a0a9878b9ead62ab45d
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Thu Nov 8 01:07:31 2018 +0100

    meson: build with the new cool stuff

 config.h.meson             |  4 +++
 docs/meson.build           | 27 +++++++++++++++
 docs/reference/meson.build | 10 ++++++
 libnotify/libnotify.map    |  6 ++++
 libnotify/meson.build      | 84 ++++++++++++++++++++++++++++++++++++++++++++++
 meson.build                | 56 +++++++++++++++++++++++++++++++
 meson_options.txt          | 16 +++++++++
 tests/meson.build          | 28 ++++++++++++++++
 tools/meson.build          |  7 ++++
 9 files changed, 238 insertions(+)
---
diff --git a/config.h.meson b/config.h.meson
new file mode 100644
index 0000000..39fd827
--- /dev/null
+++ b/config.h.meson
@@ -0,0 +1,4 @@
+/* config.h.meson */
+
+/* Version number of package */
+#mesondefine VERSION
diff --git a/docs/meson.build b/docs/meson.build
new file mode 100644
index 0000000..6429576
--- /dev/null
+++ b/docs/meson.build
@@ -0,0 +1,27 @@
+docbook_docs = get_option('docbook_docs')
+if not docbook_docs.disabled()
+  xmlto = find_program('xmlto', required: docbook_docs.enabled())
+
+  if xmlto.found()
+    spec_files = ['notification-spec']
+
+    foreach spec: spec_files
+      custom_target(spec + '.html',
+        output: spec + '.html',
+        input: spec + '.xml',
+        depend_files: 'config.xsl',
+        command: [xmlto,
+          'xhtml-nochunks',
+          '-m', join_paths(meson.current_source_dir(), 'config.xsl'),
+          '-o', '@OUTDIR@',
+          '@INPUT@'
+        ],
+        install: true,
+        install_dir: join_paths(docdir, 'spec'))
+    endforeach
+  endif
+endif
+
+if get_option('gtk_doc')
+  subdir('reference')
+endif
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
new file mode 100644
index 0000000..582739a
--- /dev/null
+++ b/docs/reference/meson.build
@@ -0,0 +1,10 @@
+gnome.gtkdoc(meson.project_name(),
+  mode: 'sgml',
+  main_sgml: meson.project_name() + '-docs.sgml',
+  src_dir: join_paths(meson.source_root(), meson.project_name()),
+  dependencies: libnotify_dep,
+  gobject_typesfile: meson.project_name() + '.types',
+  ignore_headers: ['notify-enum-types.h', 'notify-marshal.h', 'internal.h'],
+  scan_args: [ '--deprecated-guards=LIBNOTIFY_DISABLE_DEPRECATED' ],
+  install: true,
+)
diff --git a/libnotify/libnotify.map b/libnotify/libnotify.map
new file mode 100644
index 0000000..5660d4c
--- /dev/null
+++ b/libnotify/libnotify.map
@@ -0,0 +1,6 @@
+{
+global:
+    notify_*;
+local:
+    *;
+};
diff --git a/libnotify/meson.build b/libnotify/meson.build
new file mode 100644
index 0000000..15624da
--- /dev/null
+++ b/libnotify/meson.build
@@ -0,0 +1,84 @@
+libnotify_includedir = join_paths(includedir, meson.project_name())
+
+headers = [
+  'notify.h',
+  'notification.h',
+]
+
+sources = [
+  'notify.c',
+  'notification.c',
+]
+
+features_data = configuration_data()
+features_data.set('LIBNOTIFY_MAJOR_VERSION', VERSION_ARRAY[0])
+features_data.set('LIBNOTIFY_MINOR_VERSION', VERSION_ARRAY[1])
+features_data.set('LIBNOTIFY_MICRO_VERSION', VERSION_ARRAY[2])
+
+headers += configure_file(
+  input: 'notify-features.h.in',
+  output: 'notify-features.h',
+  configuration: features_data)
+
+enum_types = gnome.mkenums_simple('@0@-enum-types'.format(LIBNAME),
+  sources : headers,
+  install_header: true,
+  install_dir: libnotify_includedir
+)
+
+marshal = gnome.genmarshal('@0@-marshal'.format(LIBNAME),
+  prefix: '@0@_marshal'.format(LIBNAME),
+  sources: '@0 -marshal list'.format(LIBNAME),
+)
+
+libnotify_cflags = [
+  '-DG_LOG_DOMAIN="libnotify"',
+]
+
+mapfile = meson.project_name() + '.map'
+libnotify_ldflags = [
+  '-Wl,--version-script,'+join_paths(meson.current_source_dir(), mapfile),
+]
+
+notify_dep = declare_dependency(
+  include_directories: default_includes,
+  dependencies: libnotify_deps,
+  compile_args: libnotify_cflags,
+  sources: headers + [enum_types[1]] + [marshal[1]],
+  link_args: libnotify_ldflags,
+)
+
+libnotify_lib = shared_library(LIBNAME,
+  dependencies: notify_dep,
+  sources: sources + enum_types + marshal,
+  version: '@0@.@1@.@2@'.format(LT_CURRENT, LT_REVISION, LT_AGE),
+  soversion: LT_CURRENT,
+  install: true,
+)
+
+libnotify_dep = declare_dependency(
+  dependencies: notify_dep,
+  link_with: libnotify_lib
+)
+
+pkgconfig.generate(libnotify_lib,
+  name: meson.project_name(),
+  libraries: libnotify_deps,
+  description: 'Notifications Library',
+)
+
+introspection = get_option('introspection')
+if not introspection.disabled()
+  find_program('g-ir-scanner', required: introspection.enabled())
+  gnome.generate_gir(libnotify_lib,
+    sources: headers + sources + enum_types,
+    namespace: 'Notify',
+    nsversion: MODULE_VERSION,
+    export_packages: meson.project_name(),
+    includes: ['GLib-2.0', 'GdkPixbuf-2.0'],
+    extra_args: '--c-include=@0@/@1@.h'.format(meson.project_name(), LIBNAME),
+    install: true
+  )
+endif
+
+install_headers(headers, subdir: libnotify_includedir)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..abc83ce
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,56 @@
+project('libnotify',
+  'c',
+  version: '0.7.7',
+  meson_version: '>= 0.47.0')
+
+gnome = import('gnome')
+pkgconfig = import('pkgconfig')
+
+################################################################
+# libtool versioning
+################################################################
+#
+# +1 :  0 : +1   == new interface that does not break old one.
+# +1 :  0 :  0   == removed an interface. Breaks old apps.
+#  ? : +1 :  ?   == internal changes that doesn't break anything.
+#
+# CURRENT : REVISION : AGE
+#
+LT_CURRENT=4
+LT_REVISION=0
+LT_AGE=0
+
+VERSION_ARRAY = meson.project_version().split('.')
+MODULE_VERSION = '@0@.@1@'.format(VERSION_ARRAY[0], VERSION_ARRAY[1])
+LIBNAME = meson.project_name().split('lib')[1]
+
+default_includes = include_directories('.')
+
+prefix = get_option('prefix')
+includedir = join_paths(prefix, get_option('includedir'))
+docdir = join_paths(prefix, get_option('datadir'), 'doc', meson.project_name())
+
+libnotify_deps = []
+extra_deps = []
+
+gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0')
+glib_dep = dependency('glib-2.0', version: '>= 2.26.0')
+gio_dep = dependency('gio-2.0', version: glib_dep.version())
+gtk_dep = dependency('gtk+-3.0', version: '>= 2.90', required: get_option('tests'))
+
+libnotify_deps = [gdk_pixbuf_dep, gio_dep, glib_dep]
+tests_deps = [gtk_dep]
+
+conf = configuration_data()
+conf.set_quoted('VERSION', meson.project_version())
+configure_file(input: 'config.h.meson',
+  output : 'config.h',
+  configuration : conf)
+
+subdir('libnotify')
+subdir('tools')
+subdir('docs')
+
+if get_option('tests')
+  subdir('tests')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..c37f643
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,16 @@
+option('tests',
+  type: 'boolean',
+  value: true,
+  description: 'Build tests')
+option('introspection',
+  type: 'feature',
+  value: 'enabled',
+  description: 'Enable GObject introspection')
+option('gtk_doc',
+  type: 'boolean',
+  value: true,
+  description: 'Enable generating the API reference (depends on GTK-Doc)')
+option('docbook_docs',
+  type: 'feature',
+  value: 'auto',
+  description: 'Build DocBook documentation (requires xmlto)')
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..3efc1a3
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,28 @@
+test_progs = [
+  'replace',
+  'replace-widget',
+  'server-info',
+  'default-action',
+  'multi-actions',
+  'action-icons',
+  'image',
+  'basic',
+  'error',
+  'markup',
+  'persistence',
+  'removal',
+  'resident',
+  'rtl',
+  'size-changes',
+  'transient',
+  'urgency',
+  'xy',
+  'xy-actions',
+  'xy-stress',
+]
+
+foreach tprog: test_progs
+  executable('test-' + tprog, ['test-' + tprog + '.c'],
+    dependencies: [libnotify_dep, tests_deps],
+  )
+endforeach
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 0000000..aa01ce2
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,7 @@
+progs = ['notify-send']
+
+foreach prog: progs
+  executable(prog, [prog + '.c'],
+    dependencies: libnotify_dep,
+    install: true)
+endforeach


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]