[gtranslator: 1/2] Port to meson build system



commit 8a7d122e019866a96d05a639fce26e6552de6956
Author: Daniel García Moreno <danigm wadobo com>
Date:   Tue Sep 4 13:33:50 2018 +0200

    Port to meson build system

 .gitignore                                         |   2 +
 autogen.sh                                         |  21 --
 build-aux/flatpak/org.gnome.Gtranslator.json       | 106 ++++++++++
 build-aux/meson.build                              |   1 +
 build-aux/meson/meson.build                        |   1 +
 build-aux/meson/meson_post_install.py              |  15 ++
 data/Makefile.am                                   |  38 ----
 data/desktop/Makefile.am                           |  14 --
 data/desktop/gtranslator.ico                       | Bin 9662 -> 0 bytes
 data/desktop/icons/Makefile.am                     |  40 ----
 .../hicolor/16x16/apps/org.gnome.Gtranslator.png}  | Bin
 .../hicolor/22x22/apps/org.gnome.Gtranslator.png}  | Bin
 .../hicolor/24x24/apps/org.gnome.Gtranslator.png}  | Bin
 .../hicolor/32x32/apps/org.gnome.Gtranslator.png}  | Bin
 .../hicolor/48x48/apps/org.gnome.Gtranslator.png}  | Bin
 .../apps/org.gnome.Gtranslator-symbolic.svg}       |   0
 .../scalable/apps/org.gnome.Gtranslator.svg}       |   0
 data/icons/meson.build                             |  20 ++
 .../src/gtranslator-16.svg}                        |   0
 .../src/gtranslator-22.svg}                        |   0
 .../src/gtranslator-24.svg}                        |   0
 .../src/gtranslator-32.svg}                        |   0
 .../src/gtranslator-48.svg}                        |   0
 data/meson.build                                   |  51 +++++
 ...xml.in => org.gnome.Gtranslator.appdata.xml.in} |   0
 ...desktop.in => org.gnome.Gtranslator.desktop.in} |   0
 ...xml.in => org.gnome.Gtranslator.gschema.xml.in} |   0
 data/pixmaps/Makefile.am                           |  15 --
 data/pixmaps/meson.build                           |  13 ++
 doc/reference/Makefile.am                          |  88 --------
 doc/reference/meson.build                          |  43 ++++
 meson.build                                        | 165 +++++++++++++++
 meson_options.txt                                  |   2 +
 po/meson.build                                     |   1 +
 src/Makefile.am                                    | 228 ---------------------
 src/gtr-dirs.c                                     |   8 +-
 src/gtr-language.c                                 |   4 +-
 src/meson.build                                    | 134 ++++++++++++
 src/toolbareditor/Makefile.am                      | 107 ----------
 src/toolbareditor/meson.build                      |  46 +++++
 40 files changed, 606 insertions(+), 557 deletions(-)
