[mousetweaks/wip/ernestask/meson] Port to Meson



commit a3c172fe1efb1b4339049e30aeac17f52ce3f232
Author: Ernestas Kulik <ernestask gnome org>
Date:   Sat Aug 12 15:47:03 2017 +0300

    Port to Meson

 Makefile.am                               |   48 -------
 autogen.sh                                |   25 ----
 config.h.meson                            |    2 +
 configure.ac                              |   75 -----------
 data/Makefile.am                          |   24 ----
 data/meson.build                          |   14 ++
 data/org.gnome.mousetweaks.gschema.xml.in |   12 +-
 git.mk                                    |  196 -----------------------------
 man/Makefile.am                           |    5 -
 man/meson.build                           |    1 +
 meson.build                               |   35 +++++
 meson_post_install.py                     |   12 ++
 pixmaps/Makefile.am                       |   10 --
 pixmaps/meson.build                       |    9 ++
 po/Makevars                               |   78 ++++++++++++
 po/{POTFILES.in => POTFILES}              |    1 -
 po/meson.build                            |    1 +
 src/Makefile.am                           |   66 ----------
 src/meson.build                           |   59 +++++++++
 19 files changed, 217 insertions(+), 456 deletions(-)
---
diff --git a/config.h.meson b/config.h.meson
new file mode 100644
index 0000000..e9e8040
--- /dev/null
+++ b/config.h.meson
@@ -0,0 +1,2 @@
+#mesondefine GETTEXT_PACKAGE
+#mesondefine GNOMELOCALEDIR
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..5484232
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,14 @@
+po_dir = join_paths(meson.source_root(), 'po')
+
+i18n.merge_file('gsettings-schemas',
+  input: 'org.gnome.mousetweaks.gschema.xml.in',
+  output: 'org.gnome.mousetweaks.gschema.xml',
+  install: true,
+  install_dir: schemadir,
+  po_dir: po_dir)
+
+install_data('mousetweaks.ui',
+  install_dir: join_paths(datadir, 'mousetweaks'))
+
+install_data('mousetweaks.convert',
+  install_dir: join_paths(datadir, 'GConf', 'gsettings'))
diff --git a/data/org.gnome.mousetweaks.gschema.xml.in b/data/org.gnome.mousetweaks.gschema.xml.in
index 50edbaf..e932f94 100644
--- a/data/org.gnome.mousetweaks.gschema.xml.in
+++ b/data/org.gnome.mousetweaks.gschema.xml.in
@@ -2,18 +2,18 @@
   <schema id="org.gnome.mousetweaks" path="/org/gnome/desktop/a11y/mouse/" gettext-domain="mousetweaks">
     <key name="click-type-window-style" enum="org.gnome.mousetweaks.MtClickTypeWindowStyle">
       <default>'both'</default>
-      <_summary>Click-type window style</_summary>
-      <_description>Button style of the click-type window.</_description>
+      <summary>Click-type window style</summary>
+      <description>Button style of the click-type window.</description>
     </key>
     <key name="click-type-window-orientation" enum="org.gnome.mousetweaks.MtClickTypeWindowOrientation">
       <default>'vertical'</default>
-      <_summary>Click-type window orientation</_summary>
-      <_description>Orientation of the click-type window.</_description>
+      <summary>Click-type window orientation</summary>
+      <description>Orientation of the click-type window.</description>
     </key>
     <key name="click-type-window-geometry" type="s">
       <default>''</default>
-      <_summary>Click-type window geometry</_summary>
-      <_description>Size and position of the click-type window. The format is a standard X Window System 
geometry string.</_description>
+      <summary>Click-type window geometry</summary>
+      <description>Size and position of the click-type window. The format is a standard X Window System 
geometry string.</description>
     </key>
   </schema>
 </schemalist>
