[gedit] build: Port to the meson build system



commit a8e5ce2854d19e392470a9779cb5678fbea27fed
Author: Martin Blanchard <tchaik gmx com>
Date:   Wed Sep 19 21:59:19 2018 +0100

    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/issues/71

 build-aux/meson/post_install.py                 |  30 +++
 data/icons/meson.build                          |   7 +
 data/meson.build                                |  92 +++++++
 docs/meson.build                                |   3 +
 docs/reference/meson.build                      |  86 +++++++
 gedit/meson.build                               | 307 ++++++++++++++++++++++++
 gedit/resources/meson.build                     |  20 ++
 help/LINGUAS                                    |  31 +++
 help/meson.build                                |  54 +++++
 meson.build                                     | 195 +++++++++++++++
 meson_options.txt                               |  14 ++
 plugins/checkupdate/meson.build                 |  37 +++
 plugins/docinfo/meson.build                     |  38 +++
 plugins/docinfo/resources/meson.build           |   8 +
 plugins/externaltools/data/meson.build          |  46 ++++
 plugins/externaltools/meson.build               |  26 ++
 plugins/externaltools/scripts/meson.build       |  13 +
 plugins/externaltools/tools/meson.build         |  36 +++
 plugins/filebrowser/meson.build                 | 102 ++++++++
 plugins/filebrowser/messages/meson.build        |  25 ++
 plugins/filebrowser/resources/meson.build       |   8 +
 plugins/meson.build                             |  25 ++
 plugins/modelines/meson.build                   |  46 ++++
 plugins/pythonconsole/meson.build               |  24 ++
 plugins/pythonconsole/pythonconsole/meson.build |  24 ++
 plugins/quickhighlight/meson.build              |  36 +++
 plugins/quickopen/meson.build                   |  19 ++
 plugins/snippets/meson.build                    |  23 ++
 plugins/snippets/snippets/meson.build           |  39 +++
 plugins/sort/meson.build                        |  38 +++
 plugins/sort/resources/meson.build              |   8 +
 plugins/spell/meson.build                       |  38 +++
 plugins/time/meson.build                        |  65 +++++
 plugins/time/resources/meson.build              |   8 +
 po/meson.build                                  |   7 +
 subprojects/libgd.wrap                          |   4 +
 36 files changed, 1582 insertions(+)
