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



commit 5328277ab5bc88f244ef080487615b9020d4ee46
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Wed Nov 7 19:07:31 2018 -0500

    meson: build with the new cool stuff

 config.h.meson             |  58 ++++++++++++++++++++++++
 docs/meson.build           |  25 +++++++++++
 docs/reference/meson.build |  13 ++++++
 libnotify/libnotify.map    |   6 +++
 libnotify/meson.build      |  77 ++++++++++++++++++++++++++++++++
 meson.build                | 108 +++++++++++++++++++++++++++++++++++++++++++++
 meson_options.txt          |  16 +++++++
 tests/meson.build          |  30 +++++++++++++
 tools/meson.build          |   9 ++++
 9 files changed, 342 insertions(+)
---
diff --git a/config.h.meson b/config.h.meson
new file mode 100644
index 0000000..feee621
--- /dev/null
+++ b/config.h.meson
@@ -0,0 +1,58 @@
+/* config.h.meson */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#mesondefine HAVE_DLFCN_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#mesondefine HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#mesondefine HAVE_MEMORY_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#mesondefine HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#mesondefine HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#mesondefine HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#mesondefine HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#mesondefine HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#mesondefine HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#mesondefine HAVE_UNISTD_H
+
+/* libnotify major version. */
+#mesondefine LIBNOTIFY_MAJOR_VERSION
+
+/* libnotify micro version. */
+#mesondefine LIBNOTIFY_MICRO_VERSION
+
+/* libnotify minor version. */
+#mesondefine LIBNOTIFY_MINOR_VERSION
+
+/* libnotify version. */
+#mesondefine LIBNOTIFY_VERSION
+
+/* Name of package */
+#mesondefine PACKAGE
+
+/* Define to the full name of this package. */
+#mesondefine PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#mesondefine PACKAGE_STRING
+
+/* Define to the version of this package. */
+#mesondefine PACKAGE_VERSION
+
+/* Version number of package */
+#mesondefine VERSION
diff --git a/docs/meson.build b/docs/meson.build
new file mode 100644
index 0000000..b4efd1d
--- /dev/null
+++ b/docs/meson.build
@@ -0,0 +1,25 @@
+if not get_option('docbook_docs').disabled()
+  xmlto = find_program('xmlto', required: get_option('docbook_docs').enabled())
+
+  if xmlto.found()
+    spec_files = ['notification-spec']
+
+    foreach spec: spec_files
+      custom_target('targetname',
+        output: spec + '.html',
+        input: spec + '.xml',
+        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..bbe88d6
--- /dev/null
+++ b/docs/reference/meson.build
@@ -0,0 +1,13 @@
+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: declare_dependency(
+    dependencies: libnotify_dep,
+    link_with: libnotify_lib
+  ),
+  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..8bbcdeb
--- /dev/null
+++ b/libnotify/meson.build
@@ -0,0 +1,77 @@
+gnome = import('gnome')
+
+libnotify_includedir = join_paths(includedir, meson.project_name())
+
+headers = [
+  'notify.h',
+  'notification.h',
+]
+
+sources = [
+  'notify.c',
+  'notification.c',
+]
+
+generated_files = []
+
+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),
+]
+
+libnotify_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: libnotify_dep,
+  sources: sources + enum_types + marshal,
+  version: '@0@.@1@.@2@'.format(LT_CURRENT, LT_REVISION, LT_AGE),
+  soversion: LT_CURRENT,
+  install: true,
+)
+
+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..fea75eb
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,108 @@
+project('libnotify',
+  'c',
+  version: '0.7.7',
+  meson_version: '>= 0.48.1')
+
+################################################################
+# 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]
+
+prefix = get_option('prefix')
+bindir = join_paths(prefix, get_option('bindir'))
+libdir = join_paths(prefix, get_option('libdir'))
+includedir = join_paths(prefix, get_option('includedir'))
+docdir = join_paths(prefix, get_option('datadir'), 'doc', meson.project_name())
+
+default_includes = include_directories('.')
+conf = configuration_data()
+cc = meson.get_compiler('c')
+
+check_headers = [
+  'dlfcn.h',
+  'inttypes.h',
+  'memory.h',
+  'stdint.h',
+  'stdlib.h',
+  'strings.h',
+  'string.h',
+  'sys/stat.h',
+  'sys/types.h',
+  'unistd.h',
+]
+
+foreach h : check_headers
+  conf.set('HAVE_' + h.underscorify().to_upper(), cc.has_header(h))
+endforeach
+
+LIBNOTIFY_DEPS = []
+
+pkg_deps = [
+  {'name': 'gdk-pixbuf-2.0' },
+  {'name': 'gio-2.0', 'version': '>= 2.26.0' },
+  {'name': 'glib-2.0', 'version': '>= 2.26.0' },
+]
+
+extra_deps = [
+  {'name': 'gtk+-3.0', 'version': '>= 2.90', 'required': get_option('tests') },
+]
+
+foreach p: pkg_deps + extra_deps
+  pkg = p.get('name')
+  required = p.get('required', true)
+  dep = dependency(pkg, version: p.get('version', []), required: required)
+  LIBNOTIFY_DEPS += dep
+endforeach
+
+conf.set('LIBNOTIFY_MAJOR_VERSION', VERSION_ARRAY[0])
+conf.set('LIBNOTIFY_MINOR_VERSION', VERSION_ARRAY[1])
+conf.set('LIBNOTIFY_MICRO_VERSION', VERSION_ARRAY[2])
+conf.set_quoted('LIBNOTIFY_VERSION', meson.project_version())
+conf.set_quoted('PACKAGE', meson.project_name())
+conf.set_quoted('PACKAGE_NAME', meson.project_name())
+conf.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
+conf.set_quoted('PACKAGE_VERSION', meson.project_version())
+conf.set_quoted('VERSION', meson.project_version())
+
+configure_file(input: 'config.h.meson',
+  output : 'config.h',
+  configuration : conf)
+
+pkg_modules = ''
+foreach p: pkg_deps
+  pkg_modules += p.get('name') + ' ' + p.get('version', '') + ' '
+endforeach
+
+pc_conf = configuration_data()
+pc_conf.set('prefix', get_option('prefix'))
+pc_conf.set('exec_prefix', '${prefix}')
+pc_conf.set('libdir', '${exec_prefix}/' + get_option('libdir'))
+pc_conf.set('includedir', '${prefix}/' + get_option('includedir'))
+pc_conf.set('pkg_modules', pkg_modules)
+pc_conf.set('VERSION', meson.project_version())
+
+configure_file(input: meson.project_name() + '.pc.in',
+  output: meson.project_name() + '.pc',
+  configuration: pc_conf,
+  install_dir: join_paths(libdir, 'pkgconfig'))
+
+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..48227ff
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,16 @@
+option('tests',
+  type: 'boolean',
+  value: true,
+  description: 'Do not 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..1cc6434
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,30 @@
+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 test: test_progs
+  executable('test-' + test, ['test-' + test + '.c'],
+    dependencies: libnotify_dep,
+    link_with: libnotify_lib,
+    install: false,
+  )
+endforeach
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 0000000..8d85e76
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,9 @@
+progs = ['notify-send']
+
+foreach prog: progs
+  executable(prog, [prog + '.c'],
+    dependencies: libnotify_dep,
+    link_with: libnotify_lib,
+    install: true,
+    install_dir: bindir)
+endforeach


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