diff --git a/man/meson.build b/man/meson.build
new file mode 100644
index 0000000..82720bf
--- /dev/null
+++ b/man/meson.build
@@ -0,0 +1 @@
+install_man('mousetweaks.1')
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..7126b96
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,35 @@
+project('mousetweaks', 'c',
+  version: '3.12.0',
+  license: 'GPL3+')
+
+datadir = get_option('datadir')
+localedir = get_option('localedir')
+schemadir = join_paths(datadir, 'glib-2.0', 'schemas')
+
+configinc = include_directories('.')
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+gtk = dependency('gtk+-3.0', version: '>= 3.0.0')
+x11 = dependency('x11')
+xcursor = dependency('xcursor')
+xfixes = dependency('xfixes')
+xtst = dependency('xtst')
+
+mousetweaks_conf = configuration_data()
+
+mousetweaks_conf.set_quoted('GETTEXT_PACKAGE', 'mousetweaks')
+mousetweaks_conf.set_quoted('GNOMELOCALEDIR', localedir)
+
+configure_file(input: 'config.h.meson',
+  output: 'config.h',
+  configuration: mousetweaks_conf)
+
+subdir('data')
+subdir('man')
+subdir('pixmaps')
+subdir('po')
+subdir('src')
+
+meson.add_install_script('meson_post_install.py')
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 0000000..1823b90
--- /dev/null
+++ b/meson_post_install.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+
+prefix = os.environ['MESON_INSTALL_PREFIX']
+datadir = os.path.join(prefix, 'share')
+schemadir = os.path.join(datadir, 'glib-2.0', 'schemas')
+
+if 'DESTDIR' not in os.environ:
+    print('Compiling GSettings schemas...')
+    subprocess.call(['glib-compile-schemas', schemadir])
diff --git a/pixmaps/meson.build b/pixmaps/meson.build
new file mode 100644
index 0000000..a94a3d4
--- /dev/null
+++ b/pixmaps/meson.build
@@ -0,0 +1,9 @@
+mousetweak_pixmaps = [
+  'single-click.png',
+  'double-click.png',
+  'drag-click.png',
+  'right-click.png'
+]
+
+install_data(mousetweak_pixmaps,
+  install_dir: join_paths(datadir, 'mousetweaks'))
diff --git a/po/Makevars b/po/Makevars
new file mode 100644
index 0000000..c7ca2d4
--- /dev/null
+++ b/po/Makevars
@@ -0,0 +1,78 @@
+# Makefile variables for PO directory in any package using GNU gettext.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = $(PACKAGE)
+
+# These two variables depend on the location of this directory.
+subdir = po
+top_builddir = ..
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = --from-code=UTF-8 --keyword=_ --keyword=N_ --add-comments
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
+# package.  (Note that the msgstr strings, extracted from the package's
+# sources, belong to the copyright holder of the package.)  Translators are
+# expected to transfer the copyright for their translations to this person
+# or entity, or to disclaim their copyright.  The empty string stands for
+# the public domain; in this case the translators are expected to disclaim
+# their copyright.
+COPYRIGHT_HOLDER = mousetweaks translators
+
+# This tells whether or not to prepend "GNU " prefix to the package
+# name that gets inserted into the header of the $(DOMAIN).pot file.
+# Possible values are "yes", "no", or empty.  If it is empty, try to
+# detect it automatically by scanning the files in $(top_srcdir) for
+# "GNU packagename" string.
+PACKAGE_GNU = no
+
+# This is the email address or URL to which the translators shall report
+# bugs in the untranslated strings:
+# - Strings which are not entire sentences, see the maintainer guidelines
+#   in the GNU gettext documentation, section 'Preparing Strings'.
+# - Strings which use unclear terms or require additional context to be
+#   understood.
+# - Strings which make invalid assumptions about notation of date, time or
+#   money.
+# - Pluralisation problems.
+# - Incorrect English spelling.
+# - Incorrect formatting.
+# It can be your email address, or a mailing list address where translators
+# can write to without being subscribed, or the URL of a web page through
+# which the translators can contact you.
+MSGID_BUGS_ADDRESS =
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used.  It is usually empty.
+EXTRA_LOCALE_CATEGORIES =
+
+# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
+# context.  Possible values are "yes" and "no".  Set this to yes if the
+# package uses functions taking also a message context, like pgettext(), or
+# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
+USE_MSGCTXT = no
+
+# These options get passed to msgmerge.
+# Useful options are in particular:
+#   --previous            to keep previous msgids of translated messages,
+#   --quiet               to reduce the verbosity.
+MSGMERGE_OPTIONS =
+
+# These options get passed to msginit.
+# If you want to disable line wrapping when writing PO files, add
+# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and
+# MSGINIT_OPTIONS.
+MSGINIT_OPTIONS =
+
+# This tells whether or not to regenerate a PO file when $(DOMAIN).pot
+# has changed.  Possible values are "yes" and "no".  Set this to no if
+# the POT file is checked in the repository and the version control
+# program ignores timestamps.
+PO_DEPENDS_ON_POT = no
+
+# This tells whether or not to forcibly update $(DOMAIN).pot and
+# regenerate PO files on "make dist".  Possible values are "yes" and
+# "no".  Set this to no if the POT file and PO files are maintained
+# externally.
+DIST_DEPENDS_ON_UPDATE_PO = no
diff --git a/po/POTFILES.in b/po/POTFILES
similarity index 67%
rename from po/POTFILES.in
rename to po/POTFILES
index 9cffe02..9936c67 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES
@@ -1,4 +1,3 @@
-[type: gettext/glade]data/mousetweaks.ui
 data/org.gnome.mousetweaks.gschema.xml.in
 src/mt-main.c
 src/mt-ctw.c
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..274bda0
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('mousetweaks')
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..22d54ef
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,59 @@
+mousetweaks_enums = gnome.mkenums('mousetweaks-enum-types',
+  sources: ['mt-common.h'],
+  c_template: 'mt-enum-types.c.template',
+  h_template: 'mt-enum-types.h.template',
+  install_dir: schemadir)
+
+# https://github.com/mesonbuild/meson/issues/1687
+custom_target('mousetweaks-enums',
+  input: ['mt-common.h'],
+  output: ['org.gnome.mousetweaks.enums.xml'],
+  command: [
+    'glib-mkenums',
+    '--comments', '<!-- @comment@ -->',
+    '--fhead', '<schemalist>',
+    '--vhead', '  <@type@ id=\'org.gnome.mousetweaks.@EnumName@\'>',
+    '--vprod', '    <value nick=\'@valuenick@\' value=\'@valuenum@\'/>',
+    '--vtail', '  </@type@>',
+    '--ftail', '</schemalist>',
+    '@INPUT@'
+  ],
+  install: true,
+  install_dir: schemadir,
+  capture: true)
+
+mousetweaks_sources = [
+  mousetweaks_enums,
+  'mt-main.c',
+  'mt-common.c',
+  'mt-common.h',
+  'mt-pidfile.c',
+  'mt-pidfile.h',
+  'mt-service.c',
+  'mt-service.h',
+  'mt-ctw.c',
+  'mt-ctw.h',
+  'mt-timer.c',
+  'mt-timer.h',
+  'mt-cursor.c',
+  'mt-cursor.h',
+  'mt-cursor-manager.c',
+  'mt-cursor-manager.h',
+  'mt-listener.c',
+  'mt-listener.h',
+  'mt-sig-handler.c',
+  'mt-sig-handler.h',
+  'mt-settings.c',
+  'mt-settings.h'
+]
+
+mousetweaks_c_args = [
+  '-DDATADIR="@0@"'.format(join_paths(datadir, 'mousetweaks')),
+  '-DHAVE_CONFIG_H=1'
+]
+
+mousetweaks = executable('mousetweaks', mousetweaks_sources,
+  dependencies: [gtk, x11, xcursor, xfixes, xtst],
+  c_args: [mousetweaks_c_args],
+  include_directories: [configinc],
+  install: true)


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