[gedit-plugins/tchaik/4-meson-port: 3/3] build: Port to the meson build system



commit 063e12f079ffca842d402240281d2284d361fab1
Author: Martin Blanchard <tchaik gmx com>
Date:   Tue Feb 5 21:36:23 2019 +0000

    build: Port to the meson build system
    
    Introduce meson build scripts along autotools ones. Porting modules to
    the meson build system is a GNOME Goal, details here:
    
    https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
    
    https://gitlab.gnome.org/GNOME/gedit-plugins/issues/4

 build-aux/meson/post_install.py        |  24 +++++
 help/LINGUAS                           |  29 ++++++
 help/meson.build                       |  24 +++++
 meson.build                            | 157 +++++++++++++++++++++++++++++++++
 meson_options.txt                      |  19 ++++
 plugins/bookmarks/meson.build          |  68 ++++++++++++++
 plugins/bookmarks/messages/meson.build |   7 ++
 plugins/bracketcompletion/meson.build  |  52 +++++++++++
 plugins/charmap/meson.build            |  48 ++++++++++
 plugins/codecomment/meson.build        |  52 +++++++++++
 plugins/colorpicker/meson.build        |  52 +++++++++++
 plugins/colorschemer/meson.build       |  61 +++++++++++++
 plugins/commander/meson.build          |  57 ++++++++++++
 plugins/drawspaces/meson.build         |  84 ++++++++++++++++++
 plugins/findinfiles/meson.build        |  82 +++++++++++++++++
 plugins/git/meson.build                |  48 ++++++++++
 plugins/joinlines/meson.build          |  52 +++++++++++
 plugins/meson.build                    |  40 +++++++++
 plugins/multiedit/meson.build          |  48 ++++++++++
 plugins/smartspaces/meson.build        |  52 +++++++++++
 plugins/synctex/meson.build            |  48 ++++++++++
 plugins/terminal/meson.build           |  60 +++++++++++++
 plugins/textsize/meson.build           |  48 ++++++++++
 plugins/translate/meson.build          |  69 +++++++++++++++
 plugins/translate/tests/meson.build    |  22 +++++
 plugins/wordcompletion/meson.build     |  82 +++++++++++++++++
 plugins/zeitgeist/meson.build          |  59 +++++++++++++
 po/meson.build                         |   7 ++
 28 files changed, 1451 insertions(+)
