[gedit-latex] Build with meson instead of autotools.



commit 2078c734c657dd8d76a40552854cf76372cbdcf2
Author: Jose Aliste <jose aliste gmail com>
Date:   Fri Apr 17 17:00:40 2020 -0400

    Build with meson instead of autotools.

 autogen.sh                                         |  26 ---
 build-aux/meson/post_install.py                    |  24 ++
 configure.ac                                       | 101 --------
 data/Makefile.am                                   |  24 --
 data/icons/Makefile.am                             | 253 ---------------------
 data/templates/Makefile.am                         |   9 -
 data/ui/Makefile.am                                |  20 --
 latex/gldefs.py.in => gldefs.py.in                 |   0
 latex.plugin.desktop.in.in                         |   4 +-
 latex/Makefile.am                                  |  33 ---
 latex/bibtex/Makefile.am                           |  15 --
 latex/latex/Makefile.am                            |  21 --
 latex/preferences/Makefile.am                      |   8 -
 latex/tools/Makefile.am                            |   9 -
 latex/util/Makefile.am                             |   8 -
 meson.build                                        | 131 +++++++++++
 ...in => org.gnome.gedit.plugins.latex.gschema.xml |  30 +--
 po/meson.build                                     |   7 +
 18 files changed, 179 insertions(+), 544 deletions(-)
---
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/latex/gldefs.py.in b/gldefs.py.in
similarity index 100%
rename from latex/gldefs.py.in
rename to gldefs.py.in
diff --git a/latex.plugin.desktop.in.in b/latex.plugin.desktop.in.in
index 91a8686..f35e5a4 100644
--- a/latex.plugin.desktop.in.in
+++ b/latex.plugin.desktop.in.in
@@ -2,8 +2,8 @@
 Module=latex
 IAge=3
 Loader=python3
-_Name=LaTeX Plugin
-_Description=A plugin that assists you in handling LaTeX documents and BibTeX bibliographies
+Name=LaTeX Plugin
+Description=A plugin that assists you in handling LaTeX documents and BibTeX bibliographies
 Authors=Michael Zeising <michael michaels-website de>
 Copyright=Copyright (c) 2010 Michael Zeising
 Website=https://wiki.gnome.org/Apps/Gedit/LaTeXPlugin
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..582df05
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,131 @@
+project(
+  'gedit-latex', 'c', # vala is added below if needed, with add_languages().
+  version: '3.36.2',
+  meson_version: '>= 0.50'
+)
+
+gnome = import('gnome')
+i18n = import('i18n')
+pkg = import('pkgconfig')
+python = import('python')
+
+# Paths
+root_include_dir = include_directories('.')
+
+srcdir = meson.current_source_dir()
+
+libdir = join_paths(get_option('prefix'), get_option('libdir'))
+datadir = join_paths(get_option('prefix'), get_option('datadir'))
+
+pkglibdir = join_paths(libdir, 'gedit')
+pkgdatadir = join_paths(datadir, 'gedit','plugins','latex')
+
+appstreamdir = join_paths(datadir, 'metainfo')
+glibdir = join_paths(datadir, 'glib-2.0')
+localedir = join_paths(datadir, 'locale')
+
+# Dependencies in common for all plugins
+libpeas_dep = dependency('libpeas-1.0', version: '>= 1.14.1')
+gedit_dep = dependency('gedit', version: '>= 3.36')
+
+appstream_util = find_program('appstream-util', required: false)
+python3 = python.find_installation('python3')
+
+# config.h
+config_h = configuration_data()
+config_h.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+
+configure_file(
+  output: 'config.h',
+  configuration: config_h
+)
+
+# latex.plugin
+plugin_in = configuration_data()
+plugin_in.set('VERSION', meson.project_version())
+latex_plugin_in = configure_file(
+  input: 'latex.plugin.desktop.in.in',
+  output: 'latex.plugin.desktop.in',
+  configuration: plugin_in,
+  install: false,
+)
+
+msgfmt_plugin_cmd = [
+  find_program('msgfmt'),
+  '--desktop',
+  '--keyword=Name',
+  '--keyword=Description',
+  '--template=@INPUT@',
+  '-d', join_paths(srcdir, 'po'),
+  '--output=@OUTPUT@'
+]
+
+
+latex_plugin = custom_target(
+  'latex.plugin',
+  input: latex_plugin_in,
+  output: 'latex.plugin',
+  command: msgfmt_plugin_cmd,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+gpdefs_py = configuration_data()
+gpdefs_py.set('GETTEXT_PACKAGE', meson.project_name())
+
+configure_file(
+  input: 'gldefs.py.in',
+  output: 'gldefs.py',
+  configuration: gpdefs_py,
+  install: true,
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+    'latex',
+  )
+)
+
+subdir('po')
+
+install_subdir(
+  'data',
+  install_dir: pkgdatadir,
+  strip_directory: true,
+)
+
+install_subdir(
+  'latex',
+  install_dir: join_paths(
+    pkglibdir,
+    'plugins',
+  )
+)
+
+install_data(
+  'org.gnome.gedit.plugins.latex.gschema.xml',
+  install_dir: join_paths(
+    glibdir,
+    'schemas',
+  )
+)
+meson.add_install_script(
+  'build-aux/meson/post_install.py',
+  libdir,
+  datadir
+)
+
+
+# Summary message
+
+summary = [
+  'Configuration:',
+  '',
+  '        gedit-latex version @0@'.format(meson.project_version()),
+  '',
+  '        Prefix: @0@'.format(get_option('prefix')),
+]
+
+message('\n'.join(summary))
diff --git a/data/org.gnome.gedit.plugins.latex.gschema.xml.in.in b/org.gnome.gedit.plugins.latex.gschema.xml
similarity index 67%
rename from data/org.gnome.gedit.plugins.latex.gschema.xml.in.in
rename to org.gnome.gedit.plugins.latex.gschema.xml
index d73650f..e8f03d3 100644
--- a/data/org.gnome.gedit.plugins.latex.gschema.xml.in.in
+++ b/org.gnome.gedit.plugins.latex.gschema.xml
@@ -4,65 +4,65 @@
     <value nick='combined' value='1'/>
     <value nick='disabled' value='2'/>
   </enum>