---
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..682da155
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+_build/
+*.swp
diff --git a/build-aux/flatpak/org.gnome.Gtranslator.json b/build-aux/flatpak/org.gnome.Gtranslator.json
new file mode 100644
index 00000000..8574a5d2
--- /dev/null
+++ b/build-aux/flatpak/org.gnome.Gtranslator.json
@@ -0,0 +1,106 @@
+{
+    "app-id" : "org.gnome.Gtranslator",
+    "runtime" : "org.gnome.Platform",
+    "runtime-version" : "master",
+    "sdk" : "org.gnome.Sdk",
+    "command" : "gtranslator",
+    "tags" : [
+        "devel"
+    ],
+    "desktop-file-name-prefix" : "(Development) ",
+    "finish-args" : [
+        "--share=ipc",
+        "--share=network",
+        "--socket=x11",
+        "--socket=wayland",
+        "--filesystem=home",
+        "--filesystem=xdg-run/dconf",
+        "--filesystem=~/.config/dconf:ro",
+        "--talk-name=ca.desrt.dconf",
+        "--env=DCONF_USER_CONFIG_DIR=.config/dconf"
+    ],
+    "build-options" : {
+        "cflags" : "-O2 -g",
+        "env" : {
+            "PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_GIRDIR": "/app/share/gir-1.0",
+            "PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_TYPELIBDIR": "/app/lib/girepository-1.0"
+        }
+    },
+    "cleanup" : [
+        "/include",
+        "/lib/pkgconfig",
+        "/share/pkgconfig",
+        "/share/aclocal",
+        "/man",
+        "/share/man",
+        "/share/gtk-doc",
+        "*.la",
+        "*.a"
+    ],
+    "modules" : [
+        {
+            "name" : "gtksourceview",
+            "config-opts" : [
+                "--disable-Werror"
+            ],
+            "sources" : [
+                {
+                    "type" : "git",
+                    "url" : "https://gitlab.gnome.org/GNOME/gtksourceview.git";,
+                    "branch" : "gnome-3-24"
+                }
+            ]
+        },
+        {
+            "name" : "gdl",
+            "sources" : [
+                {
+                    "type" : "git",
+                    "url" : "https://gitlab.gnome.org/GNOME/gdl.git";
+                }
+            ]
+        },
+        {
+            "name" : "libgda",
+            "buildsystem" : "meson",
+            "sources" : [
+                {
+                    "type" : "git",
+                    "url" : "https://gitlab.gnome.org/GNOME/libgda.git";
+                }
+            ]
+        },
+        {
+            "name" : "libpeas",
+            "sources" : [
+                {
+                    "type" : "git",
+                    "url" : "https://gitlab.gnome.org/GNOME/libpeas.git";
+                }
+            ]
+        },
+        {
+            "name" : "gettext",
+            "sources" : [
+                {
+                    "type" : "archive",
+                    "url" : "https://ftp.gnu.org/pub/gnu/gettext/gettext-0.19.8.1.tar.xz";,
+                    "sha256": "105556dbc5c3fbbc2aa0edb46d22d055748b6f5c7cd7a8d99f8e7eb84e938be4"
+                }
+            ]
+        },
+        {
+            "name" : "gtranslator",
+            "buildsystem" : "meson",
+            "sources" : [
+                {
+                    "type" : "git",
+                    "url" : "https://gitlab.gnome.org/GNOME/translator.git";
+                }
+            ],
+            "config-opts" : [
+                "-Dprofile=development"
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/build-aux/meson.build b/build-aux/meson.build
new file mode 100644
index 00000000..8800f009
--- /dev/null
+++ b/build-aux/meson.build
@@ -0,0 +1 @@
+subdir('meson')
diff --git a/build-aux/meson/meson.build b/build-aux/meson/meson.build
new file mode 100644
index 00000000..1ab810bb
--- /dev/null
+++ b/build-aux/meson/meson.build
@@ -0,0 +1 @@
+meson.add_install_script('meson_post_install.py')
diff --git a/build-aux/meson/meson_post_install.py b/build-aux/meson/meson_post_install.py
new file mode 100644
index 00000000..bf320a9d
--- /dev/null
+++ b/build-aux/meson/meson_post_install.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+
+install_prefix = os.environ['MESON_INSTALL_PREFIX']
+icondir = os.path.join(install_prefix, 'share', 'icons', 'hicolor')
+schemadir = os.path.join(install_prefix, 'share', 'glib-2.0', 'schemas')
+
+if not os.environ.get('DESTDIR'):
+  print('Update icon cache...')
+  subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
+
+  print('Compiling gsettings schemas...')
+  subprocess.call(['glib-compile-schemas', schemadir])
diff --git a/data/desktop/icons/16x16/gtranslator.png 
b/data/icons/hicolor/16x16/apps/org.gnome.Gtranslator.png
similarity index 100%
rename from data/desktop/icons/16x16/gtranslator.png
rename to data/icons/hicolor/16x16/apps/org.gnome.Gtranslator.png
diff --git a/data/desktop/icons/22x22/gtranslator.png 
b/data/icons/hicolor/22x22/apps/org.gnome.Gtranslator.png
similarity index 100%
rename from data/desktop/icons/22x22/gtranslator.png
rename to data/icons/hicolor/22x22/apps/org.gnome.Gtranslator.png
diff --git a/data/desktop/icons/24x24/gtranslator.png 
b/data/icons/hicolor/24x24/apps/org.gnome.Gtranslator.png
similarity index 100%
rename from data/desktop/icons/24x24/gtranslator.png
rename to data/icons/hicolor/24x24/apps/org.gnome.Gtranslator.png
diff --git a/data/desktop/icons/32x32/gtranslator.png 
b/data/icons/hicolor/32x32/apps/org.gnome.Gtranslator.png
similarity index 100%
rename from data/desktop/icons/32x32/gtranslator.png
rename to data/icons/hicolor/32x32/apps/org.gnome.Gtranslator.png
diff --git a/data/desktop/icons/48x48/gtranslator.png 
b/data/icons/hicolor/48x48/apps/org.gnome.Gtranslator.png
similarity index 100%
rename from data/desktop/icons/48x48/gtranslator.png
rename to data/icons/hicolor/48x48/apps/org.gnome.Gtranslator.png
diff --git a/data/desktop/icons/scalable/gtranslator-symbolic.svg 
b/data/icons/hicolor/scalable/apps/org.gnome.Gtranslator-symbolic.svg
similarity index 100%
rename from data/desktop/icons/scalable/gtranslator-symbolic.svg
rename to data/icons/hicolor/scalable/apps/org.gnome.Gtranslator-symbolic.svg
diff --git a/data/desktop/icons/48x48/gtranslator.svg 
b/data/icons/hicolor/scalable/apps/org.gnome.Gtranslator.svg
similarity index 100%
rename from data/desktop/icons/48x48/gtranslator.svg
rename to data/icons/hicolor/scalable/apps/org.gnome.Gtranslator.svg
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 00000000..fe87d7a9
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,20 @@
+icon_sizes = ['16x16', '22x22', '24x24', '32x32', '48x48']
+
+foreach icon_size: icon_sizes
+  hicolor_dir = join_paths('hicolor', icon_size, 'apps')
+
+  install_data(
+    join_paths(hicolor_dir, 'org.gnome.Gtranslator.png'),
+    install_dir: join_paths(gtranslator_datadir, 'icons', hicolor_dir),
+    rename: '@0@.png'.format(application_id)
+  )
+endforeach
+
+hicolor_dir = join_paths('hicolor', 'scalable', 'apps')
+
+install_data(
+  join_paths(hicolor_dir, 'org.gnome.Gtranslator-symbolic.svg'),
+  install_dir: join_paths(gtranslator_datadir, 'icons', hicolor_dir),
+  rename: '@0 -symbolic svg'.format(application_id)
+)
+
diff --git a/data/desktop/icons/16x16/gtranslator.svg b/data/icons/src/gtranslator-16.svg
similarity index 100%
rename from data/desktop/icons/16x16/gtranslator.svg
rename to data/icons/src/gtranslator-16.svg
diff --git a/data/desktop/icons/22x22/gtranslator.svg b/data/icons/src/gtranslator-22.svg
similarity index 100%
rename from data/desktop/icons/22x22/gtranslator.svg
rename to data/icons/src/gtranslator-22.svg
diff --git a/data/desktop/icons/24x24/gtranslator.svg b/data/icons/src/gtranslator-24.svg
similarity index 100%
rename from data/desktop/icons/24x24/gtranslator.svg
rename to data/icons/src/gtranslator-24.svg
diff --git a/data/desktop/icons/32x32/gtranslator.svg b/data/icons/src/gtranslator-32.svg
similarity index 100%
rename from data/desktop/icons/32x32/gtranslator.svg
rename to data/icons/src/gtranslator-32.svg
diff --git a/data/desktop/icons/scalable/gtranslator.svg b/data/icons/src/gtranslator-48.svg
similarity index 100%
rename from data/desktop/icons/scalable/gtranslator.svg
rename to data/icons/src/gtranslator-48.svg
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 00000000..fb78835c
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,51 @@
+subdir('icons')
+subdir('pixmaps')
+
+# Desktop files
+desktop = 'org.gnome.Gtranslator.desktop'
+appdata = 'org.gnome.Gtranslator.appdata.xml'
+
+i18n.merge_file(
+      desktop,
+         type: 'desktop',
+        input: desktop + '.in',
+       output: desktop,
+       po_dir: po_dir,
+      install: true,
+  install_dir: join_paths(gtranslator_datadir, 'applications')
+)
+
+i18n.merge_file(
+      appdata,
+         type: 'xml',
+        input: appdata + '.in',
+       output: appdata,
+       po_dir: po_dir,
+      install: true,
+  install_dir: join_paths(gtranslator_datadir, 'metainfo')
+)
+
+# GSettings schema
+schema_conf = configuration_data()
+schema_conf.set('GETTEXT_PACKAGE', meson.project_name())
+
+schema = 'org.gnome.Gtranslator.gschema.xml'
+
+schema_xml = configure_file(
+  input: schema + '.in',
+  output: schema,
+  install: true,
+  install_dir: gtranslator_schemadir,
+  configuration: schema_conf
+)
+
+output = 'gschemas.compiled'
+
+# for unit tests - gnome.compile_schemas() only looks in srcdir
+compiled_schemas = custom_target(
+   output,
+    input: schema_xml,
+   output: output,
+  command: [find_program('glib-compile-schemas'), meson.current_build_dir()]
+)
+
diff --git a/data/gtranslator.appdata.xml.in b/data/org.gnome.Gtranslator.appdata.xml.in
similarity index 100%
rename from data/gtranslator.appdata.xml.in
rename to data/org.gnome.Gtranslator.appdata.xml.in
diff --git a/data/desktop/gtranslator.desktop.in b/data/org.gnome.Gtranslator.desktop.in
similarity index 100%
rename from data/desktop/gtranslator.desktop.in
rename to data/org.gnome.Gtranslator.desktop.in
diff --git a/data/org.gnome.gtranslator.gschema.xml.in b/data/org.gnome.Gtranslator.gschema.xml.in
similarity index 100%
rename from data/org.gnome.gtranslator.gschema.xml.in
rename to data/org.gnome.Gtranslator.gschema.xml.in
diff --git a/data/pixmaps/meson.build b/data/pixmaps/meson.build
new file mode 100644
index 00000000..4769b53e
--- /dev/null
+++ b/data/pixmaps/meson.build
@@ -0,0 +1,13 @@
+pixdir = join_paths(gtranslator_datadir, 'pixmaps')
+
+install_data([
+    'gtranslator-plugin.png',
+       'gtranslator-plugin.png',
+       'gtranslator-logo.png',
+       'gtranslator-fuzzy-next.png',
+       'gtranslator-fuzzy-prev.png',
+       'gtranslator-untranslated-next.png',
+       'gtranslator-untranslated-prev.png',
+       'gtranslator-fuzzy-untranslated-next.png',
+       'gtranslator-fuzzy-untranslated-prev.png'
+], install_dir: pixdir)
diff --git a/doc/reference/meson.build b/doc/reference/meson.build
new file mode 100644
index 00000000..394139ad
--- /dev/null
+++ b/doc/reference/meson.build
@@ -0,0 +1,43 @@
+html_images = [
+  'figures/SingleClassDiagram.png',
+  'figures/ExtendedClassDiagram.png'
+]
+
+version_conf = configuration_data()
+version_conf.set('VERSION', gtranslator_version)
+
+version = 'version.xml'
+
+version_xml = configure_file(
+          input: version + '.in',
+         output: version,
+  configuration: version_conf
+)
+
+gtk_prefix = gtk_dep.get_pkgconfig_variable('prefix')
+gtk_doc_path = join_paths(gtk_prefix, 'share', 'gtk-doc', 'html')
+
+glib_prefix = glib_dep.get_pkgconfig_variable('prefix')
+glib_doc_path = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
+
+doc_path = join_paths(gtranslator_datadir, 'gtk-doc', 'html', meson.project_name())
+
+gnome.gtkdoc(
+  meson.project_name(),
+       dependencies: gtranslator_deps + [toolbareditor_dep],
+          main_sgml: meson.project_name() + '-docs.sgml',
+            src_dir: src_inc,
+          scan_args: ['--rebuild-types'],
+          mkdb_args: [ '--sgml-mode', '--output-format=xml' ],
+  gobject_typesfile: meson.project_name() + '.types',
+        html_assets: html_images,
+            install: true,
+        install_dir: doc_path,
+       fixxref_args: [
+    '--extra-dir=@0@'.format(join_paths(glib_doc_path, 'glib')),
+    '--extra-dir=@0@'.format(join_paths(glib_doc_path, 'gobject')),
+    '--extra-dir=@0@'.format(join_paths(glib_doc_path, 'gio')),
+    '--extra-dir=@0@'.format(join_paths(gtk_doc_path, 'gdk')),
+    '--extra-dir=@0@'.format(join_paths(gtk_doc_path, 'gtk'))
+  ],
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000..81f2ad39
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,165 @@
+project(
+  'gtranslator',
+               'c',
+           version: '3.30.0',
+           license: 'GPL3+',
+)
+
+if get_option('profile') == 'development'
+  profile = 'Devel'
+  name_suffix = ' (Development)'
+  vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip()
+  if vcs_tag == ''
+    version_suffix = '-devel'
+  else
+    version_suffix = '-@0@'.format (vcs_tag)
+  endif
+else
+  profile = ''
+  name_suffix = ''
+  version_suffix = ''
+endif
+
+application_id = 'org.gnome.Gtranslator@0@'.format(profile)
+
+###########
+# Version #
+###########
+
+gtranslator_version = meson.project_version()
+version_array = gtranslator_version.split('.')
+gtranslator_major_version = version_array[0].to_int()
+gtranslator_minor_version = version_array[1].to_int()
+gtranslator_micro_version = version_array[2].to_int()
+
+
+#################
+# Default paths #
+#################
+
+gtranslator_prefix = get_option('prefix')
+gtranslator_bindir = join_paths(gtranslator_prefix, get_option('bindir'))
+gtranslator_localedir = join_paths(gtranslator_prefix, get_option('localedir'))
+gtranslator_datadir = join_paths(gtranslator_prefix, get_option('datadir'))
+gtranslator_pkgdatadir = join_paths(gtranslator_datadir, meson.project_name())
+gtranslator_schemadir = join_paths(gtranslator_datadir, 'glib-2.0', 'schemas')
+
+
+###########
+# Options #
+###########
+
+gtranslator_buildtype = get_option('buildtype')
+gtranslator_debug = gtranslator_minor_version.is_odd() or gtranslator_buildtype.contains('debug')
+enable_gtk_doc = get_option('documentation')
+
+cc = meson.get_compiler('c')
+po_dep = cc.find_library('gettextpo')
+iso_codes_dep = dependency('iso-codes', version: '>=0.35')
+
+config_h = configuration_data()
+# package
+package_bugreport = 'https://gitlab.gnome.org/GNOME/' + meson.project_name()
+set_defines = [
+  ['PACKAGE', meson.project_name()],
+  ['PACKAGE_DATADIR', join_paths(get_option('prefix'), get_option('datadir'))],
+  ['PACKAGE_LOCALEDIR', join_paths(get_option('prefix'), get_option('datadir'), 'locale')],
+  ['PACKAGE_HELPDIR', join_paths(get_option('prefix'), get_option('datadir'), 'gnome', 'help')],
+  ['PACKAGE_LIBDIR', join_paths(get_option('prefix'), get_option('libdir'))],
+  ['PACKAGE_ISO_CODES_PREFIX', iso_codes_dep.get_pkgconfig_variable('prefix')],
+  ['PACKAGE_BUGREPORT', package_bugreport],
+  ['PACKAGE_NAME', meson.project_name()],
+  ['PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), gtranslator_version)],
+  ['PACKAGE_TARNAME', meson.project_name()],
+  ['PACKAGE_URL', 'https://wiki.gnome.org/Apps/Gtranslator'],
+  ['PACKAGE_VERSION', gtranslator_version],
+  ['VERSION', gtranslator_version],
+  ['GETTEXT_PACKAGE', meson.project_name()]
+]
+
+foreach define: set_defines
+  config_h.set_quoted(define[0], define[1])
+endforeach
+configure_file(output: 'config.h', configuration: config_h)
+
+assert(cc.has_function('strerror'), '"strerror" not found')
+
+# Compiler flags
+common_flags = [
+  '-DHAVE_CONFIG_H',
+  '-DPACKAGE_LOCALE_DIR="@0@"'.format(gtranslator_localedir),
+  '-DPACKAGE_DATA_DIR="@0@"'.format(gtranslator_pkgdatadir),
+  '-DUI_DATA_DIR="@0@"'.format(join_paths(gtranslator_datadir), 'style'),
+]
+
+if gtranslator_debug
+  common_flags += [
+    '-DG_DISABLE_CAST_CHECKS'
+  ]
+elif gtranslator_buildtype == 'release'
+  common_flags += [
+    '-DG_DISABLE_ASSERT',
+    '-DG_DISABLE_CHECKS',
+    '-DG_DISABLE_CAST_CHECKS'
+  ]
+endif
+
+add_project_arguments(common_flags, language: 'c')
+
+
+################
+# Dependencies #
+################
+
+gtk_dep = dependency('gtk+-3.0', version: '>= 3.22.20')
+glib_dep = dependency('glib-2.0', version: '>=2.36.0')
+
+gtranslator_deps = [
+  iso_codes_dep,
+  po_dep,
+  gtk_dep,
+  glib_dep,
+  dependency('libxml-2.0', version: '>=2.4.12'),
+  dependency('gthread-2.0', version: '>=2.13.0'),
+  dependency('gio-2.0', version: '>=2.36.0'),
+  dependency('gtksourceview-3.0', version: '>=3.0.0'),
+  dependency('gsettings-desktop-schemas')
+]
+
+gnome = import('gnome')
+i18n = import('i18n')
+pkg = import('pkgconfig')
+
+top_inc = include_directories('.')
+
+data_dir = join_paths(meson.source_root(), 'data')
+po_dir = join_paths(meson.source_root(), 'po')
+src_dir = join_paths(meson.source_root(), 'src')
+
+
+###########
+# Subdirs #
+###########
+
+subdir('build-aux')
+subdir('data')
+subdir('src')
+subdir('po')
+
+#subdir('help')
+#subdir('man')
+
+if enable_gtk_doc
+  subdir('doc/reference')
+endif
+
+output = '\n\n      GTranslator ' + gtranslator_version + '\n'
+output += '      =========================\n\n'
+output += '          Source ..........................: ' + meson.source_root() + '\n'
+output += '          Prefix ..........................: ' + gtranslator_prefix + '\n'
+output += '          Compiler ........................: ' + cc.get_id() + '\n\n'
+output += '      Development options\n'
+output += '          Enable Debug: ...................: ' + gtranslator_debug.to_string() + '\n'
+output += '          Enable Documentation: ...........: ' + enable_gtk_doc.to_string() + '\n\n'
+output += '    Now type "ninja -C ' + meson.build_root() + '" to build ' + meson.project_name() + '\n\n'
+message(output)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 00000000..9f819ac5
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,2 @@
+option('documentation', type: 'boolean', value: false, description: 'use gtk-doc to build documentation')
+option('profile', type: 'combo', choices: [ 'default', 'development' ], value: 'default')
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 00000000..e9b77d79
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(meson.project_name(), preset: 'glib')
diff --git a/src/gtr-dirs.c b/src/gtr-dirs.c
index 0ff69d3b..a1c6af7f 100644
--- a/src/gtr-dirs.c
+++ b/src/gtr-dirs.c
@@ -75,10 +75,10 @@ gtr_dirs_init ()
 #endif /* !OS_OSX */
   if (gtr_data_dir == NULL)
     {
-      gtr_data_dir = g_build_filename (DATADIR, "gtranslator", NULL);
-      gtr_help_dir = g_build_filename (DATADIR, "gnome", "help", NULL);
-      gtr_locale_dir = g_build_filename (DATADIR, "locale", NULL);
-      gtr_lib_dir = g_build_filename (LIBDIR, "gtranslator", NULL);
+      gtr_data_dir = g_build_filename (PACKAGE_DATADIR, "gtranslator", NULL);
+      gtr_help_dir = g_build_filename (PACKAGE_HELPDIR, "gnome", "help", NULL);
+      gtr_locale_dir = g_build_filename (PACKAGE_LOCALEDIR, "locale", NULL);
+      gtr_lib_dir = g_build_filename (PACKAGE_LIBDIR, "gtranslator", NULL);
     }
 #endif /* !G_OS_WIN32 */
 
diff --git a/src/gtr-language.c b/src/gtr-language.c
index 1ca90ea0..0d3f1a25 100644
--- a/src/gtr-language.c
+++ b/src/gtr-language.c
@@ -32,7 +32,7 @@
 
 #define ISO_639_DOMAIN "iso_639"
 
-#define ISOCODESLOCALEDIR              ISO_CODES_PREFIX "/share/locale"
+#define ISOCODESLOCALEDIR              PACKAGE_ISO_CODES_PREFIX "/share/locale"
 #define GTR_PLURAL_FORMS_FILENAME      "gtr-plural-forms.ini"
 
 struct _GtrLanguage
@@ -141,7 +141,7 @@ load_iso_entries (int iso,
   char *filename;
   int ret = -1;
 
-  filename = g_strdup_printf (ISO_CODES_PREFIX "/share/xml/iso-codes/iso_%d.xml", iso);
+  filename = g_strdup_printf (PACKAGE_ISO_CODES_PREFIX "/share/xml/iso-codes/iso_%d.xml", iso);
   reader = xmlNewTextReaderFilename (filename);
   if (reader == NULL)
     goto out;
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 00000000..97f3a345
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,134 @@
+src_inc = include_directories('.')
+
+gtr_marshal = gnome.genmarshal('gtr-marshal',
+    sources: 'gtr-marshal.list',
+    prefix: 'gtr_marshal',
+    install_header: true,
+    install_dir: get_option('includedir'),
+    extra_args: ['-UG_ENABLE_DEBUG', '--prototypes'])
+
+gtr_marshal_c = gtr_marshal[0]
+gtr_marshal_h = gtr_marshal[1]
+
+sources = files(
+       'gtr-actions-app.c',
+       'gtr-actions-documents.c',
+       'gtr-actions-edit.c',
+       'gtr-actions-file.c',
+       'gtr-actions-go.c',
+       'gtr-actions-search.c',
+       'gtr-actions-view.c',
+       'gtr-application.c',
+       'gtr-assistant.c',
+       'gtr-close-button.c',
+       'gtr-close-confirmation-dialog.c',
+       'gtr-context.c',
+       'gtr-dirs.c',
+       'gtr-file-dialogs.c',
+       'gtr-header.c',
+       'gtr-header-dialog.c',
+       'gtr-history-entry.c',
+       'gtr-io-error-info-bar.c',
+       'gtr-jump-dialog.c',
+       'gtr-language.c',
+       'gtr-languages-fetcher.c',
+       'gtr-message-container.c',
+       'gtr-message-table.c',
+       'gtr-message-table-model.c',
+       'gtr-msg.c',
+       'gtr-notebook.c',
+       'gtr-po.c',
+       'gtr-preferences-dialog.c',
+       'gtr-profile.c',
+       'gtr-profile-dialog.c',
+       'gtr-profile-manager.c',
+       'gtr-search-dialog.c',
+       'gtr-settings.c',
+       'gtr-statusbar.c',
+       'gtr-status-combo-box.c',
+       'gtr-tab.c',
+       'gtr-tab-label.c',
+       'gtr-utils.c',
+       'gtr-view.c',
+       'gtr-window.c'
+)
+
+sources += [gtr_marshal_c, gtr_marshal_h]
+
+header_files = files(
+       'gtr-application.h',
+       'gtr-context.h',
+       'gtr-debug.h',
+       'gtr-header.h',
+       'gtr-message-container.h',
+       'gtr-message-table.h',
+       'gtr-msg.h',
+       'gtr-notebook.h',
+       'gtr-po.h',
+       'gtr-profile.h',
+       'gtr-statusbar.h',
+       'gtr-tab-activatable.h',
+       'gtr-tab.h',
+       'gtr-view.h',
+       'gtr-window-activatable.h',
+       'gtr-window.h',
+)
+
+enum_types = 'gtr-enum-types'
+sources += gnome.mkenums(
+  enum_types,
+     sources: header_files,
+  c_template: enum_types + '.c.template',
+  h_template: enum_types + '.h.template'
+)
+
+resource_data = files(
+    'gtranslator-ui.xml',
+    'gtranslator-menu.ui',
+    'gtr-context.ui',
+    'gtr-header-dialog.ui',
+    'gtr-jump-dialog.ui',
+    'gtr-languages-fetcher.ui',
+    'gtr-message-table.ui',
+    'gtr-notebook.ui',
+    'gtr-preferences-dialog.ui',
+    'gtr-profile-dialog.ui',
+    'gtr-search-dialog.ui',
+    'gtr-statusbar.ui',
+    'gtr-tab.ui',
+    'gtr-window.ui'
+)
+
+gresource = files('gtranslator.gresource.xml')
+sources += gnome.compile_resources(
+  'gtr-resources', gresource,
+        source_dir: src_dir,
+            c_name: 'gtr_resources',
+      dependencies: resource_data,
+            export: true
+)
+
+#######################
+# Include directories #
+#######################
+
+incs = [
+  top_inc,
+  include_directories('toolbareditor'),
+]
+
+subdir('toolbareditor')
+
+
+###############
+# gtranslator #
+###############
+
+executable(
+  meson.project_name(),
+   sources + files('main.c'),
+   include_directories: incs,
+          dependencies: gtranslator_deps + [toolbareditor_dep],
+               install: true,
+           install_dir: gtranslator_bindir
+)
diff --git a/src/toolbareditor/meson.build b/src/toolbareditor/meson.build
new file mode 100644
index 00000000..abc03748
--- /dev/null
+++ b/src/toolbareditor/meson.build
@@ -0,0 +1,46 @@
+marshallers = gnome.genmarshal('eggmarshalers',
+    sources: 'eggmarshalers.list',
+    prefix: '_egg_marshal',
+    install_header: true,
+    install_dir: get_option('includedir'),
+    extra_args: ['-UG_ENABLE_DEBUG', '--prototypes'])
+
+marshaller_c = marshallers[0]
+marshaller_h = marshallers[1]
+
+enum_sources = files(
+       'egg-editable-toolbar.h',
+       'egg-toolbars-model.h',
+       'egg-toolbar-editor.h',
+)
+
+builtins = gnome.mkenums_simple('eggtypebuiltins', sources: enum_sources)
+
+toolbar_sources = files(
+       'egg-editable-toolbar.c',
+       'egg-toolbars-model.c',
+       'egg-toolbar-editor.c',
+       'egg-editable-toolbar.h',
+       'egg-toolbars-model.h',
+       'egg-toolbar-editor.h',
+)
+
+built_sources = [
+    marshaller_c,
+    marshaller_h
+] + builtins
+
+libtoolbar = static_library('toolbareditor',
+    toolbar_sources + built_sources,
+   include_directories: top_inc,
+    dependencies: [
+        dependency('glib-2.0'),
+        dependency('gtk+-3.0'),
+        dependency('libxml-2.0'),
+    ],
+)
+
+toolbareditor_dep = declare_dependency(
+              sources: sources + built_sources,
+            link_with: libtoolbar,
+)


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