[devhelp/wip/inigomartinez/devhelp-next-meson] build: Port to meson build system



commit 55a95304672036b7dc87d539daab2ef7c1ce61d0
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Thu Jun 15 13:06:37 2017 +0200

    build: Port to meson build system
    
    meson is a build system focused on speed an ease of use, which
    helps speeding up the software development. This patch adds meson
    support along autotools.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783819

 Makefile.am                              |    7 +-
 data/Makefile.am                         |   14 ++-
 data/icons/Makefile.am                   |    3 +-
 data/icons/meson.build                   |   20 +++
 data/meson.build                         |   66 +++++++++++
 data/org.gnome.Devhelp.service.in        |    3 +
 devhelp/Makefile.am                      |    2 +
 devhelp/meson.build                      |  145 +++++++++++++++++++++++
 devhelp/symbol.map                       |    6 +
 docs/reference/Makefile.am               |    6 +-
 docs/reference/meson.build               |   20 +++
 docs/reference/xml/gtkdocentities.ent.in |    7 +
 docs/reference/xml/meson.build           |   16 +++
 help/LINGUAS                             |    5 +
 help/Makefile.am                         |    5 +
 help/meson.build                         |   10 ++
 meson.build                              |  189 ++++++++++++++++++++++++++++++
 meson_options.txt                        |    4 +
 meson_post_install.py                    |   19 +++
 plugins/gedit-plugin/Makefile.am         |    4 +-
 plugins/gedit-plugin/meson.build         |   17 +++
 po/meson.build                           |    5 +
 src/Makefile.am                          |    1 +
 src/meson.build                          |   42 +++++++
 unit-tests/Makefile.am                   |    2 +
 unit-tests/meson.build                   |   17 +++
 26 files changed, 625 insertions(+), 10 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 112da9f..1777ed4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,7 +5,12 @@ AM_DISTCHECK_CONFIGURE_FLAGS = \
        --enable-introspection  \
        --enable-appstream-util
 
-EXTRA_DIST = devhelp.doap
+EXTRA_DIST = \
+       devhelp.doap \
+       meson.build \
+       meson_options.txt \
+       meson_post_install.py \
+       po/meson.build
 
 MAINTAINERCLEANFILES = \
        $(GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL) \
diff --git a/data/Makefile.am b/data/Makefile.am
index 3049cb5..3f8db91 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -36,12 +36,14 @@ org.gnome.Devhelp.service: Makefile
 
 man_MANS = devhelp.1
 
-EXTRA_DIST =                   \
-       libdevhelp-3.0.pc.in    \
-       $(desktop_in_files)     \
-       $(gsettings_SCHEMAS)    \
-       $(assistant_DATA) \
-       $(man_MANS) \
+EXTRA_DIST =                           \
+       libdevhelp-3.0.pc.in            \
+       org.gnome.Devhelp.service.in    \
+       meson.build                     \
+       $(desktop_in_files)             \
+       $(gsettings_SCHEMAS)            \
+       $(assistant_DATA)               \
+       $(man_MANS)                     \
        $(appstream_in_files)
 
 CLEANFILES =                   \
diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am
index 722b21e..b955379 100644
--- a/data/icons/Makefile.am
+++ b/data/icons/Makefile.am
@@ -40,6 +40,7 @@ EXTRA_DIST = \
        $(icon48_DATA)          \
        $(icon256_DATA)         \
        $(iconscalable_DATA)    \