---
diff --git a/build-aux/meson/post_install.py b/build-aux/meson/post_install.py
new file mode 100755
index 000000000..177f94755
--- /dev/null
+++ b/build-aux/meson/post_install.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+import sys
+
+libdir = sys.argv[1]
+datadir = sys.argv[1]
+
+# 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('Updating icon cache...')
+    subprocess.call(['gtk-update-icon-cache', '-qtf',
+                     os.path.join(datadir, 'icons', 'hicolor')])
+
+    print('Updating desktop database...')
+    subprocess.call(['update-desktop-database', '-q',
+                     os.path.join(datadir, 'applications')])
+
+    print('Compiling python modules...')
+    subprocess.call([sys.executable, '-m', 'compileall', '-f', '-q',
+                     os.path.join(libdir, 'gedit', 'plugins')])
+
+    print('Compiling python modules (optimized versions) ...')
+    subprocess.call([sys.executable, '-O', '-m', 'compileall', '-f', '-q',
+                     os.path.join(libdir, 'gedit', 'plugins')])
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 000000000..b7eca37cb
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,7 @@
+install_subdir(
+  'hicolor',
+  install_dir: join_paths(
+    datadir,
+    'icons',
+  )
+)
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 000000000..4707d0259
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,92 @@
+subdir('icons')
+
+install_man('gedit.1')
+
+install_data(
+  'gedit.convert',
+  install_dir: join_paths(
+    gconfdir,
+    'gsettings',
+  )
+)
+
+install_data(
+  'gedit-bugreport.sh',
+  install_dir: join_paths(
+    libexecdir,
+    package_name,
+  )
+)
+
+i18n.merge_file(
+  'appdata-file',
+  input: 'org.gnome.gedit.appdata.xml.in',
+  output: 'org.gnome.gedit.appdata.xml',
+  type: 'xml',
+  po_dir: join_paths(srcdir, 'po'),
+  install: true,
+  install_dir: join_paths(
+    datadir,
+    'metainfo',
+  )
+)
+
+desktop_in = configuration_data()
+desktop_in.set('VERSION', version)
+desktop_in.set('FULL_LIBEXECDIR', libexecdir)
+
+desktop_file = configure_file(
+  input: 'org.gnome.gedit.desktop.in.in',
+  output: 'org.gnome.gedit.desktop.in',
+  configuration: desktop_in,
+  install: false,
+)
+
+i18n.merge_file(
+  'desktop-file',
+  input: desktop_file,
+  output: 'org.gnome.gedit.desktop',
+  type: 'desktop',
+  po_dir: join_paths(srcdir, 'po'),
+  install: true,
+  install_dir: join_paths(
+    datadir,
+    'applications',
+  )
+)
+
+quoted_plugins = []
+foreach plugin_name:active_plugins
+  quoted_plugins += [
+    '\'@0@\''.format(plugin_name)
+  ]
+endforeach
+
+gschema_xml = configuration_data()
+gschema_xml.set('GETTEXT_PACKAGE', package_name)
+gschema_xml.set('ACTIVE_PLUGINS', ', '.join(quoted_plugins))
+
+configure_file(
+  input: 'org.gnome.gedit.gschema.xml.in',
+  output: 'org.gnome.gedit.gschema.xml',
+  configuration: gschema_xml,
+  install: true,
+  install_dir: join_paths(
+    glibdir,
+    'schemas',
+  )
+)
+
+service_in = configuration_data()
+service_in.set('bindir', bindir)
+
+configure_file(
+  input: 'org.gnome.gedit.service.in',
+  output: 'org.gnome.gedit.service',
+  configuration: service_in,
+  install: true,
+  install_dir: join_paths(
+    dbusdir,
+    'services',
+  )
+)
diff --git a/docs/meson.build b/docs/meson.build
new file mode 100644
index 000000000..c662ff079
--- /dev/null
+++ b/docs/meson.build
@@ -0,0 +1,3 @@
+if build_gtk_doc == true
+  subdir('reference')
+endif
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
new file mode 100644
index 000000000..260cf4f0c
--- /dev/null
+++ b/docs/reference/meson.build
@@ -0,0 +1,86 @@
+glib_prefix = glib_dep.get_pkgconfig_variable('prefix')
+glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html', 'glib')
+
+gobject_prefix = gobject_dep.get_pkgconfig_variable('prefix')
+gobject_docpath = join_paths(gobject_prefix, 'share', 'gtk-doc', 'html', 'gobject')
+
+gtk_prefix = gtk_dep.get_pkgconfig_variable('prefix')
+gtk_docpath = join_paths(gobject_prefix, 'share', 'gtk-doc', 'html', 'gtk')
+
+libgedit_reference_ignored_h = [
+  'gedit-app-osx.h',
+  'gedit-app-win32.h',
+  'gedit-app-x11.h',
+  'gedit-close-confirmation-dialog.h',
+  'gedit-dirs.h',
+  'gedit-document-private.h',
+  'gedit-documents-panel.h',
+  'gedit-encoding-items.h',
+  'gedit-encodings-dialog.h',
+  'gedit-enum-types.h',
+  'gedit-file-chooser-dialog-gtk.h',
+  'gedit-file-chooser-dialog-osx.h',
+  'gedit-file-chooser-dialog.h',
+  'gedit-highlight-mode-dialog.h',
+  'gedit-highlight-mode-selector.h',
+  'gedit-history-entry.h',
+  'gedit-io-error-info-bar.h',
+  'gedit-menu-stack-switcher.h',
+  'gedit-metadata-manager.h',
+  'gedit-multi-notebook.h',
+  'gedit-notebook-popup-menu.h',
+  'gedit-notebook-stack-switcher.h',
+  'gedit-notebook.h',
+  'gedit-open-document-selector-helper.h',
+  'gedit-open-document-selector-store.h',
+  'gedit-open-document-selector.h',
+  'gedit-open-menu-button.h',
+  'gedit-plugins-engine.h',
+  'gedit-preferences-dialog.h',
+  'gedit-print-job.h',
+  'gedit-print-preview.h',
+  'gedit-recent.h',
+  'gedit-replace-dialog.h',
+  'gedit-settings.h',
+  'gedit-small-button.h',
+  'gedit-status-menu-button.h',
+  'gedit-tab-label.h',
+  'gedit-view-centering.h',
+  'gedit-view-frame.h',
+  'gedit-window-private.h',
+]
+
+libgedit_reference_scan_args = [
+  '--rebuild-types',
+  '--deprecated-guards=GEDIT_DISABLE_DEPRECATED',
+  '--ignore-headers=' + ' '.join(libgedit_reference_ignored_h),
+]
+
+libgedit_reference_mkdb_args = [
+  '--xml-mode',
+  '--output-format=xml',
+  '--name-space=gedit',
+]
+
+libgedit_reference_fixxref_args = [
+  '--html-dir=@0@'.format(join_paths(gtkdocdir, 'html', package_string)),
+  '--extra-dir=@0@'.format(glib_docpath),
+  '--extra-dir=@0@'.format(gobject_docpath),
+  '--extra-dir=@0@'.format(gtk_docpath),
+]
+
+gnome.gtkdoc(
+  package_name,
+  main_sgml: 'gedit-docs.xml',
+  src_dir: join_paths(srcdir, 'gedit'),
+  dependencies: libgedit_dep,
+  scan_args: libgedit_reference_scan_args,
+  mkdb_args: libgedit_reference_mkdb_args,
+  fixxref_args: libgedit_reference_fixxref_args,
+  install: true,
+  install_dir: join_paths(
+    gtkdocdir,
+    'html',
+    package_string,
+  )
+)
diff --git a/gedit/meson.build b/gedit/meson.build
new file mode 100644
index 000000000..d388a1f3a
--- /dev/null
+++ b/gedit/meson.build
@@ -0,0 +1,307 @@
+libgedit_public_h = files(
+  'gedit-app-activatable.h',
+  'gedit-app.h',
+  'gedit-commands.h',
+  'gedit-debug.h',
+  'gedit-document.h',
+  'gedit-encodings-combo-box.h',
+  'gedit-menu-extension.h',
+  'gedit-message-bus.h',
+  'gedit-message.h',
+  'gedit-progress-info-bar.h',
+  'gedit-statusbar.h',
+  'gedit-tab.h',
+  'gedit-utils.h',
+  'gedit-view-activatable.h',
+  'gedit-view.h',
+  'gedit-window-activatable.h',
+  'gedit-window.h',
+)
+
+libgedit_private_h = files(
+  'gedit-app-private.h',
+  'gedit-close-confirmation-dialog.h',
+  'gedit-commands-private.h',
+  'gedit-dirs.h',
+  'gedit-document-private.h',
+  'gedit-documents-panel.h',
+  'gedit-encoding-items.h',
+  'gedit-encodings-dialog.h',
+  'gedit-file-chooser-dialog-gtk.h',
+  'gedit-file-chooser-dialog.h',
+  'gedit-highlight-mode-dialog.h',
+  'gedit-highlight-mode-selector.h',
+  'gedit-history-entry.h',
+  'gedit-io-error-info-bar.h',
+  'gedit-menu-stack-switcher.h',
+  'gedit-metadata-manager.h',
+  'gedit-multi-notebook.h',
+  'gedit-notebook.h',
+  'gedit-notebook-popup-menu.h',
+  'gedit-notebook-stack-switcher.h',
+  'gedit-open-document-selector.h',
+  'gedit-open-document-selector-helper.h',
+  'gedit-open-document-selector-store.h',
+  'gedit-pango.h',
+  'gedit-plugins-engine.h',
+  'gedit-preferences-dialog.h',
+  'gedit-print-job.h',
+  'gedit-print-preview.h',
+  'gedit-recent.h',
+  'gedit-replace-dialog.h',
+  'gedit-settings.h',
+  'gedit-status-menu-button.h',
+  'gedit-tab-label.h',
+  'gedit-tab-private.h',
+  'gedit-view-centering.h',
+  'gedit-view-frame.h',
+  'gedit-window-private.h',
+)
+
+libgedit_sources = files(
+  'gedit-app-activatable.c',
+  'gedit-app.c',
+  'gedit-close-confirmation-dialog.c',
+  'gedit-commands-documents.c',
+  'gedit-commands-edit.c',
+  'gedit-commands-file.c',
+  'gedit-commands-file-print.c',
+  'gedit-commands-help.c',
+  'gedit-commands-search.c',
+  'gedit-commands-view.c',
+  'gedit-debug.c',
+  'gedit-dirs.c',
+  'gedit-document.c',
+  'gedit-documents-panel.c',
+  'gedit-encoding-items.c',
+  'gedit-encodings-combo-box.c',
+  'gedit-encodings-dialog.c',
+  'gedit-file-chooser-dialog.c',
+  'gedit-file-chooser-dialog-gtk.c',
+  'gedit-highlight-mode-dialog.c',
+  'gedit-highlight-mode-selector.c',
+  'gedit-history-entry.c',
+  'gedit-io-error-info-bar.c',
+  'gedit-menu-extension.c',
+  'gedit-menu-stack-switcher.c',
+  'gedit-message-bus.c',
+  'gedit-message.c',
+  'gedit-metadata-manager.c',
+  'gedit-multi-notebook.c',
+  'gedit-notebook.c',
+  'gedit-notebook-popup-menu.c',
+  'gedit-notebook-stack-switcher.c',
+  'gedit-open-document-selector.c',
+  'gedit-open-document-selector-helper.c',
+  'gedit-open-document-selector-store.c',
+  'gedit-pango.c',
+  'gedit-plugins-engine.c',
+  'gedit-preferences-dialog.c',
+  'gedit-print-job.c',
+  'gedit-print-preview.c',
+  'gedit-progress-info-bar.c',
+  'gedit-recent.c',
+  'gedit-replace-dialog.c',
+  'gedit-settings.c',
+  'gedit-statusbar.c',
+  'gedit-status-menu-button.c',
+  'gedit-tab.c',
+  'gedit-tab-label.c',
+  'gedit-utils.c',
+  'gedit-view-activatable.c',
+  'gedit-view.c',
+  'gedit-view-centering.c',
+  'gedit-view-frame.c',
+  'gedit-window-activatable.c',
+  'gedit-window.c',
+)
+
+libgedit_c_args = [
+  '-DHAVE_CONFIG_H',
+]
+
+libgedit_link_args = [
+]
+
+libgedit_deps = [
+  glib_dep,
+  gobject_dep,
+  gio_dep,
+  gtk_dep,
+  gtksourceview_dep,
+  libpeas_dep,
+  libpeas_gtk_dep,
+  libxml_dep,
+  libgd_dep,
+]
+
+if windowing_target == 'quartz'
+  libgedit_sources += files(
+    'gedit-app-osx.c',
+    'gedit-file-chooser-dialog-osx.c',
+  )
+elif windowing_target == 'win32'
+  libgedit_sources += files(
+    'gedit-app-win32.c',
+  )
+else
+  libgedit_sources += files(
+    'gedit-app-x11.c',
+  )
+
+  libgedit_deps += [
+    x11_dep,
+  ]
+endif
+
+libgedit_enums = gnome.mkenums(
+  'gedit-enum-types',
+  sources: libgedit_public_h + ['gedit-notebook.h'],
+  h_template: 'gedit-enum-types.h.template',
+  c_template: 'gedit-enum-types.c.template',
+)
+
+subdir('resources')
+
+libgedit_sources += [
+  libgedit_enums.get(0),
+  libgedit_res.get(0),
+]
+
+libgedit_dep_sources = []
+
+install_headers(
+  libgedit_public_h,
+  install_dir: join_paths(
+    pkgincludedir,
+    'gedit',
+  )
+)
+
+libgedit_sha = shared_library(
+  package_string,
+  libgedit_sources + [libgedit_enums.get(1), libgedit_res.get(1)],
+  include_directories: rootdir,
+  dependencies: libgedit_deps,
+  c_args: libgedit_c_args,
+  link_args: libgedit_link_args,
+  install: true,
+  install_dir: pkglibdir,
+)
+
+if generate_gir == true
+  libgedit_public_h += [
+    libgedit_enums.get(1),
+  ]
+
+  libgedit_gir_includes = [
+    'Gtk-3.0',
+    'GtkSource-4',
+  ]
+
+  libgedit_gir = gnome.generate_gir(
+    libgedit_sha,
+    sources: libgedit_sources + libgedit_public_h,
+    nsversion: '3.0',
+    namespace: 'Gedit',
+    symbol_prefix: 'gedit',
+    identifier_prefix: 'Gedit',
+    export_packages: [package_string],
+    includes: libgedit_gir_includes,
+    link_with: libgedit_sha,
+    install: true,
+    install_dir_gir: join_paths(pkgdatadir, 'gir-1.0'),
+    install_dir_typelib: join_paths(pkglibdir, 'girepository-1.0'),
+  )
+
+  python3.install_sources(
+    'Gedit.py',
+    subdir: join_paths(
+      'gi',
+      'overrides',
+    )
+  )
+
+  libgedit_dep_sources += [
+    libgedit_gir,
+  ]
+
+  if generate_vapi == true
+    libgedit_vapi_packages = [
+      'gio-2.0',
+      'atk',
+      'gdk-3.0',
+      'gtk+-3.0',
+      'gtksourceview-4',
+    ]
+
+    libgedit_vapi = gnome.generate_vapi(
+      package_name,
+      sources: libgedit_gir.get(0),
+      packages: libgedit_vapi_packages,
+      install: true,
+      install_dir: vapidir,
+    )
+  endif
+endif
+
+libgedit_dep = declare_dependency(
+  link_with: libgedit_sha,
+  include_directories: rootdir,
+  dependencies: libgedit_deps,
+  sources: libgedit_dep_sources,
+)
+
+libgedit_pc = pkg.generate(
+  name: package_name,
+  description: 'GNOME text editor',
+  requires: ['gtksourceview-4', 'libpeas-1.0', 'libpeas-gtk-1.0'],
+  version: version,
+  subdirs: package_string,
+  libraries: libgedit_sha,
+  install_dir: pkgconfigdir,
+)
+
+# FIXME: https://github.com/mesonbuild/meson/issues/1687
+custom_target(
+  'org.gnome.gedit.enums.xml',
+  input : libgedit_sources + libgedit_public_h + ['gedit-notebook.h'],
+  output: 'org.gnome.gedit.enums.xml',
+  capture: true,
+  command: [
+    'glib-mkenums',
+    '--comments', '<!-- @comment@ -->',
+    '--fhead', '<schemalist>',
+    '--vhead', '  <@type@ id="org.gnome.gedit.@EnumName@">',
+    '--vprod', '    <value nick="@valuenick@" value="@valuenum@"/>',
+    '--vtail', '  </@type@>',
+    '--ftail', '</schemalist>',
+    '@INPUT@'
+  ],
+  install: true,
+  install_dir: join_paths(
+    glibdir,
+    'schemas',
+  )
+)
+
+gedit_sources = [
+  'gedit.c',
+]
+
+gedit_c_args = [
+  '-DHAVE_CONFIG_H',
+]
+
+gedit_deps = [
+  libgedit_dep,
+]
+
+gedit_exe = executable(
+  package_name,
+  gedit_sources,
+  dependencies: gedit_deps,
+  c_args: gedit_c_args,
+  install: true,
+  install_dir: bindir,
+)
diff --git a/gedit/resources/meson.build b/gedit/resources/meson.build
new file mode 100644
index 000000000..476a75bbe
--- /dev/null
+++ b/gedit/resources/meson.build
@@ -0,0 +1,20 @@
+gresource_xml = configuration_data()
+if windowing_targets.contains('quartz')
+  gresource_xml.set(
+    'OS_DEPENDENT_RESOURCE_FILES',
+    '<file preprocess="xml-stripblanks">gtk/menus-traditional.ui</file>'
+  )
+else
+  gresource_xml.set('OS_DEPENDENT_RESOURCE_FILES', '')
+endif
+
+libgedit_res_xml = configure_file(
+  input: 'gedit.gresource.xml.in',
+  output: 'gedit.gresource.xml',
+  configuration: gresource_xml
+)
+
+libgedit_res = gnome.compile_resources(
+  'gedit-resources',
+  libgedit_res_xml,
+)
diff --git a/help/LINGUAS b/help/LINGUAS
new file mode 100644
index 000000000..e41284e0e
--- /dev/null
+++ b/help/LINGUAS
@@ -0,0 +1,31 @@
+ar
+bg
+ca
+cs
+da
+de
+el
+es
+eu
+fi
+fr
+gl
+hu
+id
+it
+ja
+ko
+lv
+oc
+pl
+pt_BR
+ro
+ru
+sl
+sv
+te
+th
+uk
+zh_CN
+zh_HK
+zh_TW
\ No newline at end of file
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 000000000..73b30fc49
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,54 @@
+gedit_help_sources = [
+  'gedit-change-color-scheme.page',
+  'gedit-change-default-font.page',
+  'gedit-close-file.page',
+  'gedit-create-new-file.page',
+  'gedit-edit-as-root.page',
+  'gedit-files-basic.page',
+  'gedit-full-screen.page',
+  'gedit-open-files-from-sidepane.page',
+  'gedit-open-files.page',
+  'gedit-open-on-server.page',
+  'gedit-open-recent.page',
+  'gedit-plugin-guide.page',
+  'gedit-plugins-change-case.page',
+  'gedit-plugins-doc-stats.page',
+  'gedit-plugins-external-tools.page',
+  'gedit-plugins-file-browser.page',
+  'gedit-plugins-insert-date-time.page',
+  'gedit-plugins-install.page',
+  'gedit-plugins-modelines.page',
+  'gedit-plugins-pyconsole.page',
+  'gedit-plugins-quick-open.page',
+  'gedit-plugins-snippets.page',
+  'gedit-plugins-sort.page',
+  'gedit-printing-order.page',
+  'gedit-printing.page',
+  'gedit-printing-select.page',
+  'gedit-quickstart.page',
+  'gedit-replace.page',
+  'gedit-save-file.page',
+  'gedit-search.page',
+  'gedit-shortcut-keys.page',
+  'gedit-spellcheck.page',
+  'gedit-syntax-highlighting.page',
+  'gedit-tab-groups.page',
+  'gedit-tabs-moving.page',
+  'gedit-tabs.page',
+  'gedit-undo-recent-action.page',
+  'index.page',
+  'legal.xml',
+]
+
+gedit_help_media = [
+  'figures/gedit-html-snippet.png',
+  'figures/gedit-icon.png',
+  'figures/gedit3-screenshot.png',
+]
+
+gnome.yelp(
+  package_name,
+  sources: gedit_help_sources,
+  media: gedit_help_media,
+  symlink_media: true,
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 000000000..c04ba6185
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,195 @@
+project(
+  'gedit', 'c',
+  version: '3.31.1',
+  meson_version: '>=0.46.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'))
+pkgincludedir = join_paths(includedir, package_string)
+pkgconfigdir = join_paths(libdir, 'pkgconfig')
+pkglibdir = join_paths(libdir, package_name)
+pkgdatadir = join_paths(datadir, package_name)
+
+dbusdir = join_paths(datadir, 'dbus-1')
+gconfdir = join_paths(datadir, 'GConf')
+glibdir = join_paths(datadir, 'glib-2.0')
+gtkdocdir = join_paths(datadir, 'gtk-doc')
+localdir = join_paths(datadir, 'local')
+vapidir = join_paths(datadir, 'vala', 'vapi')
+
+# Subprojects
+libgd_sp = subproject(
+  'libgd',
+  default_options: [
+    'with-tagged-entry=true',
+    'static=true',
+  ]
+)
+
+# Dependencies
+glib_req = '>= 2.44.0'
+gtk_req = '>= 3.22.0'
+gtksourceview_req = '>= 4.0.2'
+libpeas_req = '>= 1.14.1'
+libxml_req = '>= 2.5.0'
+libsoup_req = '>= 2.60.0'
+gspell_req = '>= 0.2.5'
+pygobject_req = '>= 3.0.0'
+introspection_req = '>= 0.9.3'
+vala_req = '>= 0.25.1'
+gtk_doc_req = '>= 1.0'
+
+glib_dep = dependency('glib-2.0', version: glib_req)
+gobject_dep = dependency('gobject-2.0', version: glib_req)
+gmodule_dep = dependency('gmodule-2.0', version: glib_req)
+gio_dep = dependency('gio-2.0', version: glib_req)
+gdk_dep = dependency('gdk-3.0', version: gtk_req)
+gtk_dep = dependency('gtk+-3.0', version: gtk_req)
+gtksourceview_dep = dependency('gtksourceview-4', version: gtksourceview_req)
+libpeas_dep = dependency('libpeas-1.0', version: libpeas_req)
+libpeas_gtk_dep = dependency('libpeas-gtk-1.0', version: libpeas_req)
+libxml_dep = dependency('libxml-2.0', version: libxml_req)
+
+libgd_dep = libgd_sp.get_variable('libgd_dep')
+
+libsoup_dep = dependency('libsoup-2.4', version: libsoup_req, required: true)
+gspell_dep = dependency('gspell-1', version: gspell_req, required: true)
+x11_dep = dependency('x11', required: false)
+
+introspection_dep = dependency('gobject-introspection-1.0', version: introspection_req, required: false)
+vapigen_dep = dependency('vapigen', version: vala_req, required: false)
+gtk_doc_dep = dependency('gtk-doc', version: gtk_doc_req, required: false)
+
+python3 = python.find_installation('python3')
+
+# Configurations
+windowing_targets = gdk_dep.get_pkgconfig_variable('targets').split()
+if windowing_targets.contains('quartz')
+  windowing_target = 'quartz'
+elif windowing_targets.contains('win32')
+  windowing_target = 'win32'
+else
+  if not x11_dep.found()
+    error('Native dependency \'x11\' not found')
+  else
+    windowing_target = 'x11'
+  endif
+endif
+
+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', localdir)
+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
+build_plugins = get_option('plugins')
+
+generate_gir = get_option('introspection')
+if generate_gir and not introspection_dep.found()
+  generate_gir = false
+endif
+
+generate_vapi = generate_gir and get_option('vapi')
+if generate_vapi and not vapigen_dep.found()
+  generate_vapi = false
+endif
+
+build_gtk_doc = get_option('documentation')
+if build_gtk_doc and not gtk_doc_dep.found()
+  build_gtk_doc = false
+endif
+
+active_plugins = [
+  'docinfo',
+  'modelines',
+  'filebrowser',
+  'spell',
+  'time',
+]
+
+if windowing_target == 'win32'
+  active_plugins += 'checkupdate'
+endif
+
+subdir('data')
+subdir('po')
+
+subdir('gedit')
+if build_plugins == true
+  subdir('plugins')
+endif
+
+subdir('docs')
+subdir('help')
+
+summary = [
+  '',
+  '------',
+  'gedit @0@ (@1@)'.format(version, api_version),
+  '',
+  '  Documentation: @0@'.format(build_gtk_doc),
+  '  Introspection: @0@'.format(generate_gir),
+  '        Plugins: @0@'.format(build_plugins),
+  '       Vala API: @0@'.format(generate_vapi),
+  '',
+  'Directories:',
+  '         prefix: @0@'.format(prefix),
+  '     includedir: @0@'.format(includedir),
+  '         libdir: @0@'.format(libdir),
+  '        datadir: @0@'.format(datadir),
+  '',
+  'Plugins:',
+  '',
+  '------',
+]
+
+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 000000000..9a387f428
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,14 @@
+option('introspection',
+       type: 'boolean', value: true,
+       description: 'Generate introspection data (requires gobject-introspection)')
+option('vapi',
+       type: 'boolean', value: true,
+       description: 'Generate vapi data (requires vapigen)')
+
+option('plugins',
+       type: 'boolean', value: true,
+       description: 'Build core plugins')
+
+option('documentation',
+       type: 'boolean', value: false,
+       description: 'Build reference manual (requires gtk-doc)')
diff --git a/plugins/checkupdate/meson.build b/plugins/checkupdate/meson.build
new file mode 100644
index 000000000..1755357f0
--- /dev/null
+++ b/plugins/checkupdate/meson.build
@@ -0,0 +1,37 @@
+libcheckupdate_sources = files(
+  'gedit-check-update-plugin.c',
+)
+
+libcheckupdate_deps = [
+  libgedit_dep,
+  libsoup_dep,
+]
+
+libcheckupdate_c_args = [
+  '-DHAVE_CONFIG_H',
+]
+
+libcheckupdate_sha = shared_module(
+  'checkupdate',
+  sources: libcheckupdate_sources,
+  include_directories: rootdir,
+  dependencies: libcheckupdate_deps,
+  c_args: libcheckupdate_c_args,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+custom_target(
+  'checkupdate.plugin',
+  input: 'checkupdate.plugin.desktop.in',
+  output: 'checkupdate.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
diff --git a/plugins/docinfo/meson.build b/plugins/docinfo/meson.build
new file mode 100644
index 000000000..14a9cff38
--- /dev/null
+++ b/plugins/docinfo/meson.build
@@ -0,0 +1,38 @@
+libdocinfo_sources = files(
+  'gedit-docinfo-plugin.c',
+)
+
+libdocinfo_deps = [
+  libgedit_dep,
+]
+
+libdocinfo_c_args = [
+  '-DHAVE_CONFIG_H',
+]
+
+subdir('resources')
+
+libdocinfo_sha = shared_module(
+  'docinfo',
+  sources: libdocinfo_sources,
+  include_directories: rootdir,
+  dependencies: libdocinfo_deps,
+  c_args: libdocinfo_c_args,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+custom_target(
+  'docinfo.plugin',
+  input: 'docinfo.plugin.desktop.in',
+  output: 'docinfo.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
diff --git a/plugins/docinfo/resources/meson.build b/plugins/docinfo/resources/meson.build
new file mode 100644
index 000000000..b1f4d4d7d
--- /dev/null
+++ b/plugins/docinfo/resources/meson.build
@@ -0,0 +1,8 @@
+libdocinfo_res = gnome.compile_resources(
+  'gedit-docinfo-resources',
+  'gedit-docinfo.gresource.xml',
+)
+
+libdocinfo_sources += [
+  libdocinfo_res.get(0),
+]
diff --git a/plugins/externaltools/data/meson.build b/plugins/externaltools/data/meson.build
new file mode 100644
index 000000000..54762fa96
--- /dev/null
+++ b/plugins/externaltools/data/meson.build
@@ -0,0 +1,46 @@
+externaltools_tools = [
+  'build',
+  'remove-trailing-spaces',
+  'send-to-fpaste',
+]
+
+if windowing_target == 'quartz'
+  externaltools_tools += [
+    'open-terminal-here-osx',
+  ]
+elif windowing_target != 'win32'
+  externaltools_tools += [
+    'open-terminal-here',
+    'run-command',
+  ]
+endif
+
+foreach tool_name: externaltools_tools
+  dektop_file = custom_target(
+    '@0@.desktop'.format(tool_name),
+    input: '@0  desktop in'.format(tool_name),
+    output: '@0@.desktop'.format(tool_name),
+    command: msgfmt_externaltools_cmd,
+    install: false,
+  )
+
+  custom_target(
+    '@0@.tool'.format(tool_name),
+    input: '@0  tool in'.format(tool_name),
+    output: '@0@'.format(tool_name),
+    depends: dektop_file,
+    command: [
+      merge_tool_prg,
+      '@INPUT@',
+      dektop_file.full_path(),
+    ],
+    capture: true,
+    install: true,
+    install_dir: join_paths(
+      pkgdatadir,
+      'plugins',
+      'externaltools',
+      'tools',
+    )
+  )
+endforeach
diff --git a/plugins/externaltools/meson.build b/plugins/externaltools/meson.build
new file mode 100644
index 000000000..1a2eb0463
--- /dev/null
+++ b/plugins/externaltools/meson.build
@@ -0,0 +1,26 @@
+subdir('scripts')
+subdir('tools')
+subdir('data')
+
+configure_file(
+  input: 'org.gnome.gedit.plugins.externaltools.gschema.xml.in',
+  output: 'org.gnome.gedit.plugins.externaltools.gschema.xml',
+  configuration: gschema_xml,
+  install: true,
+  install_dir: join_paths(
+    glibdir,
+    'schemas',
+  )
+)
+
+custom_target(
+  'externaltools.plugin',
+  input: 'externaltools.plugin.desktop.in',
+  output: 'externaltools.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
diff --git a/plugins/externaltools/scripts/meson.build b/plugins/externaltools/scripts/meson.build
new file mode 100644
index 000000000..c5f50e92c
--- /dev/null
+++ b/plugins/externaltools/scripts/meson.build
@@ -0,0 +1,13 @@
+msgfmt_externaltools_cmd = [
+  find_program('msgfmt'),
+  '--desktop',
+  '--keyword=Name',
+  '--keyword=Comment',
+  '--template=@INPUT@',
+  '-d', join_paths(srcdir, 'po'),
+  '--output=@OUTPUT@'
+]
+
+merge_tool_prg = find_program(
+  files('gedit-tool-merge.pl'),
+)
diff --git a/plugins/externaltools/tools/meson.build b/plugins/externaltools/tools/meson.build
new file mode 100644
index 000000000..bd623cf2d
--- /dev/null
+++ b/plugins/externaltools/tools/meson.build
@@ -0,0 +1,36 @@
+externaltools_sources = files(
+  '__init__.py',
+  'appactivatable.py',
+  'capture.py',
+  'filelookup.py',
+  'functions.py',
+  'library.py',
+  'linkparsing.py',
+  'manager.py',
+  'outputpanel.py',
+  'windowactivatable.py',
+)
+
+install_data(
+  externaltools_sources,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+    'externaltools',
+  )
+)
+
+externaltools_data = files(
+  'outputpanel.ui',
+  'tools.ui',
+)
+
+install_data(
+  externaltools_data,
+  install_dir: join_paths(
+    pkgdatadir,
+    'plugins',
+    'externaltools',
+    'ui',
+  )
+)
diff --git a/plugins/filebrowser/meson.build b/plugins/filebrowser/meson.build
new file mode 100644
index 000000000..081e854d0
--- /dev/null
+++ b/plugins/filebrowser/meson.build
@@ -0,0 +1,102 @@
+libfilebrowser_public_h = files(
+  'gedit-file-bookmarks-store.h',
+  'gedit-file-browser-error.h',
+  'gedit-file-browser-store.h',
+  'gedit-file-browser-view.h',
+  'gedit-file-browser-widget.h',
+  'gedit-file-browser-utils.h',
+  'gedit-file-browser-plugin.h',
+  'gedit-file-browser-messages.h',
+)
+
+libfilebrowser_sources = files(
+  'gedit-file-bookmarks-store.c',
+  'gedit-file-browser-messages.c',
+  'gedit-file-browser-plugin.c',
+  'gedit-file-browser-store.c',
+  'gedit-file-browser-utils.c',
+  'gedit-file-browser-view.c',
+  'gedit-file-browser-widget.c',
+)
+
+libfilebrowser_deps = [
+  libgedit_dep,
+]
+
+libfilebrowser_c_args = [
+  '-DHAVE_CONFIG_H',
+]
+
+subdir('messages')
+
+libfilebrowser_enums = gnome.mkenums(
+  'gedit-file-browser-enum-types',
+  sources: libfilebrowser_public_h,
+  h_template: 'gedit-file-browser-enum-types.h.template',
+  c_template: 'gedit-file-browser-enum-types.c.template',
+)
+
+libfilebrowser_sources += [
+  libfilebrowser_enums.get(0),
+]
+
+subdir('resources')
+
+libfilebrowser_sha = shared_module(
+  'filebrowser',
+  sources: libfilebrowser_sources,
+  include_directories: rootdir,
+  dependencies: libfilebrowser_deps,
+  c_args: libfilebrowser_c_args,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+# FIXME: https://github.com/mesonbuild/meson/issues/1687
+custom_target(
+  'org.gnome.gedit.plugins.filebrowser.enums.xml',
+  input : libfilebrowser_sources + libfilebrowser_public_h,
+  output: 'org.gnome.gedit.plugins.filebrowser.enums.xml',
+  capture: true,
+  command: [
+    'glib-mkenums',
+    '--comments', '<!-- @comment@ -->',
+    '--fhead', '<schemalist>',
+    '--vhead', '  <@type@ id="org.gnome.gedit.plugins.filebrowser.@EnumName@">',
+    '--vprod', '    <value nick="@valuenick@" value="@valuenum@"/>',
+    '--vtail', '  </@type@>',
+    '--ftail', '</schemalist>',
+    '@INPUT@'
+  ],
+  install: true,
+  install_dir: join_paths(
+    glibdir,
+    'schemas',
+  )
+)
+
+configure_file(
+  input: 'org.gnome.gedit.plugins.filebrowser.gschema.xml.in',
+  output: 'org.gnome.gedit.plugins.filebrowser.gschema.xml',
+  configuration: gschema_xml,
+  install: true,
+  install_dir: join_paths(
+    glibdir,
+    'schemas',
+  )
+)
+
+custom_target(
+  'filebrowser.plugin',
+  input: 'filebrowser.plugin.desktop.in',
+  output: 'filebrowser.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
diff --git a/plugins/filebrowser/messages/meson.build b/plugins/filebrowser/messages/meson.build
new file mode 100644
index 000000000..ec4fb8464
--- /dev/null
+++ b/plugins/filebrowser/messages/meson.build
@@ -0,0 +1,25 @@
+libfilebrowser_public_h += files(
+  'gedit-file-browser-message-activation.h',
+  'gedit-file-browser-message-add-filter.h',
+  'gedit-file-browser-message-extend-context-menu.h',
+  'gedit-file-browser-message-get-root.h',
+  'gedit-file-browser-message-get-view.h',
+  'gedit-file-browser-message-id.h',
+  'gedit-file-browser-message-id-location.h',
+  'gedit-file-browser-message-set-emblem.h',
+  'gedit-file-browser-message-set-markup.h',
+  'gedit-file-browser-message-set-root.h',
+)
+
+libfilebrowser_sources += files(
+  'gedit-file-browser-message-activation.c',
+  'gedit-file-browser-message-add-filter.c',
+  'gedit-file-browser-message-extend-context-menu.c',
+  'gedit-file-browser-message-get-root.c',
+  'gedit-file-browser-message-get-view.c',
+  'gedit-file-browser-message-id.c',
+  'gedit-file-browser-message-id-location.c',
+  'gedit-file-browser-message-set-emblem.c',
+  'gedit-file-browser-message-set-markup.c',
+  'gedit-file-browser-message-set-root.c',
+)
diff --git a/plugins/filebrowser/resources/meson.build b/plugins/filebrowser/resources/meson.build
new file mode 100644
index 000000000..da2b57744
--- /dev/null
+++ b/plugins/filebrowser/resources/meson.build
@@ -0,0 +1,8 @@
+libfilebrowser_res = gnome.compile_resources(
+  'gedit-file-browser-resources',
+  'gedit-file-browser.gresource.xml',
+)
+
+libfilebrowser_sources += [
+  libfilebrowser_res.get(0),
+]
diff --git a/plugins/meson.build b/plugins/meson.build
new file mode 100644
index 000000000..af94ab775
--- /dev/null
+++ b/plugins/meson.build
@@ -0,0 +1,25 @@
+msgfmt_plugin_cmd = [
+  find_program('msgfmt'),
+  '--desktop',
+  '--keyword=Name',
+  '--keyword=Description',
+  '--template=@INPUT@',
+  '-d', join_paths(srcdir, 'po'),
+  '--output=@OUTPUT@'
+]
+
+if windowing_target == 'win32'
+  subdir('checkupdate')
+endif
+
+subdir('docinfo')
+subdir('externaltools')
+subdir('filebrowser')
+subdir('modelines')
+subdir('pythonconsole')
+subdir('quickhighlight')
+subdir('quickopen')
+subdir('snippets')
+subdir('sort')
+subdir('spell')
+subdir('time')
diff --git a/plugins/modelines/meson.build b/plugins/modelines/meson.build
new file mode 100644
index 000000000..380115062
--- /dev/null
+++ b/plugins/modelines/meson.build
@@ -0,0 +1,46 @@
+libmodelines_sources = files(
+  'gedit-modeline-plugin.c',
+  'modeline-parser.c',
+)
+
+libmodelines_deps = [
+  libgedit_dep,
+]
+
+libmodelines_c_args = [
+  '-DHAVE_CONFIG_H',
+]
+
+libmodelines_sha = shared_module(
+  'modelines',
+  sources: libmodelines_sources,
+  include_directories: rootdir,
+  dependencies: libmodelines_deps,
+  c_args: libmodelines_c_args,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+custom_target(
+  'modelines.plugin',
+  input: 'modelines.plugin.desktop.in',
+  output: 'modelines.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+install_data(
+  'language-mappings',
+  install_dir: join_paths(
+    pkgdatadir,
+    'plugins',
+    'modelines',
+  )
+)
diff --git a/plugins/pythonconsole/meson.build b/plugins/pythonconsole/meson.build
new file mode 100644
index 000000000..0e4b1a5cb
--- /dev/null
+++ b/plugins/pythonconsole/meson.build
@@ -0,0 +1,24 @@
+subdir('pythonconsole')
+
+configure_file(
+  input: 'org.gnome.gedit.plugins.pythonconsole.gschema.xml.in',
+  output: 'org.gnome.gedit.plugins.pythonconsole.gschema.xml',
+  configuration: gschema_xml,
+  install: true,
+  install_dir: join_paths(
+    glibdir,
+    'schemas',
+  )
+)
+
+custom_target(
+  'pythonconsole.plugin',
+  input: 'pythonconsole.plugin.desktop.in',
+  output: 'pythonconsole.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
diff --git a/plugins/pythonconsole/pythonconsole/meson.build b/plugins/pythonconsole/pythonconsole/meson.build
new file mode 100644
index 000000000..6bae3880a
--- /dev/null
+++ b/plugins/pythonconsole/pythonconsole/meson.build
@@ -0,0 +1,24 @@
+pythonconsole_sources = files(
+  '__init__.py',
+  'config.py',
+  'console.py',
+)
+
+install_data(
+  pythonconsole_sources,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+    'pythonconsole',
+  )
+)
+
+install_data(
+  'config.ui',
+  install_dir: join_paths(
+    pkgdatadir,
+    'plugins',
+    'pythonconsole',
+    'ui',
+  )
+)
diff --git a/plugins/quickhighlight/meson.build b/plugins/quickhighlight/meson.build
new file mode 100644
index 000000000..2be303cd3
--- /dev/null
+++ b/plugins/quickhighlight/meson.build
@@ -0,0 +1,36 @@
+libquickhighlight_sources = files(
+  'gedit-quick-highlight-plugin.c',
+)
+
+libquickhighlight_deps = [
+  libgedit_dep,
+]
+
+libquickhighlight_c_args = [
+  '-DHAVE_CONFIG_H',
+]
+
+libquickhighlight_sha = shared_module(
+  'quickhighlight',
+  sources: libquickhighlight_sources,
+  include_directories: rootdir,
+  dependencies: libquickhighlight_deps,
+  c_args: libquickhighlight_c_args,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+custom_target(
+  'quickhighlight.plugin',
+  input: 'quickhighlight.plugin.desktop.in',
+  output: 'quickhighlight.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
diff --git a/plugins/quickopen/meson.build b/plugins/quickopen/meson.build
new file mode 100644
index 000000000..c5a268055
--- /dev/null
+++ b/plugins/quickopen/meson.build
@@ -0,0 +1,19 @@
+install_subdir(
+  'quickopen',
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+custom_target(
+  'quickopen.plugin',
+  input: 'quickopen.plugin.desktop.in',
+  output: 'quickopen.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
diff --git a/plugins/snippets/meson.build b/plugins/snippets/meson.build
new file mode 100644
index 000000000..91401d13e
--- /dev/null
+++ b/plugins/snippets/meson.build
@@ -0,0 +1,23 @@
+subdir('snippets')
+
+install_subdir(
+  'data',
+  strip_directory : true,
+  install_dir: join_paths(
+    pkgdatadir,
+    'plugins',
+    'snippets',
+  )
+)
+
+custom_target(
+  'snippets.plugin',
+  input: 'snippets.plugin.desktop.in',
+  output: 'snippets.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
diff --git a/plugins/snippets/snippets/meson.build b/plugins/snippets/snippets/meson.build
new file mode 100644
index 000000000..1ca34de28
--- /dev/null
+++ b/plugins/snippets/snippets/meson.build
@@ -0,0 +1,39 @@
+snippets_sources = [
+  '__init__.py',
+  'appactivatable.py',
+  'completion.py',
+  'document.py',
+  'exporter.py',
+  'helper.py',
+  'importer.py',
+  'languagemanager.py',
+  'library.py',
+  'manager.py',
+  'parser.py',
+  'placeholder.py',
+  'shareddata.py',
+  'signals.py',
+  'singleton.py',
+  'snippet.py',
+  'substitutionparser.py',
+  'windowactivatable.py',
+]
+
+install_data(
+  snippets_sources,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+    'snippets',
+  )
+)
+
+install_data(
+  'snippets.ui',
+  install_dir: join_paths(
+    pkgdatadir,
+    'plugins',
+    'snippets',
+    'ui',
+  )
+)
diff --git a/plugins/sort/meson.build b/plugins/sort/meson.build
new file mode 100644
index 000000000..64063ac8e
--- /dev/null
+++ b/plugins/sort/meson.build
@@ -0,0 +1,38 @@
+libsort_sources = files(
+  'gedit-sort-plugin.c',
+)
+
+libsort_deps = [
+  libgedit_dep,
+]
+
+libsort_c_args = [
+  '-DHAVE_CONFIG_H',
+]
+
+subdir('resources')
+
+libsort_sha = shared_module(
+  'sort',
+  sources: libsort_sources,
+  include_directories: rootdir,
+  dependencies: libsort_deps,
+  c_args: libsort_c_args,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+custom_target(
+  'sort.plugin',
+  input: 'sort.plugin.desktop.in',
+  output: 'sort.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
diff --git a/plugins/sort/resources/meson.build b/plugins/sort/resources/meson.build
new file mode 100644
index 000000000..71787618e
--- /dev/null
+++ b/plugins/sort/resources/meson.build
@@ -0,0 +1,8 @@
+libsort_res = gnome.compile_resources(
+  'gedit-sort-resources',
+  'gedit-sort.gresource.xml',
+)
+
+libsort_sources += [
+  libsort_res.get(0),
+]
diff --git a/plugins/spell/meson.build b/plugins/spell/meson.build
new file mode 100644
index 000000000..f9c4f6c13
--- /dev/null
+++ b/plugins/spell/meson.build
@@ -0,0 +1,38 @@
+libspell_sources = files(
+  'gedit-spell-app-activatable.c',
+  'gedit-spell-plugin.c',
+)
+
+libspell_deps = [
+  libgedit_dep,
+  gspell_dep,
+]
+
+libspell_c_args = [
+  '-DHAVE_CONFIG_H',
+]
+
+libspell_sha = shared_module(
+  'spell',
+  sources: libspell_sources,
+  include_directories: rootdir,
+  dependencies: libspell_deps,
+  c_args: libspell_c_args,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+custom_target(
+  'spell.plugin',
+  input: 'spell.plugin.desktop.in',
+  output: 'spell.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
diff --git a/plugins/time/meson.build b/plugins/time/meson.build
new file mode 100644
index 000000000..36fdeb667
--- /dev/null
+++ b/plugins/time/meson.build
@@ -0,0 +1,65 @@
+libtime_sources = files(
+  'gedit-time-plugin.c',
+)
+
+libtime_deps = [
+  libgedit_dep,
+]
+
+libtime_c_args = [
+  '-DHAVE_CONFIG_H',
+]
+
+gnome.mkenums(
+  'org.gnome.gedit.plugins.time.enums.xml',
+  sources: libtime_sources,
+  comments: '<!-- @comment@ -->',
+  fhead: '<schemalist>',
+  vhead: '  <@type@ id="org.gnome.gedit.plugins.time.@EnumName@">',
+  vprod: '    <value nick="@valuenick@" value="@valuenum@"/>',
+  vtail: '  </@type@>',
+  ftail: '</schemalist>',
+  install_header: true,
+  install_dir: join_paths(
+    glibdir,
+    'schemas',
+  )
+)
+
+subdir('resources')
+
+libtime_sha = shared_module(
+  'time',
+  sources: libtime_sources,
+  include_directories: rootdir,
+  dependencies: libtime_deps,
+  c_args: libtime_c_args,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+configure_file(
+  input: 'org.gnome.gedit.plugins.time.gschema.xml.in',
+  output: 'org.gnome.gedit.plugins.time.gschema.xml',
+  configuration: gschema_xml,
+  install: true,
+  install_dir: join_paths(
+    glibdir,
+    'schemas',
+  )
+)
+
+custom_target(
+  'time.plugin',
+  input: 'time.plugin.desktop.in',
+  output: 'time.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
diff --git a/plugins/time/resources/meson.build b/plugins/time/resources/meson.build
new file mode 100644
index 000000000..bcf037298
--- /dev/null
+++ b/plugins/time/resources/meson.build
@@ -0,0 +1,8 @@
+libtime_res = gnome.compile_resources(
+  'gedit-time-resources',
+  'gedit-time.gresource.xml',
+)
+
+libtime_sources += [
+  libtime_res.get(0),
+]
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 000000000..0e5cd0b08
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,7 @@
+i18n.gettext(
+  package_name,
+  preset: 'glib',
+  args: [
+    '--keyword=Description',
+  ]
+)
diff --git a/subprojects/libgd.wrap b/subprojects/libgd.wrap
new file mode 100644
index 000000000..943c1c4ac
--- /dev/null
+++ b/subprojects/libgd.wrap
@@ -0,0 +1,4 @@
+[wrap-git]
+directory=libgd
+url=https://gitlab.gnome.org/GNOME/libgd.git
+revision=head



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