-  <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.gedit.plugins.latex" 
path="/org/gnome/gedit/plugins/latex/">
+  <schema gettext-domain="gedit-plugins" id="org.gnome.gedit.plugins.latex" 
path="/org/gnome/gedit/plugins/latex/">
     <key name="maximum-bibtex-size" type="i">
       <default>500</default>
-      <_summary>Maximum BibTeX Size</_summary>
+      <summary>Maximum BibTeX Size</summary>
     </key>
     <key name="bibtex-outline-grouping" type="i">
       <default>1</default>
     </key>
     <key name="outline-connect-to-editor" type="b">
       <default>true</default>
-      <_summary>Connect Outline to Editor</_summary>
+      <summary>Connect Outline to Editor</summary>
     </key>
     <key name="outline-show-labels" type="b">
       <default>false</default>
-      <_summary>Show Labels in Outline</_summary>
+      <summary>Show Labels in Outline</summary>
     </key>
     <key name="outline-show-tables" type="b">
       <default>true</default>
-      <_summary>Show Tables in Outline</_summary>
+      <summary>Show Tables in Outline</summary>
     </key>
     <key name="outline-show-graphics" type="b">
       <default>true</default>
-      <_summary>Show Graphics in Outline</_summary>
+      <summary>Show Graphics in Outline</summary>
     </key>
     <key name="issues-show-warnings" type="b">
       <default>true</default>
-      <_summary>Show Warnings in Issues</_summary>
+      <summary>Show Warnings in Issues</summary>
     </key>
     <key name="issues-show-tasks" type="b">
       <default>true</default>
-      <_summary>Show Tasks in Issues</_summary>
+      <summary>Show Tasks in Issues</summary>
     </key>
     <key name="hide-box-warnings" type="b">
       <default>false</default>
-      <_summary>Hide Box Warnings</_summary>
+      <summary>Hide Box Warnings</summary>
     </key>
    <key name="toolbar-mode" enum="org.gnome.gedit.plugins.latex.ToolbarMode">
       <default>'combined'</default>
-      <_summary>Show LaTeX Toolbar below (normal), combined with the main toolbar, or disabled</_summary>
+      <summary>Show LaTeX Toolbar below (normal), combined with the main toolbar, or disabled</summary>
     </key>
     <key name="expanded-symbol-groups" type="s">
       <default>'Greek,Operators,Arrows,Special'</default>
-      <_summary>Expanded Symbol Groups</_summary>
+      <summary>Expanded Symbol Groups</summary>
     </key>
     <key name="latex-extensions" type="s">
       <default>'.tex,.sty,.Rnw'</default>
-      <_summary>LaTeX Extensions</_summary>
+      <summary>LaTeX Extensions</summary>
     </key>
     <key name="graphics-extensions" type="s">
       <default>'.eps,.pdf,.jpg,.jpeg,.gif,.png'</default>
-      <_summary>Graphics File Extensions</_summary>
+      <summary>Graphics File Extensions</summary>
     </key>
     <key name="graphics-paths" type="s">
       <default>'.'</default>
-      <_summary>Paths Relative to .tex File to Look for Graphics</_summary>
+      <summary>Paths Relative to .tex File to Look for Graphics</summary>
     </key>
     <key name="extra-issue-commands" type="s">
       <default>'fxnote'</default>
-      <_summary>Extra LaTeX commands used to mark issues, such as \fxnote{foo}</_summary>
+      <summary>Extra LaTeX commands used to mark issues, such as \fxnote{foo}</summary>
     </key>
 
     <key name="light-foreground-color" type="s">
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..75c9c97
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,7 @@
+i18n.gettext(
+  meson.project_name(),
+  preset: 'glib',
+  args: [
+    '--keyword=Description',
+  ]
+)


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