-       devhelp.svg
+       devhelp.svg             \
+       meson.build
 
 -include $(top_srcdir)/git.mk
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..db01383
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,20 @@
+icons = [
+  '16x16',
+  '22x22',
+  '24x24',
+  '32x32',
+  '48x48',
+  '256x256'
+]
+
+foreach icon: icons
+  install_data(
+    join_paths(icon, 'devhelp.png'),
+    install_dir: join_paths(dh_datadir, 'icons', 'hicolor', icon, 'apps')
+  )
+endforeach
+
+install_data(
+  'symbolic/devhelp-symbolic.svg',
+  install_dir: join_paths(dh_datadir, 'icons', 'hicolor', 'symbolic', 'apps')
+)
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..1d6d0d4
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,66 @@
+subdir('icons')
+
+appdata = 'org.gnome.@0  appdata xml'.format(meson.project_name())
+
+i18n.merge_file(
+  appdata,
+  input: appdata + '.in',
+  output: appdata,
+  po_dir: po_dir,
+  install: true,
+  install_dir: join_paths(dh_datadir, 'metainfo')
+)
+
+desktop = 'org.gnome.@0@.desktop'.format(meson.project_name())
+
+desktop_conf = configuration_data()
+desktop_conf.set('VERSION', dh_version)
+
+desktop_in = configure_file(
+  input: desktop + '.in.in',
+  output: desktop + '.in',
+  configuration: desktop_conf
+)
+
+i18n.merge_file(
+  desktop,
+  type: 'desktop',
+  input: desktop_in,
+  output: desktop,
+  po_dir: po_dir,
+  install: true,
+  install_dir: join_paths(dh_datadir, 'applications')
+)
+
+service_conf = configuration_data()
+service_conf.set('bindir', dh_bindir)
+
+service = 'org.gnome.@0@.service'.format(meson.project_name())
+
+configure_file(
+  input: service + '.in',
+  output: service,
+  configuration: service_conf,
+  install: true,
+  install_dir: dbus_session_dir
+)
+
+assistant_data = files(
+  'assistant.js',
+  'assistant.css'
+)
+
+install_data(
+  assistant_data,
+  install_dir: join_paths(dh_pkgdatadir, 'assistant')
+)
+
+install_data(
+  'org.gnome.@0  gschema xml'.format(dh_name),
+  install_dir: join_paths(dh_datadir, 'glib-2.0', 'schemas')
+)
+
+install_data(
+  dh_name + '.1',
+  install_dir: join_paths(dh_mandir, 'man1')
+)
diff --git a/data/org.gnome.Devhelp.service.in b/data/org.gnome.Devhelp.service.in
new file mode 100644
index 0000000..91b4316
--- /dev/null
+++ b/data/org.gnome.Devhelp.service.in
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.gnome.Devhelp
+Exec=@bindir@//devhelp --gapplication-service
diff --git a/devhelp/Makefile.am b/devhelp/Makefile.am
index 2b8fe0f..9b2db78 100644
--- a/devhelp/Makefile.am
+++ b/devhelp/Makefile.am
@@ -118,6 +118,8 @@ dh-enum-types.c: dh-enum-types.c.template $(libdevhelp_public_headers) $(GLIB_MK
 EXTRA_DIST =                           \
        dh-enum-types.c.template        \
        dh-enum-types.h.template        \
+       meson.build                     \
+       symbol.map                      \
        $(NULL)
 
 CLEANFILES = $(BUILT_SOURCES)
diff --git a/devhelp/meson.build b/devhelp/meson.build
new file mode 100644
index 0000000..28801be
--- /dev/null
+++ b/devhelp/meson.build
@@ -0,0 +1,145 @@
+devhelp_inc = include_directories('.')
+
+private_headers = [
+  'dh-error.h',
+  'dh-parser.h',
+  'dh-search-context.h',
+  'dh-settings.h',
+  'dh-util-lib.h'
+]
+
+headers = [
+  'devhelp.h',
+  'dh-assistant-view.h',
+  'dh-book.h',
+  'dh-book-manager.h',
+  'dh-book-tree.h',
+  'dh-completion.h',
+  'dh-init.h',
+  'dh-keyword-model.h',
+  'dh-link.h',
+  'dh-sidebar.h'
+]
+
+install_headers(
+  headers,
+  subdir: join_paths(dh_api_name, dh_name)
+)
+
+private_sources = [
+  'dh-error.c',
+  'dh-parser.c',
+  'dh-search-context.c',
+  'dh-settings.c',
+  'dh-util-lib.c'
+]
+
+sources = [
+  'dh-assistant-view.c',
+  'dh-book.c',
+  'dh-book-manager.c',
+  'dh-book-tree.c',
+  'dh-completion.c',
+  'dh-init.c',
+  'dh-keyword-model.c',
+  'dh-link.c',
+  'dh-sidebar.c'
+]
+
+enum = 'dh-enum-types'
+
+sources += gnome.mkenums(
+  enum,
+  sources: headers,
+  c_template: enum + '.c.template',
+  h_template: enum + '.h.template',
+  install_header: true,
+  install_dir: join_paths(dh_pkgincludedir, dh_name)
+)
+
+deps = [
+  gio_dep,
+  gtk_dep,
+  webkit_gtk_dep
+]
+
+cflags = [
+  '-DDATADIR="@0@"'.format(dh_datadir),
+  '-DLOCALEDIR="@0@"'.format(dh_localedir)
+]
+
+libdevhelp_core = static_library(
+  'devhelp-core',
+  sources: sources + private_sources,
+  include_directories: top_inc,
+  dependencies: deps + [gsettings_desktop_dep],
+  c_args: cflags
+)
+
+libdevhelp_core_dep = declare_dependency(
+  include_directories: devhelp_inc,
+  dependencies: deps,
+  link_with: libdevhelp_core
+)
+
+symbol_map = join_paths(meson.current_source_dir(), 'symbol.map')
+
+ldflags = []
+if have_version_script
+  ldflags += '-Wl,--version-script,@0@'.format(symbol_map)
+endif
+
+libdevhelp = shared_library(
+  libdh_name,
+  version: libdh_version,
+  include_directories: top_inc,
+  link_args: ldflags,
+  link_whole: libdevhelp_core,
+  link_depends: symbol_map,
+  install: true
+)
+
+libdevhelp_dep = declare_dependency(
+  include_directories: devhelp_inc,
+  dependencies: deps,
+  link_with: libdevhelp
+)
+
+pkg.generate(
+  libraries: libdevhelp,
+  version: dh_version,
+  name: dh_name,
+  description: dh_name,
+  filebase: 'lib' + dh_api_name,
+  subdirs: dh_api_name,
+  requires: [
+    'gio-2.0 ' + gio_req_version,
+    'gtk+-3.0 ' + gtk_req_version,
+    '@0@ @1@'.format(webkit_gtk_name, webkit_gtk_req_version)
+  ],
+  requires_private: 'gsettings-desktop-schemas',
+  variables: 'exec_prefix=' + dh_prefix
+)
+
+if enable_introspection
+  incs = [
+    'Gtk-3.0',
+    'WebKit2-4.0'
+  ]
+
+  gnome.generate_gir(
+    libdevhelp,
+    sources: sources + headers,
+    includes: incs,
+    #include_directories: top_inc,
+    namespace: meson.project_name(),
+    nsversion: dh_api_version,
+    symbol_prefix: dh_namespace.to_lower(),
+    identifier_prefix: dh_namespace,
+    header: 'devhelp/devhelp.h',
+    export_packages: 'lib' + dh_api_name,
+    # FIXME: unnecessary?
+    extra_args: '--identifier-prefix=' + dh_namespace.to_lower(),
+    install: true
+  )
+endif
diff --git a/devhelp/symbol.map b/devhelp/symbol.map
new file mode 100644
index 0000000..0ac448d
--- /dev/null
+++ b/devhelp/symbol.map
@@ -0,0 +1,6 @@
+{
+global:
+  dh_*;
+local:
+  *;
+};
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index 9a7db47..3c73bb4 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -1,4 +1,3 @@
-
 # The name of the module, e.g. 'glib'.
 DOC_MODULE = devhelp
 
@@ -96,4 +95,9 @@ include $(top_srcdir)/gtk-doc.make
 #TESTS = $(GTKDOC_CHECK)
 #endif
 
+EXTRA_DIST =                           \
+       meson.build                     \
+       xml/meson.build                 \
+       xml/gtkdocentities.ent.in
+
 -include $(top_srcdir)/git.mk
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
new file mode 100644
index 0000000..8aca7a8
--- /dev/null
+++ b/docs/reference/meson.build
@@ -0,0 +1,20 @@
+subdir('xml')
+
+doc_module = dh_name
+
+doc_path = join_paths(dh_prefix, gnome.gtkdoc_html_dir(libdh_name))
+
+gnome.gtkdoc(
+  doc_module,
+  main_xml: doc_module + '-docs.xml',
+  src_dir: devhelp_inc,
+  dependencies: libdevhelp_dep,
+  scan_args: [
+    '--rebuild-types',
+    '--ignore-headers=' + ' '.join(private_headers)
+  ],
+  gobject_typesfile: doc_module + '.types',
+  fixxref_args: '--html-dir=' + doc_path,
+  install: true,
+  install_dir: doc_path
+)
diff --git a/docs/reference/xml/gtkdocentities.ent.in b/docs/reference/xml/gtkdocentities.ent.in
new file mode 100644
index 0000000..fd86c16
--- /dev/null
+++ b/docs/reference/xml/gtkdocentities.ent.in
@@ -0,0 +1,7 @@
+<!ENTITY package "@PACKAGE@">
+<!ENTITY package_bugreport "@PACKAGE_BUGREPORT@">
+<!ENTITY package_name "@PACKAGE_NAME@">
+<!ENTITY package_string "@PACKAGE_STRING@">
+<!ENTITY package_tarname "@PACKAGE_TARNAME@">
+<!ENTITY package_url "@PACKAGE_URL@">
+<!ENTITY package_version "@PACKAGE_VERSION@">
diff --git a/docs/reference/xml/meson.build b/docs/reference/xml/meson.build
new file mode 100644
index 0000000..ca605c9
--- /dev/null
+++ b/docs/reference/xml/meson.build
@@ -0,0 +1,16 @@
+ent_conf = configuration_data()
+ent_conf.set('PACKAGE', dh_name)
+ent_conf.set('PACKAGE_BUGREPORT', 'https://bugzilla.gnome.org/browse.cgi?product=' + dh_name)
+ent_conf.set('PACKAGE_NAME', meson.project_name())
+ent_conf.set('PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), dh_version))
+ent_conf.set('PACKAGE_TARNAME', package_tarname)
+ent_conf.set('PACKAGE_URL', package_url)
+ent_conf.set('PACKAGE_VERSION', package_version)
+
+ent = 'gtkdocentities.ent'
+
+configure_file(
+  input: ent + '.in',
+  output: ent,
+  configuration: ent_conf
+)
diff --git a/help/LINGUAS b/help/LINGUAS
new file mode 100644
index 0000000..44112c2
--- /dev/null
+++ b/help/LINGUAS
@@ -0,0 +1,5 @@
+de
+es
+hu
+pl
+pt_BR
diff --git a/help/Makefile.am b/help/Makefile.am
index 02e16a9..de18540 100644
--- a/help/Makefile.am
+++ b/help/Makefile.am
@@ -9,4 +9,9 @@ HELP_FILES =            \
 
 HELP_LINGUAS = de es hu pl pt_BR
 
+EXTRA_DIST =           \
+       LINGUAS         \
+       meson.build     \
+       $(NULL)
+
 -include $(top_srcdir)/git.mk
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..cb0cd46
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,10 @@
+sources = [
+  'index.page',
+  'search.page'
+]
+
+gnome.yelp(
+  dh_name,
+  sources: sources,
+  symlink_media: true
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..ea0c6a9
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,189 @@
+project(
+  'Devhelp', 'c',
+  version: '3.27.91',
+  license: 'GPL2+',
+  default_options: 'buildtype=debugoptimized',
+  meson_version: '>= 0.43.0'
+)
+
+dh_name = meson.project_name().to_lower()
+
+dh_version = meson.project_version()
+version_array = dh_version.split('.')
+dh_major_version = version_array[0].to_int()
+
+dh_api_version = '@0@.0'.format(dh_major_version)
+dh_api_name = '@0@-@1@'.format(dh_name, dh_api_version)
+
+dh_namespace = 'Dh'
+
+dh_gir_version = '1.0'
+
+dh_prefix = get_option('prefix')
+dh_bindir = join_paths(dh_prefix, get_option('bindir'))
+dh_datadir = join_paths(dh_prefix, get_option('datadir'))
+dh_includedir = join_paths(dh_prefix, get_option('includedir'))
+dh_libdir = join_paths(dh_prefix, get_option('libdir'))
+dh_localedir = join_paths(dh_prefix, get_option('localedir'))
+dh_mandir = join_paths(dh_prefix, get_option('mandir'))
+
+dh_pkgdatadir = join_paths(dh_datadir, dh_name)
+dh_pkgincludedir = join_paths(dh_includedir, dh_api_name)
+
+# LT Version numbers, remember to change them just *before* a release.
+# A good time to update it is for the GNOME x.y.90 version, at API freeze,
+# so that packagers have the time to update the package.
+#   (Interfaces removed:    CURRENT++, AGE=0, REVISION=0)
+#   (Interfaces added:      CURRENT++, AGE++, REVISION=0)
+#   (No interfaces changed:                   REVISION++)
+libdh_current = 5
+libdh_revision = 0
+libdh_age = 0
+libdh_version = '@0@.@1@.@2@'.format(libdh_current, libdh_revision, libdh_age)
+
+libdh_name = '@0@-@1@'.format(dh_name, dh_major_version)
+
+# package
+package_tarname = dh_name
+package_url = 'https://wiki.gnome.org/Apps/Devhelp'
+package_version = dh_version
+
+cc = meson.get_compiler('c')
+
+config_h = configuration_data()
+
+# defines
+set_defines = [
+  # package
+  ['PACKAGE_TARNAME', package_tarname],
+  ['PACKAGE_URL', package_url],
+  ['PACKAGE_VERSION', package_version],
+  # i18n
+  ['GETTEXT_PACKAGE', dh_name]
+]
+
+foreach define: set_defines
+  config_h.set_quoted(define[0], define[1])
+endforeach
+
+# compiler flags
+common_flags = []
+
+if get_option('buildtype').contains('debug')
+  test_cflags = [
+    '-fno-strict-aliasing',
+    '-Wcast-align',
+    '-Wdeclaration-after-statement',
+    '-Werror=unknown-warning-option',
+    '-Wformat=2',
+    '-Winit-self',
+    '-Winline',
+    '-Wmissing-declarations',
+    '-Wmissing-format-attribute',
+    '-Wmissing-include-dirs',
+    '-Wmissing-noreturn',
+    '-Wmissing-prototypes',
+    '-Wnested-externs',
+    '-Wno-error=missing-field-initializers',
+    '-Wno-error=unused-parameter',
+    '-Wno-missing-field-initializers',
+    '-Wno-suggest-attribute=format',
+    '-Wno-unused-parameter',
+    '-Wold-style-definition',
+    '-Wpacked',
+    '-Wredundant-decls',
+    '-Wshadow',
+    '-Wstrict-prototypes',
+    '-Wswitch-enum',
+    '-Wundef',
+    '-Wwrite-strings'
+  ]
+
+  common_flags += cc.get_supported_arguments(test_cflags)
+endif
+
+add_project_arguments(common_flags, language: 'c')
+
+ldflag = '-Wl,--version-script'
+have_version_script = host_machine.system().contains('linux') and cc.has_argument(ldflag)
+
+gio_req_version = '>= 2.40'
+gtk_req_version = '>= 3.22'
+
+webkit_gtk_name = 'webkit2gtk-4.0'
+webkit_gtk_req_version = '>= 2.19.2'
+
+gio_dep = dependency('gio-2.0', version: gio_req_version)
+gsettings_desktop_dep = dependency('gsettings-desktop-schemas')
+gtk_dep = dependency('gtk+-3.0', version: gtk_req_version)
+webkit_gtk_dep = dependency(webkit_gtk_name, version: webkit_gtk_req_version)
+m_dep = cc.find_library('m')
+
+dbus_session_dir = get_option('dbus_session_dir')
+if dbus_session_dir == ''
+  dbus_dep = dependency('dbus-1', required: false)
+  assert(dbus_dep.found(), 'D-Bus required but not found, please provide a valid session bus services dir')
+  dbus_session_dir = dbus_dep.get_pkgconfig_variable('session_bus_services_dir')
+endif
+
+enable_introspection = get_option('introspection')
+if enable_introspection
+  dependency('gobject-introspection-1.0', version: '>= 1.30.0')
+endif
+
+# Flatpak
+enable_flatpak = get_option('flatpak')
+config_h.set('FLATPAK_BUILD', enable_flatpak)
+
+gnome = import('gnome')
+i18n = import('i18n')
+pkg = import('pkgconfig')
+
+po_dir = join_paths(meson.source_root(), 'po')
+
+# FIXME: Needed to also merge Description key in plugin files
+msgfmt_plugin_cmd = [
+  find_program('msgfmt'),
+  '--desktop',
+  '--keyword=Name',
+  '--keyword=Description',
+  '-d', po_dir,
+  '--template=@INPUT@',
+  '--output=@OUTPUT@'
+]
+
+top_inc = include_directories('.')
+
+subdir('data')
+subdir('plugins/gedit-plugin')
+subdir('po')
+subdir('help')
+subdir('devhelp')
+subdir('src')
+subdir('unit-tests')
+
+enable_gtk_doc = get_option('gtk_doc')
+if enable_gtk_doc
+  subdir('docs/reference')
+endif
+
+configure_file(
+  output: 'config.h',
+  configuration: config_h
+)
+
+meson.add_install_script(
+  'meson_post_install.py',
+  dh_datadir
+)
+
+# Print a summary of the configuration
+output = 'Configuration:\n\n'
+output += '        ' + meson.project_name() +  ' version ' + dh_version + '\n\n'
+output += '        Source code location:  ' + meson.source_root() + '\n'
+output += '        Prefix:                ' + dh_prefix + '\n'
+output += '        Compiler:              ' + cc.get_id() + '\n'
+output += '        API documentation:     ' + enable_gtk_doc.to_string() + '\n'
+output += '        GObject introspection: ' + enable_introspection.to_string() + '\n'
+output += '        Flatpak build mode:    ' + enable_flatpak.to_string()
+message(output)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..d56d492
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,4 @@
+option('dbus_session_dir', type: 'string', value: '', description: 'where D-Bus session service directory 
is')
+option('flatpak', type: 'boolean', value: false, description: 'Enable Flatpak build mode')
+option('gtk_doc', type: 'boolean', value: false, description: 'use gtk-doc to build documentation')
+option('introspection', type: 'boolean', value: true, description: 'Enable GObject Introspection (depends on 
GObject)')
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 0000000..3a0ce33
--- /dev/null
+++ b/meson_post_install.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+import sys
+
+if not os.environ.get('DESTDIR'):
+  icondir = os.path.join(sys.argv[1], 'icons', 'hicolor')
+  print('Update icon cache...')
+  subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
+
+  schemadir = os.path.join(sys.argv[1], 'glib-2.0', 'schemas')
+  print('Compiling gsettings schemas...')
+  subprocess.call(['glib-compile-schemas', schemadir])
+
+  install_prefix = os.environ['MESON_INSTALL_PREFIX']
+  print('Byte-compiling python modules...')
+  subprocess.call(['pycompile', install_prefix])
+  subprocess.call(['python', '-O', '-m', 'compileall', '-f', '-q', install_prefix])
diff --git a/plugins/gedit-plugin/Makefile.am b/plugins/gedit-plugin/Makefile.am
index ca97af3..1c2e115 100644
--- a/plugins/gedit-plugin/Makefile.am
+++ b/plugins/gedit-plugin/Makefile.am
@@ -9,6 +9,8 @@ plugin_PYTHON = devhelp.py
 plugin_DATA = $(PLUGIN_FILE)
 
 CLEANFILES = $(PLUGIN_FILE)
-EXTRA_DIST = $(DESKTOP_IN_FILES)
+EXTRA_DIST = \
+       meson.build \
+       $(DESKTOP_IN_FILES)
 
 -include $(top_srcdir)/git.mk
diff --git a/plugins/gedit-plugin/meson.build b/plugins/gedit-plugin/meson.build
new file mode 100644
index 0000000..1525ceb
--- /dev/null
+++ b/plugins/gedit-plugin/meson.build
@@ -0,0 +1,17 @@
+plugin_dir = join_paths(dh_libdir, 'gedit', 'plugins')
+
+install_data(
+  'devhelp.py',
+  install_dir: plugin_dir
+)
+
+plugin = 'devhelp.plugin'
+
+custom_target(
+  plugin,
+  input: plugin + '.desktop.in',
+  output: plugin,
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: plugin_dir
+)
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..bb5efef
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,5 @@
+i18n.gettext(
+  dh_name,
+  preset: 'glib',
+  args: '--keyword=Description'
+)
diff --git a/src/Makefile.am b/src/Makefile.am
index f031475..2ba7b93 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -78,6 +78,7 @@ dh-resources.c: dh.gresource.xml $(resource_files)
 
 EXTRA_DIST =                   \
        dh.gresource.xml        \
+       meson.build             \
        $(resource_files)       \
        $(NULL)
 
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..106633a
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,42 @@
+sources = files(
+  'dh-app.c',
+  'dh-assistant.c',
+  'dh-main.c',
+  'dh-preferences.c',
+  'dh-tab.c',
+  'dh-tab-label.c',
+  'dh-util-app.c',
+  'dh-web-view.c',
+  'dh-window.c',
+  'tepl-info-bar.c'
+)
+
+resource_files = files(
+  'dh-assistant.ui',
+  'dh-preferences.ui',
+  'dh-window.ui',
+  'help-overlay.ui',
+  'menus.ui'
+)
+
+sources += gnome.compile_resources(
+  'dh-resources',
+  'dh.gresource.xml',
+  c_name: dh_namespace.to_lower(),
+  dependencies: resource_files,
+  export: true
+)
+
+deps = [
+  libdevhelp_dep,
+  m_dep
+]
+
+executable(
+  dh_name,
+  sources,
+  include_directories: top_inc,
+  dependencies: deps,
+  c_args: '-DG_LOG_DOMAIN="@0@"'.format(meson.project_name()),
+  install: true
+)
diff --git a/unit-tests/Makefile.am b/unit-tests/Makefile.am
index 35d80b4..80c55ec 100644
--- a/unit-tests/Makefile.am
+++ b/unit-tests/Makefile.am
@@ -26,4 +26,6 @@ test_util_SOURCES = test-util.c
 noinst_PROGRAMS = $(UNIT_TEST_PROGS)
 TESTS = $(UNIT_TEST_PROGS)
 
+EXTRA_DIST = meson.build
+
 -include $(top_srcdir)/git.mk
diff --git a/unit-tests/meson.build b/unit-tests/meson.build
new file mode 100644
index 0000000..c189be5
--- /dev/null
+++ b/unit-tests/meson.build
@@ -0,0 +1,17 @@
+test_units = [
+  'test-completion',
+  'test-link',
+  'test-search-context',
+  'test-util'
+]
+
+foreach test_unit: test_units
+  exe = executable(
+    test_unit,
+    test_unit + '.c',
+    include_directories: top_inc,
+    dependencies: libdevhelp_core_dep
+  )
+
+  test(test_unit, exe)
+endforeach


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