---
diff --git a/build-aux/meson/post_install.py b/build-aux/meson/post_install.py
new file mode 100755
index 0000000..84e1de0
--- /dev/null
+++ b/build-aux/meson/post_install.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+import sys
+
+libdir = sys.argv[1]
+datadir = sys.argv[2]
+
+# Packaging tools define DESTDIR and this isn't needed for them
+if 'DESTDIR' not in os.environ:
+    print('Compiling gsettings schemas...')
+    subprocess.call(['glib-compile-schemas',
+                     os.path.join(datadir, 'glib-2.0', 'schemas')])
+
+    print('Compiling python modules...')
+    subprocess.call([sys.executable, '-m', 'compileall', '-f', '-q',
+                     os.path.join(libdir, 'gedit', 'plugins'),
+                     os.path.join(datadir, 'gedit', 'plugins')])
+
+    print('Compiling python modules (optimized versions) ...')
+    subprocess.call([sys.executable, '-O', '-m', 'compileall', '-f', '-q',
+                     os.path.join(libdir, 'gedit', 'plugins'),
+                     os.path.join(datadir, 'gedit', 'plugins')])
diff --git a/help/LINGUAS b/help/LINGUAS
new file mode 100644
index 0000000..144785c
--- /dev/null
+++ b/help/LINGUAS
@@ -0,0 +1,29 @@
+ar
+bg
+ca
+cs
+da
+de
+el
+es
+eu
+fi
+fr
+gl
+hu
+it
+ja
+ko
+lv
+oc
+pl
+pt_BR
+ru
+sl
+sv
+te
+th
+uk
+zh_CN
+zh_HK
+zh_TW
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..e7fe938
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,24 @@
+gedit_help_sources = [
+  'bookmarks.page',
+  'bracket-comp.page',
+  'character-map.page',
+  'code-comment.page',
+  'color-picker.page',
+  'commander.page',
+  'dashboard.page',
+  'draw-spaces.page',
+  'git.page',
+  'join-split-lines.page',
+  'legal-plugins.xml',
+  'multi-edit.page',
+  'terminal.page',
+  'text-size.page',
+  'translate.page',
+  'word-completion.page',
+  'zeitgeist-dataprovider.page',
+]
+
+gnome.yelp(
+  'gedit',
+  sources: gedit_help_sources,
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..960fee6
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,157 @@
+project(
+  'gedit-plugins', 'c',
+  version: '3.32.0',
+  meson_version: '>=0.50.0',
+  license: 'GPL2'
+)
+
+gnome = import('gnome')
+i18n = import('i18n')
+pkg = import('pkgconfig')
+python = import('python')
+
+# Versioning
+version = meson.project_version()
+version_arr = version.split('.')
+version_major = version_arr[0]
+version_minor = version_arr[1]
+version_micro = version_arr[2]
+
+api_version = '3.14'
+
+package_name = meson.project_name()
+package_string = '@0@-@1@'.format(package_name, api_version)
+
+# Paths
+rootdir = include_directories('.')
+
+srcdir = meson.current_source_dir()
+builddir = meson.current_build_dir()
+
+prefix = get_option('prefix')
+
+bindir = join_paths(prefix, get_option('bindir'))
+includedir = join_paths(prefix, get_option('includedir'))
+libdir = join_paths(prefix, get_option('libdir'))
+libexecdir = join_paths(prefix, get_option('libexecdir'))
+datadir = join_paths(prefix, get_option('datadir'))
+
+pkglibdir = join_paths(libdir, 'gedit')
+pkgdatadir = join_paths(datadir, 'gedit')
+
+appstreamdir = join_paths(datadir, 'metainfo')
+dbusdir = join_paths(datadir, 'dbus-1')
+glibdir = join_paths(datadir, 'glib-2.0')
+localedir = join_paths(datadir, 'locale')
+
+# Dependencies
+libpeas_req = '>= 1.14.1'
+gedit_req = '>= 3.16'
+appstream_req = '>= 0.12.1'
+zeitgeist_req = '>= 0.9.12'
+
+libpeas_dep = dependency('libpeas-1.0', version: libpeas_req)
+gedit_dep = dependency('gedit', version: gedit_req)
+
+zeitgeist_dep = dependency('zeitgeist-2.0', version: zeitgeist_req, required: false)
+
+appstream_util = find_program('appstream-util', required: false)
+
+# Configurations
+config_h = configuration_data()
+config_h.set_quoted('PACKAGE_NAME', package_name)
+config_h.set_quoted('PACKAGE_STRING', package_string)
+config_h.set_quoted('PACKAGE_VERSION', version)
+config_h.set_quoted('GETTEXT_PACKAGE', package_name)
+config_h.set_quoted('LOCALEDIR', localedir)
+config_h.set_quoted('LIBDIR', libdir)
+config_h.set_quoted('DATADIR', datadir)
+config_h.set_quoted('VERSION', version)
+
+config_h.set('GEDIT_MAJOR_VERSION', version_major)
+config_h.set('GEDIT_MINOR_VERSION', version_minor)
+config_h.set('GEDIT_MICRO_VERSION', version_micro)
+
+configure_file(
+  output: 'config.h',
+  configuration: config_h
+)
+
+# Options
+active_plugins = []
+extra_languages = []
+all_plugins = {
+  'bookmarks': {'language': 'c'},
+  'bracketcompletion': {'language': 'python'},
+  'charmap': {'language': 'python'},
+  'codecomment': {'language': 'python'},
+  'colorpicker': {'language': 'python'},
+  'colorschemer': {'language': 'python'},
+  'commander': {'language': 'python'},
+  'drawspaces': {'language': 'c'},
+  'findinfiles': {'language': 'vala'},
+  'git': {'language': 'python'},
+  'joinlines': {'language': 'python'},
+  'multiedit': {'language': 'python'},
+  'smartspaces': {'language': 'python'},
+  'synctex': {'language': 'python'},
+  'terminal': {'language': 'python'},
+  'textsize': {'language': 'python'},
+  'translate': {'language': 'python'},
+  'wordcompletion': {'language': 'c'},
+  'zeitgeist': {'language': 'c'},
+}
+
+foreach plugin_name, plugin_metadata : all_plugins
+  if get_option('plugin_@0@'.format(plugin_name))
+    active_plugins += plugin_name
+
+    plugin_language = plugin_metadata.get('language')
+    if plugin_language != 'c'
+      extra_languages += plugin_language
+    endif
+  endif
+endforeach
+
+if 'python' in extra_languages
+  python3 = python.find_installation('python3')
+endif
+
+if 'vala' in extra_languages
+  add_languages('vala', required: true)
+  valac = meson.get_compiler('vala')
+endif
+
+install_metainfo = true
+
+subdir('po')
+subdir('plugins')
+subdir('help')
+
+summary = [
+  '',
+  '------',
+  'gedit-plugins @0@ (@1@)'.format(version, api_version),
+  '',
+  '  AppData: @0@'.format(install_metainfo),
+  '',
+  'Plugins:']
+foreach plugin_name : active_plugins
+  summary += '  ' + plugin_name
+endforeach
+summary += [
+  '',
+  'Directories:',
+  '   prefix: @0@'.format(prefix),
+  '   libdir: @0@'.format(libdir),
+  '  datadir: @0@'.format(datadir),
+  '',
+  '------',
+]
+
+meson.add_install_script(
+  'build-aux/meson/post_install.py',
+  libdir, datadir,
+)
+
+message('\n'.join(summary))
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..330ea0f
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,19 @@
+option('plugin_bookmarks', type: 'boolean')
+option('plugin_bracketcompletion', type: 'boolean')
+option('plugin_charmap', type: 'boolean')
+option('plugin_codecomment', type: 'boolean')
+option('plugin_colorpicker', type: 'boolean')
+option('plugin_colorschemer', type: 'boolean')
+option('plugin_commander', type: 'boolean')
+option('plugin_drawspaces', type: 'boolean')
+option('plugin_findinfiles', type: 'boolean', value: false)
+option('plugin_git', type: 'boolean')
+option('plugin_joinlines', type: 'boolean')
+option('plugin_multiedit', type: 'boolean')
+option('plugin_smartspaces', type: 'boolean')
+option('plugin_synctex', type: 'boolean')
+option('plugin_terminal', type: 'boolean')
+option('plugin_textsize', type: 'boolean')
+option('plugin_translate', type: 'boolean')
+option('plugin_wordcompletion', type: 'boolean')
+option('plugin_zeitgeist', type: 'boolean')
diff --git a/plugins/bookmarks/meson.build b/plugins/bookmarks/meson.build
new file mode 100644
index 0000000..e7305bf
--- /dev/null
+++ b/plugins/bookmarks/meson.build
@@ -0,0 +1,68 @@
+libbookmarks_sources = files(
+  'gedit-bookmarks-app-activatable.c',
+  'gedit-bookmarks-plugin.c',
+)
+
+libbookmarks_deps = [
+  gedit_dep,
+]
+
+libbookmarks_c_args = [
+  '-DHAVE_CONFIG_H',
+]
+
+subdir('messages')
+
+libbookmarks_sha = shared_module(
+  'bookmarks',
+  sources: libbookmarks_sources,
+  include_directories: rootdir,
+  dependencies: libbookmarks_deps,
+  c_args: libbookmarks_c_args,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+bookmarks_plugin_in = configure_file(
+  input: 'bookmarks.plugin.desktop.in.in',
+  output: 'bookmarks.plugin.desktop.in',
+  configuration: plugin_in,
+  install: false,
+)
+
+bookmarks_plugin = custom_target(
+  'bookmarks.plugin',
+  input: bookmarks_plugin_in,
+  output: 'bookmarks.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+bookmarks_metainfo = i18n.merge_file(
+  'gedit-bookmarks.metainfo.xml',
+  input: 'gedit-bookmarks.metainfo.xml.in',
+  output: 'gedit-bookmarks.metainfo.xml',
+  po_dir: join_paths(srcdir, 'po'),
+  type: 'xml',
+  install: true,
+  install_dir: appstreamdir,
+)
+
+if appstream_util.found()
+  test(
+    'validate-gedit-bookmarks.metainfo.xml',
+    appstream_util,
+    args: [
+      'validate-relax',
+      '--nonet',
+      bookmarks_metainfo.full_path(),
+    ]
+  )
+endif
diff --git a/plugins/bookmarks/messages/meson.build b/plugins/bookmarks/messages/meson.build
new file mode 100644
index 0000000..accdcf9
--- /dev/null
+++ b/plugins/bookmarks/messages/meson.build
@@ -0,0 +1,7 @@
+libbookmarks_sources += files(
+  'gedit-bookmarks-message-add.c',
+  'gedit-bookmarks-message-goto-next.c',
+  'gedit-bookmarks-message-goto-previous.c',
+  'gedit-bookmarks-message-remove.c',
+  'gedit-bookmarks-message-toggle.c',
+)
diff --git a/plugins/bracketcompletion/meson.build b/plugins/bracketcompletion/meson.build
new file mode 100644
index 0000000..4d2ff4d
--- /dev/null
+++ b/plugins/bracketcompletion/meson.build
@@ -0,0 +1,52 @@
+bracketcompletion_sources = files(
+  'bracketcompletion.py',
+)
+
+install_data(
+  bracketcompletion_sources,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+bracketcompletion_plugin_in = configure_file(
+  input: 'bracketcompletion.plugin.desktop.in.in',
+  output: 'bracketcompletion.plugin.desktop.in',
+  configuration: plugin_in,
+  install: false,
+)
+
+bracketcompletion_plugin = custom_target(
+  'bracketcompletion.plugin',
+  input: bracketcompletion_plugin_in,
+  output: 'bracketcompletion.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+bracketcompletion_metainfo = i18n.merge_file(
+  'gedit-bracketcompletion.metainfo.xml',
+  input: 'gedit-bracketcompletion.metainfo.xml.in',
+  output: 'gedit-bracketcompletion.metainfo.xml',
+  po_dir: join_paths(srcdir, 'po'),
+  type: 'xml',
+  install: true,
+  install_dir: appstreamdir,
+)
+
+if appstream_util.found()
+  test(
+    'validate-gedit-bracketcompletion.metainfo.xml',
+    appstream_util,
+    args: [
+      'validate-relax',
+      '--nonet',
+      bracketcompletion_metainfo.full_path(),
+    ]
+  )
+endif
diff --git a/plugins/charmap/meson.build b/plugins/charmap/meson.build
new file mode 100644
index 0000000..b7d1115
--- /dev/null
+++ b/plugins/charmap/meson.build
@@ -0,0 +1,48 @@
+install_subdir(
+  'charmap',
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+charmap_plugin_in = configure_file(
+  input: 'charmap.plugin.desktop.in.in',
+  output: 'charmap.plugin.desktop.in',
+  configuration: plugin_in,
+  install: false,
+)
+
+charmap_plugin = custom_target(
+  'charmap.plugin',
+  input: charmap_plugin_in,
+  output: 'charmap.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+charmap_metainfo = i18n.merge_file(
+  'gedit-charmap.metainfo.xml',
+  input: 'gedit-charmap.metainfo.xml.in',
+  output: 'gedit-charmap.metainfo.xml',
+  po_dir: join_paths(srcdir, 'po'),
+  type: 'xml',
+  install: true,
+  install_dir: appstreamdir,
+)
+
+if appstream_util.found()
+  test(
+    'validate-gedit-charmap.metainfo.xml',
+    appstream_util,
+    args: [
+      'validate-relax',
+      '--nonet',
+      charmap_metainfo.full_path(),
+    ]
+  )
+endif
diff --git a/plugins/codecomment/meson.build b/plugins/codecomment/meson.build
new file mode 100644
index 0000000..49594dd
--- /dev/null
+++ b/plugins/codecomment/meson.build
@@ -0,0 +1,52 @@
+codecomment_sources = files(
+  'codecomment.py',
+)
+
+install_data(
+  codecomment_sources,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+codecomment_plugin_in = configure_file(
+  input: 'codecomment.plugin.desktop.in.in',
+  output: 'codecomment.plugin.desktop.in',
+  configuration: plugin_in,
+  install: false,
+)
+
+codecomment_plugin = custom_target(
+  'codecomment.plugin',
+  input: codecomment_plugin_in,
+  output: 'codecomment.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+codecomment_metainfo = i18n.merge_file(
+  'gedit-codecomment.metainfo.xml',
+  input: 'gedit-codecomment.metainfo.xml.in',
+  output: 'gedit-codecomment.metainfo.xml',
+  po_dir: join_paths(srcdir, 'po'),
+  type: 'xml',
+  install: true,
+  install_dir: appstreamdir,
+)
+
+if appstream_util.found()
+  test(
+    'validate-gedit-codecomment.metainfo.xml',
+    appstream_util,
+    args: [
+      'validate-relax',
+      '--nonet',
+      codecomment_metainfo.full_path(),
+    ]
+  )
+endif
diff --git a/plugins/colorpicker/meson.build b/plugins/colorpicker/meson.build
new file mode 100644
index 0000000..889c9ce
--- /dev/null
+++ b/plugins/colorpicker/meson.build
@@ -0,0 +1,52 @@
+colorpicker_sources = files(
+  'colorpicker.py',
+)
+
+install_data(
+  colorpicker_sources,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+colorpicker_plugin_in = configure_file(
+  input: 'colorpicker.plugin.desktop.in.in',
+  output: 'colorpicker.plugin.desktop.in',
+  configuration: plugin_in,
+  install: false,
+)
+
+colorpicker_plugin = custom_target(
+  'colorpicker.plugin',
+  input: colorpicker_plugin_in,
+  output: 'colorpicker.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+colorpicker_metainfo = i18n.merge_file(
+  'gedit-colorpicker.metainfo.xml',
+  input: 'gedit-colorpicker.metainfo.xml.in',
+  output: 'gedit-colorpicker.metainfo.xml',
+  po_dir: join_paths(srcdir, 'po'),
+  type: 'xml',
+  install: true,
+  install_dir: appstreamdir,
+)
+
+if appstream_util.found()
+  test(
+    'validate-gedit-colorpicker.metainfo.xml',
+    appstream_util,
+    args: [
+      'validate-relax',
+      '--nonet',
+      colorpicker_metainfo.full_path(),
+    ]
+  )
+endif
diff --git a/plugins/colorschemer/meson.build b/plugins/colorschemer/meson.build
new file mode 100644
index 0000000..fcb904e
--- /dev/null
+++ b/plugins/colorschemer/meson.build
@@ -0,0 +1,61 @@
+install_subdir(
+  'schemer',
+  exclude_files: 'Makefile.am',
+  strip_directory : true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+    'colorschemer',
+  )
+)
+
+install_data(
+  'schemer.ui',
+  install_dir: join_paths(
+    pkgdatadir,
+    'plugins',
+    'colorschemer',
+    'ui',
+  )
+)
+
+colorschemer_plugin_in = configure_file(
+  input: 'colorschemer.plugin.desktop.in.in',
+  output: 'colorschemer.plugin.desktop.in',
+  configuration: plugin_in,
+  install: false,
+)
+
+colorschemer_plugin = custom_target(
+  'colorschemer.plugin',
+  input: colorschemer_plugin_in,
+  output: 'colorschemer.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+colorschemer_metainfo = i18n.merge_file(
+  'gedit-colorschemer.metainfo.xml',
+  input: 'gedit-colorschemer.metainfo.xml.in',
+  output: 'gedit-colorschemer.metainfo.xml',
+  po_dir: join_paths(srcdir, 'po'),
+  type: 'xml',
+  install: true,
+  install_dir: appstreamdir,
+)
+
+if appstream_util.found()
+  test(
+    'validate-gedit-colorschemer.metainfo.xml',
+    appstream_util,
+    args: [
+      'validate-relax',
+      '--nonet',
+      colorschemer_metainfo.full_path(),
+    ]
+  )
+endif
diff --git a/plugins/commander/meson.build b/plugins/commander/meson.build
new file mode 100644
index 0000000..2fedf80
--- /dev/null
+++ b/plugins/commander/meson.build
@@ -0,0 +1,57 @@
+install_subdir(
+  'commander',
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+install_subdir(
+  'modules',
+  install_dir: join_paths(
+    pkgdatadir,
+    'plugins',
+    'commander',
+  )
+)
+
+commander_plugin_in = configure_file(
+  input: 'commander.plugin.desktop.in.in',
+  output: 'commander.plugin.desktop.in',
+  configuration: plugin_in,
+  install: false,
+)
+
+commander_plugin = custom_target(
+  'commander.plugin',
+  input: commander_plugin_in,
+  output: 'commander.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+commander_metainfo = i18n.merge_file(
+  'gedit-commander.metainfo.xml',
+  input: 'gedit-commander.metainfo.xml.in',
+  output: 'gedit-commander.metainfo.xml',
+  po_dir: join_paths(srcdir, 'po'),
+  type: 'xml',
+  install: true,
+  install_dir: appstreamdir,
+)
+
+if appstream_util.found()
+  test(
+    'validate-gedit-commander.metainfo.xml',
+    appstream_util,
+    args: [
+      'validate-relax',
+      '--nonet',
+      commander_metainfo.full_path(),
+    ]
+  )
+endif
diff --git a/plugins/drawspaces/meson.build b/plugins/drawspaces/meson.build
new file mode 100644
index 0000000..3f523e5
--- /dev/null
+++ b/plugins/drawspaces/meson.build
@@ -0,0 +1,84 @@
+libdrawspaces_sources = files(
+  'gedit-drawspaces-app-activatable.c',
+  'gedit-drawspaces-view-activatable.c',
+  'gedit-drawspaces-window-activatable.c',
+)
+
+libdrawspaces_deps = [
+  gedit_dep,
+]
+
+libdrawspaces_c_args = [
+  '-DHAVE_CONFIG_H',
+]
+
+libdrawspaces_res = gnome.compile_resources(
+  'gedit-drawspaces-resources',
+  'gedit-drawspaces.gresource.xml',
+)
+
+libdrawspaces_sources += [
+  libdrawspaces_res.get(0),
+]
+
+libdrawspaces_sha = shared_module(
+  'drawspaces',
+  sources: libdrawspaces_sources,
+  include_directories: rootdir,
+  dependencies: libdrawspaces_deps,
+  c_args: libdrawspaces_c_args,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+drawspaces_plugin_in = configure_file(
+  input: 'drawspaces.plugin.desktop.in.in',
+  output: 'drawspaces.plugin.desktop.in',
+  configuration: plugin_in,
+  install: false,
+)
+
+drawspaces_plugin = custom_target(
+  'drawspaces.plugin',
+  input: drawspaces_plugin_in,
+  output: 'drawspaces.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+install_data(
+  'org.gnome.gedit.plugins.drawspaces.gschema.xml',
+  install_dir: join_paths(
+    glibdir,
+    'schemas',
+  )
+)
+
+drawspaces_metainfo = i18n.merge_file(
+  'gedit-drawspaces.metainfo.xml',
+  input: 'gedit-drawspaces.metainfo.xml.in',
+  output: 'gedit-drawspaces.metainfo.xml',
+  po_dir: join_paths(srcdir, 'po'),
+  type: 'xml',
+  install: true,
+  install_dir: appstreamdir,
+)
+
+if appstream_util.found()
+  test(
+    'validate-gedit-drawspaces.metainfo.xml',
+    appstream_util,
+    args: [
+      'validate-relax',
+      '--nonet',
+      drawspaces_metainfo.full_path(),
+    ]
+  )
+endif
diff --git a/plugins/findinfiles/meson.build b/plugins/findinfiles/meson.build
new file mode 100644
index 0000000..c356dd2
--- /dev/null
+++ b/plugins/findinfiles/meson.build
@@ -0,0 +1,82 @@
+libfindinfiles_sources = files(
+  'dialog.vala',
+  'job.vala',
+  'matcher.vala',
+  'plugin.vala',
+  'result-panel.vala',
+)
+
+libfindinfiles_deps = [
+  valac.find_library('config', dirs: vapi_dir),
+  valac.find_library('posix'),
+  libpeas_dep,
+  gedit_dep,
+]
+
+libfindinfiles_c_args = [
+  '-DGETTEXT_PACKAGE="@0@"'.format(package_name),
+  '-DGP_LOCALEDIR="@0@"'.format(localedir),
+]
+
+libfindinfiles_res = gnome.compile_resources(
+  'findinfiles-resources',
+  'findinfiles.gresource.xml',
+)
+
+libfindinfiles_sources += [
+  libfindinfiles_res.get(0),
+]
+
+libfindinfiles_sha = shared_module(
+  'findinfiles',
+  sources: libfindinfiles_sources,
+  include_directories: rootdir,
+  dependencies: libfindinfiles_deps,
+  c_args: libfindinfiles_c_args,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+findinfiles_plugin_in = configure_file(
+  input: 'findinfiles.plugin.desktop.in.in',
+  output: 'findinfiles.plugin.desktop.in',
+  configuration: plugin_in,
+  install: false,
+)
+
+findinfiles_plugin = custom_target(
+  'findinfiles.plugin',
+  input: findinfiles_plugin_in,
+  output: 'findinfiles.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+findinfiles_metainfo = i18n.merge_file(
+  'gedit-findinfiles.metainfo.xml',
+  input: 'gedit-findinfiles.metainfo.xml.in',
+  output: 'gedit-findinfiles.metainfo.xml',
+  po_dir: join_paths(srcdir, 'po'),
+  type: 'xml',
+  install: true,
+  install_dir: appstreamdir,
+)
+
+if appstream_util.found()
+  test(
+    'validate-gedit-findinfiles.metainfo.xml',
+    appstream_util,
+    args: [
+      'validate-relax',
+      '--nonet',
+      findinfiles_metainfo.full_path(),
+    ]
+  )
+endif
diff --git a/plugins/git/meson.build b/plugins/git/meson.build
new file mode 100644
index 0000000..f6f2b0b
--- /dev/null
+++ b/plugins/git/meson.build
@@ -0,0 +1,48 @@
+install_subdir(
+  'git',
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+git_plugin_in = configure_file(
+  input: 'git.plugin.desktop.in.in',
+  output: 'git.plugin.desktop.in',
+  configuration: plugin_in,
+  install: false,
+)
+
+git_plugin = custom_target(
+  'git.plugin',
+  input: git_plugin_in,
+  output: 'git.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+git_metainfo = i18n.merge_file(
+  'gedit-git.metainfo.xml',
+  input: 'gedit-git.metainfo.xml.in',
+  output: 'gedit-git.metainfo.xml',
+  po_dir: join_paths(srcdir, 'po'),
+  type: 'xml',
+  install: true,
+  install_dir: appstreamdir,
+)
+
+if appstream_util.found()
+  test(
+    'validate-gedit-git.metainfo.xml',
+    appstream_util,
+    args: [
+      'validate-relax',
+      '--nonet',
+      git_metainfo.full_path(),
+    ]
+  )
+endif
diff --git a/plugins/joinlines/meson.build b/plugins/joinlines/meson.build
new file mode 100644
index 0000000..12f081e
--- /dev/null
+++ b/plugins/joinlines/meson.build
@@ -0,0 +1,52 @@
+joinlines_sources = files(
+  'joinlines.py',
+)
+
+install_data(
+  joinlines_sources,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+joinlines_plugin_in = configure_file(
+  input: 'joinlines.plugin.desktop.in.in',
+  output: 'joinlines.plugin.desktop.in',
+  configuration: plugin_in,
+  install: false,
+)
+
+joinlines_plugin = custom_target(
+  'joinlines.plugin',
+  input: joinlines_plugin_in,
+  output: 'joinlines.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+joinlines_metainfo = i18n.merge_file(
+  'gedit-joinlines.metainfo.xml',
+  input: 'gedit-joinlines.metainfo.xml.in',
+  output: 'gedit-joinlines.metainfo.xml',
+  po_dir: join_paths(srcdir, 'po'),
+  type: 'xml',
+  install: true,
+  install_dir: appstreamdir,
+)
+
+if appstream_util.found()
+  test(
+    'validate-gedit-joinlines.metainfo.xml',
+    appstream_util,
+    args: [
+      'validate-relax',
+      '--nonet',
+      joinlines_metainfo.full_path(),
+    ]
+  )
+endif
diff --git a/plugins/meson.build b/plugins/meson.build
new file mode 100644
index 0000000..49f2116
--- /dev/null
+++ b/plugins/meson.build
@@ -0,0 +1,40 @@
+msgfmt_plugin_cmd = [
+  find_program('msgfmt'),
+  '--desktop',
+  '--keyword=Name',
+  '--keyword=Description',
+  '--template=@INPUT@',
+  '-d', join_paths(srcdir, 'po'),
+  '--output=@OUTPUT@'
+]
+
+plugin_in = configuration_data()
+plugin_in.set('VERSION', version)
+
+gpdefs_py = configuration_data()
+gpdefs_py.set('PACKAGE', package_name)
+gpdefs_py.set('PACKAGE_STRING', package_string)
+gpdefs_py.set('GETTEXT_PACKAGE', package_name)
+gpdefs_py.set('VERSION', version)
+
+gpdefs_py.set('prefix', prefix)
+
+configure_file(
+  input: 'gpdefs.py.in',
+  output: 'gpdefs.py',
+  configuration: gpdefs_py,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+vapi_dir = join_paths(
+  srcdir,
+  'plugins',
+)
+
+foreach plugin_name : active_plugins
+  subdir(plugin_name)
+endforeach
diff --git a/plugins/multiedit/meson.build b/plugins/multiedit/meson.build
new file mode 100644
index 0000000..855e8ca
--- /dev/null
+++ b/plugins/multiedit/meson.build
@@ -0,0 +1,48 @@
+install_subdir(
+  'multiedit',
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+multiedit_plugin_in = configure_file(
+  input: 'multiedit.plugin.desktop.in.in',
+  output: 'multiedit.plugin.desktop.in',
+  configuration: plugin_in,
+  install: false,
+)
+
+multiedit_plugin = custom_target(
+  'multiedit.plugin',
+  input: multiedit_plugin_in,
+  output: 'multiedit.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+multiedit_metainfo = i18n.merge_file(
+  'gedit-multiedit.metainfo.xml',
+  input: 'gedit-multiedit.metainfo.xml.in',
+  output: 'gedit-multiedit.metainfo.xml',
+  po_dir: join_paths(srcdir, 'po'),
+  type: 'xml',
+  install: true,
+  install_dir: appstreamdir,
+)
+
+if appstream_util.found()
+  test(
+    'validate-gedit-multiedit.metainfo.xml',
+    appstream_util,
+    args: [
+      'validate-relax',
+      '--nonet',
+      multiedit_metainfo.full_path(),
+    ]
+  )
+endif
diff --git a/plugins/smartspaces/meson.build b/plugins/smartspaces/meson.build
new file mode 100644
index 0000000..8821837
--- /dev/null
+++ b/plugins/smartspaces/meson.build
@@ -0,0 +1,52 @@
+smartspaces_sources = files(
+  'smartspaces.py',
+)
+
+install_data(
+  smartspaces_sources,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+smartspaces_plugin_in = configure_file(
+  input: 'smartspaces.plugin.desktop.in.in',
+  output: 'smartspaces.plugin.desktop.in',
+  configuration: plugin_in,
+  install: false,
+)
+
+smartspaces_plugin = custom_target(
+  'smartspaces.plugin',
+  input: smartspaces_plugin_in,
+  output: 'smartspaces.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+smartspaces_metainfo = i18n.merge_file(
+  'gedit-smartspaces.metainfo.xml',
+  input: 'gedit-smartspaces.metainfo.xml.in',
+  output: 'gedit-smartspaces.metainfo.xml',
+  po_dir: join_paths(srcdir, 'po'),
+  type: 'xml',
+  install: true,
+  install_dir: appstreamdir,
+)
+
+if appstream_util.found()
+  test(
+    'validate-gedit-smartspaces.metainfo.xml',
+    appstream_util,
+    args: [
+      'validate-relax',
+      '--nonet',
+      smartspaces_metainfo.full_path(),
+    ]
+  )
+endif
diff --git a/plugins/synctex/meson.build b/plugins/synctex/meson.build
new file mode 100644
index 0000000..c6be01d
--- /dev/null
+++ b/plugins/synctex/meson.build
@@ -0,0 +1,48 @@
+install_subdir(
+  'synctex',
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+synctex_plugin_in = configure_file(
+  input: 'synctex.plugin.desktop.in.in',
+  output: 'synctex.plugin.desktop.in',
+  configuration: plugin_in,
+  install: false,
+)
+
+synctex_plugin = custom_target(
+  'synctex.plugin',
+  input: synctex_plugin_in,
+  output: 'synctex.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+synctex_metainfo = i18n.merge_file(
+  'gedit-synctex.metainfo.xml',
+  input: 'gedit-synctex.metainfo.xml.in',
+  output: 'gedit-synctex.metainfo.xml',
+  po_dir: join_paths(srcdir, 'po'),
+  type: 'xml',
+  install: true,
+  install_dir: appstreamdir,
+)
+
+if appstream_util.found()
+  test(
+    'validate-gedit-synctex.metainfo.xml',
+    appstream_util,
+    args: [
+      'validate-relax',
+      '--nonet',
+      synctex_metainfo.full_path(),
+    ]
+  )
+endif
diff --git a/plugins/terminal/meson.build b/plugins/terminal/meson.build
new file mode 100644
index 0000000..4f56418
--- /dev/null
+++ b/plugins/terminal/meson.build
@@ -0,0 +1,60 @@
+terminal_sources = files(
+  'terminal.py',
+)
+
+install_data(
+  terminal_sources,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+terminal_plugin_in = configure_file(
+  input: 'terminal.plugin.desktop.in.in',
+  output: 'terminal.plugin.desktop.in',
+  configuration: plugin_in,
+  install: false,
+)
+
+terminal_plugin = custom_target(
+  'terminal.plugin',
+  input: terminal_plugin_in,
+  output: 'terminal.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+install_data(
+  'org.gnome.gedit.plugins.terminal.gschema.xml',
+  install_dir: join_paths(
+    glibdir,
+    'schemas',
+  )
+)
+
+terminal_metainfo = i18n.merge_file(
+  'gedit-terminal.metainfo.xml',
+  input: 'gedit-terminal.metainfo.xml.in',
+  output: 'gedit-terminal.metainfo.xml',
+  po_dir: join_paths(srcdir, 'po'),
+  type: 'xml',
+  install: true,
+  install_dir: appstreamdir,
+)
+
+if appstream_util.found()
+  test(
+    'validate-gedit-terminal.metainfo.xml',
+    appstream_util,
+    args: [
+      'validate-relax',
+      '--nonet',
+      terminal_metainfo.full_path(),
+    ]
+  )
+endif
diff --git a/plugins/textsize/meson.build b/plugins/textsize/meson.build
new file mode 100644
index 0000000..c7baa86
--- /dev/null
+++ b/plugins/textsize/meson.build
@@ -0,0 +1,48 @@
+install_subdir(
+  'textsize',
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+textsize_plugin_in = configure_file(
+  input: 'textsize.plugin.desktop.in.in',
+  output: 'textsize.plugin.desktop.in',
+  configuration: plugin_in,
+  install: false,
+)
+
+textsize_plugin = custom_target(
+  'textsize.plugin',
+  input: textsize_plugin_in,
+  output: 'textsize.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+textsize_metainfo = i18n.merge_file(
+  'gedit-textsize.metainfo.xml',
+  input: 'gedit-textsize.metainfo.xml.in',
+  output: 'gedit-textsize.metainfo.xml',
+  po_dir: join_paths(srcdir, 'po'),
+  type: 'xml',
+  install: true,
+  install_dir: appstreamdir,
+)
+
+if appstream_util.found()
+  test(
+    'validate-gedit-textsize.metainfo.xml',
+    appstream_util,
+    args: [
+      'validate-relax',
+      '--nonet',
+      textsize_metainfo.full_path(),
+    ]
+  )
+endif
diff --git a/plugins/translate/meson.build b/plugins/translate/meson.build
new file mode 100644
index 0000000..e87001e
--- /dev/null
+++ b/plugins/translate/meson.build
@@ -0,0 +1,69 @@
+install_subdir(
+  'translate',
+  exclude_directories: ['ui'],
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+install_data(
+  'translate/ui/preferences.ui',
+  install_dir: join_paths(
+    pkgdatadir,
+    'plugins',
+    'translate',
+    'ui',
+  )
+)
+
+subdir('tests')
+
+translate_plugin_in = configure_file(
+  input: 'translate.plugin.desktop.in.in',
+  output: 'translate.plugin.desktop.in',
+  configuration: plugin_in,
+  install: false,
+)
+
+translate_plugin = custom_target(
+  'translate.plugin',
+  input: translate_plugin_in,
+  output: 'translate.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+install_data(
+  'org.gnome.gedit.plugins.translate.gschema.xml',
+  install_dir: join_paths(
+    glibdir,
+    'schemas',
+  )
+)
+
+translate_metainfo = i18n.merge_file(
+  'gedit-translate.metainfo.xml',
+  input: 'gedit-translate.metainfo.xml.in',
+  output: 'gedit-translate.metainfo.xml',
+  po_dir: join_paths(srcdir, 'po'),
+  type: 'xml',
+  install: true,
+  install_dir: appstreamdir,
+)
+
+if appstream_util.found()
+  test(
+    'validate-gedit-translate.metainfo.xml',
+    appstream_util,
+    args: [
+      'validate-relax',
+      '--nonet',
+      translate_metainfo.full_path(),
+    ]
+  )
+endif
diff --git a/plugins/translate/tests/meson.build b/plugins/translate/tests/meson.build
new file mode 100644
index 0000000..f0875de
--- /dev/null
+++ b/plugins/translate/tests/meson.build
@@ -0,0 +1,22 @@
+translate_tests = {
+  'apertium': files('testapertium.py'),
+  'yandex': files('testyandex.py'),
+}
+
+translate_srcdir = join_paths(
+  srcdir,
+  'plugins',
+  'translate',
+  'translate',
+)
+
+foreach test_name, test_script : translate_tests
+  test(
+    'test-translate-@0@'.format(test_name),
+    python3,
+    args: [test_script],
+    env: [
+      'PYTHONPATH=@0@'.format(translate_srcdir),
+    ]
+  )
+endforeach
diff --git a/plugins/wordcompletion/meson.build b/plugins/wordcompletion/meson.build
new file mode 100644
index 0000000..d3c985f
--- /dev/null
+++ b/plugins/wordcompletion/meson.build
@@ -0,0 +1,82 @@
+libwordcompletion_sources = files(
+  'gedit-word-completion-plugin.c',
+)
+
+libwordcompletion_deps = [
+  gedit_dep,
+]
+
+libwordcompletion_c_args = [
+  '-DHAVE_CONFIG_H',
+]
+
+libwordcompletion_res = gnome.compile_resources(
+  'gedit-word-completion-resources',
+  'gedit-word-completion.gresource.xml',
+)
+
+libwordcompletion_sources += [
+  libwordcompletion_res.get(0),
+]
+
+libwordcompletion_sha = shared_module(
+  'wordcompletion',
+  sources: libwordcompletion_sources,
+  include_directories: rootdir,
+  dependencies: libwordcompletion_deps,
+  c_args: libwordcompletion_c_args,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+wordcompletion_plugin_in = configure_file(
+  input: 'wordcompletion.plugin.desktop.in.in',
+  output: 'wordcompletion.plugin.desktop.in',
+  configuration: plugin_in,
+  install: false,
+)
+
+wordcompletion_plugin = custom_target(
+  'wordcompletion.plugin',
+  input: wordcompletion_plugin_in,
+  output: 'wordcompletion.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+install_data(
+  'org.gnome.gedit.plugins.wordcompletion.gschema.xml',
+  install_dir: join_paths(
+    glibdir,
+    'schemas',
+  )
+)
+
+wordcompletion_metainfo = i18n.merge_file(
+  'gedit-wordcompletion.metainfo.xml',
+  input: 'gedit-wordcompletion.metainfo.xml.in',
+  output: 'gedit-wordcompletion.metainfo.xml',
+  po_dir: join_paths(srcdir, 'po'),
+  type: 'xml',
+  install: true,
+  install_dir: appstreamdir,
+)
+
+if appstream_util.found()
+  test(
+    'validate-gedit-wordcompletion.metainfo.xml',
+    appstream_util,
+    args: [
+      'validate-relax',
+      '--nonet',
+      wordcompletion_metainfo.full_path(),
+    ]
+  )
+endif
diff --git a/plugins/zeitgeist/meson.build b/plugins/zeitgeist/meson.build
new file mode 100644
index 0000000..eb5ef64
--- /dev/null
+++ b/plugins/zeitgeist/meson.build
@@ -0,0 +1,59 @@
+libzeitgeist_sources = files(
+  'gedit-zeitgeist-plugin.c',
+)
+
+libzeitgeist_deps = [
+  gedit_dep,
+  zeitgeist_dep,
+]
+
+libzeitgeist_c_args = [
+  '-DHAVE_CONFIG_H',
+]
+
+libzeitgeist_sha = shared_module(
+  'zeitgeist',
+  sources: libzeitgeist_sources,
+  include_directories: rootdir,
+  dependencies: libzeitgeist_deps,
+  c_args: libzeitgeist_c_args,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+zeitgeist_plugin = custom_target(
+  'zeitgeist.plugin',
+  input: 'zeitgeist.plugin.desktop.in',
+  output: 'zeitgeist.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+zeitgeist_metainfo = i18n.merge_file(
+'gedit-zeitgeist.metainfo.xml',
+  input: 'gedit-zeitgeist.metainfo.xml.in',
+  output: 'gedit-zeitgeist.metainfo.xml',
+  po_dir: join_paths(srcdir, 'po'),
+  type: 'xml',
+  install: true,
+  install_dir: appstreamdir,
+)
+
+if appstream_util.found()
+  test(
+    'validate-gedit-zeitgeist.metainfo.xml',
+    appstream_util,
+    args: [
+      'validate-relax',
+      '--nonet',
+      zeitgeist_metainfo.full_path(),
+    ]
+  )
+endif
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..0e5cd0b
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,7 @@
+i18n.gettext(
+  package_name,
+  preset: 'glib',
+  args: [
+    '--keyword=Description',
+  ]
+)



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