[gtranslator: 1/2] build: Various meson related improvements
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator: 1/2] build: Various meson related improvements
- Date: Wed, 19 Sep 2018 11:11:47 +0000 (UTC)
commit 3e025046152a16eb0c55295fb63d177a67989242
Author: Iñigo Martínez <inigomartinez gmail com>
Date: Wed Sep 19 12:20:08 2018 +0200
build: Various meson related improvements
meson build system has received several improvements. The list of
improvements is as follows:
- The prefix used for different variables has been changed to `gtr`.
- Indentation has been changed to that most commonly used.
- Unnecessary `meson.build` files have been removed.
- GTK documentation generation has been fixed.
- `schemadir` location is now checked from GIO's pkg-config file
when available.
- `profile` has been removed and debug builds are considered now
development builds.
- `documentation` option has been renamed to `gtk_doc` to be
consistent with different GNOME packages using the same option.
- meson post install script does not build paths based on
installation prefix because these might vary.
build-aux/meson.build | 1 -
build-aux/meson/meson.build | 1 -
build-aux/meson/meson_post_install.py | 16 +--
data/icons/meson.build | 21 ++--
data/meson.build | 80 ++++++-------
data/pixmaps/meson.build | 25 ++--
doc/reference/meson.build | 66 +++++------
help/meson.build | 121 ++++++++++---------
meson.build | 186 +++++++++++++++--------------
meson_options.txt | 3 +-
src/meson.build | 207 ++++++++++++++++++---------------
src/translation-memory/gda/meson.build | 4 -
src/translation-memory/meson.build | 43 ++++---
13 files changed, 391 insertions(+), 383 deletions(-)
---
diff --git a/build-aux/meson/meson_post_install.py b/build-aux/meson/meson_post_install.py
index bf320a9d..e376fc28 100644
--- a/build-aux/meson/meson_post_install.py
+++ b/build-aux/meson/meson_post_install.py
@@ -2,14 +2,14 @@
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')
+import sys
if not os.environ.get('DESTDIR'):
- print('Update icon cache...')
- subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
+ icondir = os.path.join(sys.argv[1], 'icons', 'hicolor')
+ schemasdir = sys.argv[2]
+
+ print('Update icon cache...')
+ subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
- print('Compiling gsettings schemas...')
- subprocess.call(['glib-compile-schemas', schemadir])
+ print('Compiling gsettings schemas...')
+ subprocess.call(['glib-compile-schemas', schemasdir])
diff --git a/data/icons/meson.build b/data/icons/meson.build
index fe87d7a9..736578ea 100644
--- a/data/icons/meson.build
+++ b/data/icons/meson.build
@@ -1,20 +1,25 @@
-icon_sizes = ['16x16', '22x22', '24x24', '32x32', '48x48']
+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)
+ join_paths(hicolor_dir, gtr_namespace + '.png'),
+ install_dir: join_paths(gtr_datadir, 'icons', hicolor_dir),
+ rename: '@0@.png'.format(gtr_app_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)
+ join_paths(hicolor_dir, gtr_namespace + '-symbolic.svg'),
+ install_dir: join_paths(gtr_datadir, 'icons', hicolor_dir),
+ rename: '@0 -symbolic svg'.format(gtr_app_id),
)
-
diff --git a/data/meson.build b/data/meson.build
index 134697f1..f729c172 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -2,69 +2,63 @@ subdir('icons')
subdir('pixmaps')
# Desktop files
-desktop = 'org.gnome.Gtranslator.desktop'
-appdata = 'org.gnome.Gtranslator.appdata.xml'
-
desktop_conf = configuration_data()
-desktop_conf.set('icon', application_id)
-appdata_conf = configuration_data()
-appdata_conf.set('appid', application_id)
+desktop_conf.set('icon', gtr_app_id)
+
+desktop = gtr_namespace + '.desktop'
desktop_in = configure_file(
- input: desktop + '.in.in',
- output: desktop + '.in',
- configuration: desktop_conf
+ input: desktop + '.in.in',
+ output: desktop + '.in',
+ configuration: desktop_conf,
)
-appdata_in = configure_file(
- input: appdata + '.in.in',
- output: appdata + '.in',
- configuration: appdata_conf
+i18n.merge_file(
+ desktop,
+ type: 'desktop',
+ input: desktop_in,
+ output: desktop,
+ po_dir: po_dir,
+ install: true,
+ install_dir: join_paths(gtr_datadir, 'applications'),
)
-i18n.merge_file(
- desktop,
- type: 'desktop',
- input: desktop_in,
- output: desktop,
- po_dir: po_dir,
- install: true,
- install_dir: join_paths(gtranslator_datadir, 'applications')
+# AppStream application metainfo
+appdata_conf = configuration_data()
+appdata_conf.set('appid', gtr_app_id)
+
+appdata = gtr_namespace + '.appdata.xml'
+
+appdata_in = configure_file(
+ input: appdata + '.in.in',
+ output: appdata + '.in',
+ configuration: appdata_conf,
)
i18n.merge_file(
- appdata,
- type: 'xml',
- input: appdata_in,
- output: appdata,
- po_dir: po_dir,
- install: true,
- install_dir: join_paths(gtranslator_datadir, 'metainfo')
+ appdata,
+ input: appdata_in,
+ output: appdata,
+ po_dir: po_dir,
+ install: true,
+ install_dir: join_paths(gtr_datadir, 'metainfo'),
)
# GSettings schema
schema_conf = configuration_data()
schema_conf.set('GETTEXT_PACKAGE', meson.project_name())
-schema = 'org.gnome.Gtranslator.gschema.xml'
+schema = gtr_namespace + '.gschema.xml'
-schema_xml = configure_file(
+configure_file(
input: schema + '.in',
output: schema,
+ configuration: schema_conf,
install: true,
- install_dir: gtranslator_schemadir,
- configuration: schema_conf
+ install_dir: gtr_schemasdir,
)
-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()]
+install_data(
+ 'gtr-plural-forms.ini',
+ install_dir: join_paths(gtr_pkgdatadir, 'ui'),
)
-
-install_data ('gtr-plural-forms.ini', install_dir: join_paths (gtranslator_pkgdatadir, 'ui'))
-
diff --git a/data/pixmaps/meson.build b/data/pixmaps/meson.build
index e81a4d19..2f5d042a 100644
--- a/data/pixmaps/meson.build
+++ b/data/pixmaps/meson.build
@@ -1,12 +1,15 @@
-pixdir = join_paths(gtranslator_datadir, 'pixmaps')
+pixmap_data = files(
+ 'gtranslator-logo.png',
+ 'gtranslator-fuzzy-next.png',
+ 'gtranslator-fuzzy-prev.png',
+ 'gtranslator-fuzzy-untranslated-next.png',
+ 'gtranslator-fuzzy-untranslated-prev.png',
+ 'gtranslator-plugin.png',
+ 'gtranslator-untranslated-next.png',
+ 'gtranslator-untranslated-prev.png',
+)
-install_data([
- '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)
+install_data(
+ pixmap_data,
+ install_dir: join_paths(gtr_datadir, 'pixmaps'),
+)
diff --git a/doc/reference/meson.build b/doc/reference/meson.build
index 394139ad..14e3a250 100644
--- a/doc/reference/meson.build
+++ b/doc/reference/meson.build
@@ -1,43 +1,43 @@
-html_images = [
- 'figures/SingleClassDiagram.png',
- 'figures/ExtendedClassDiagram.png'
-]
+doc_module = meson.project_name()
-version_conf = configuration_data()
-version_conf.set('VERSION', gtranslator_version)
+glib_prefix = glib_dep.get_pkgconfig_variable('prefix')
+gtk_prefix = gtk_dep.get_pkgconfig_variable('prefix')
-version = 'version.xml'
+fixxref_args = [
+ '--html-dir=' + join_paths(gtr_prefix, gnome.gtkdoc_html_dir(doc_module)),
+ '--extra-dir=' + join_paths(glib_prefix, gnome.gtkdoc_html_dir('glib')),
+ '--extra-dir=' + join_paths(glib_prefix, gnome.gtkdoc_html_dir('gio')),
+ '--extra-dir=' + join_paths(gtk_prefix, gnome.gtkdoc_html_dir('gdk')),
+ '--extra-dir=' + join_paths(gtk_prefix, gnome.gtkdoc_html_dir('gdk-pixbuf')),
+ '--extra-dir=' + join_paths(gtk_prefix, gnome.gtkdoc_html_dir('gtk')),
+]
-version_xml = configure_file(
- input: version + '.in',
- output: version,
- configuration: version_conf
+html_images = files(
+ 'figures/ExtendedClassDiagram.png',
+ 'figures/SingleClassDiagram.png',
)
-gtk_prefix = gtk_dep.get_pkgconfig_variable('prefix')
-gtk_doc_path = join_paths(gtk_prefix, 'share', 'gtk-doc', 'html')
+version_conf = configuration_data()
+version_conf.set('VERSION', gtr_version)
-glib_prefix = glib_dep.get_pkgconfig_variable('prefix')
-glib_doc_path = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
+version_xml = 'version.xml'
-doc_path = join_paths(gtranslator_datadir, 'gtk-doc', 'html', meson.project_name())
+version = configure_file(
+ input: version_xml + '.in',
+ output: version_xml,
+ configuration: version_conf,
+)
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'))
- ],
+ doc_module,
+ main_xml: doc_module + '-docs.sgml',
+ src_dir: src_inc,
+ include_directories: top_inc,
+ dependencies: libgtranslator_dep,
+ fixxref_args: fixxref_args,
+ gobject_typesfile: files(doc_module + '.types'),
+ html_assets: html_images,
+ content_files: version,
+ install: true,
+ install_dir: doc_module,
)
diff --git a/help/meson.build b/help/meson.build
index 3eef1ca7..9f79db15 100644
--- a/help/meson.build
+++ b/help/meson.build
@@ -1,59 +1,64 @@
-gnome.yelp(meson.project_name(),
- sources: [
- 'gtr-add-comment-po.page',
- 'gtr-concepts.page',
- 'gtr-create-tm.page',
- 'gtr-custom.page',
- 'gtr-edit-header.page',
- 'gtr-edit-po.page',
- 'gtr-faq.page',
- 'gtr-goto-string-po.page',
- 'gtr-join-users.page',
- 'gtr-main-window.page',
- 'gtr-open-po.page',
- 'gtr-plugins.page',
- 'gtr-profiles.page',
- 'gtr-quickstart.page',
- 'gtr-report-problem.page',
- 'gtr-save-po.page',
- 'gtr-shortcut-keys.page',
- 'gtr-translate.page',
- 'gtr-use-delete-entry.page',
- 'gtr-wizzard.page',
- 'index.page',
- 'legal.xml',
- 'license.page'
- ],
- media: [
- 'figures/add-profile.png',
- 'figures/alt-lang.png',
- 'figures/char-map.png',
- 'figures/comment-text.png',
- 'figures/edit_header2.png',
- 'figures/edit_header.png',
- 'figures/edit-profile.png',
- 'figures/edit-text.png',
- 'figures/edit-toolbar.png',
- 'figures/goto-string-toolbar.png',
- 'figures/gtrans_go_to_string_menu.png',
- 'figures/Gtranslator_022.png',
- 'figures/Gtranslator_023.png',
- 'figures/Gtranslator_025.png',
- 'figures/Gtranslator_026.png',
- 'figures/Gtranslator_027.png',
- 'figures/gtranslator32.png',
- 'figures/gtranslator_interface2.png',
- 'figures/gtranslator-plugins.png',
- 'figures/gtranslator_tm_strings.png',
- 'figures/message-detail.png',
- 'figures/mover1.png',
- 'figures/mover2.png',
- 'figures/mover3.png',
- 'figures/mover4.png',
- 'figures/mover5.png',
- 'figures/profiles2.png',
- 'figures/tm-manager.png',
- 'figures/top-bar.png',
- 'figures/use-tm-entry.png'
- ]
+sources = [
+ 'gtr-add-comment-po.page',
+ 'gtr-concepts.page',
+ 'gtr-create-tm.page',
+ 'gtr-custom.page',
+ 'gtr-edit-header.page',
+ 'gtr-edit-po.page',
+ 'gtr-faq.page',
+ 'gtr-goto-string-po.page',
+ 'gtr-join-users.page',
+ 'gtr-main-window.page',
+ 'gtr-open-po.page',
+ 'gtr-plugins.page',
+ 'gtr-profiles.page',
+ 'gtr-quickstart.page',
+ 'gtr-report-problem.page',
+ 'gtr-save-po.page',
+ 'gtr-shortcut-keys.page',
+ 'gtr-translate.page',
+ 'gtr-use-delete-entry.page',
+ 'gtr-wizzard.page',
+ 'index.page',
+ 'legal.xml',
+ 'license.page',
+]
+
+media = [
+ 'figures/add-profile.png',
+ 'figures/alt-lang.png',
+ 'figures/char-map.png',
+ 'figures/comment-text.png',
+ 'figures/edit_header2.png',
+ 'figures/edit_header.png',
+ 'figures/edit-profile.png',
+ 'figures/edit-text.png',
+ 'figures/edit-toolbar.png',
+ 'figures/goto-string-toolbar.png',
+ 'figures/gtrans_go_to_string_menu.png',
+ 'figures/Gtranslator_022.png',
+ 'figures/Gtranslator_023.png',
+ 'figures/Gtranslator_025.png',
+ 'figures/Gtranslator_026.png',
+ 'figures/Gtranslator_027.png',
+ 'figures/gtranslator32.png',
+ 'figures/gtranslator_interface2.png',
+ 'figures/gtranslator-plugins.png',
+ 'figures/gtranslator_tm_strings.png',
+ 'figures/message-detail.png',
+ 'figures/mover1.png',
+ 'figures/mover2.png',
+ 'figures/mover3.png',
+ 'figures/mover4.png',
+ 'figures/mover5.png',
+ 'figures/profiles2.png',
+ 'figures/tm-manager.png',
+ 'figures/top-bar.png',
+ 'figures/use-tm-entry.png',
+]
+
+gnome.yelp(
+ meson.project_name(),
+ sources: sources,
+ media: media,
)
diff --git a/meson.build b/meson.build
index b7712914..6e45930f 100644
--- a/meson.build
+++ b/meson.build
@@ -1,168 +1,166 @@
project(
- 'gtranslator',
- 'c',
- version: '3.30.0',
- license: 'GPL3+',
+ 'gtranslator', 'c',
+ version: '3.30.0',
+ license: 'GPL3+',
+ meson_version: '>= 0.46.0',
)
-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()
-
+gtr_version = meson.project_version()
+version_array = gtr_version.split('.')
+gtr_major_version = version_array[0].to_int()
+gtr_minor_version = version_array[1].to_int()
+gtr_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')
+gtr_prefix = get_option('prefix')
+gtr_datadir = join_paths(gtr_prefix, get_option('datadir'))
+gtr_includedir = join_paths(gtr_prefix, get_option('includedir'))
+gtr_libdir = join_paths(gtr_prefix, get_option('libdir'))
+gtr_localedir = join_paths(gtr_prefix, get_option('localedir'))
+gtr_pkgdatadir = join_paths(gtr_datadir, meson.project_name())
###########
# Options #
###########
-gtranslator_buildtype = get_option('buildtype')
-gtranslator_debug = gtranslator_minor_version.is_odd() or gtranslator_buildtype.contains('debug')
-enable_gtk_doc = get_option('documentation')
+gtr_namespace = 'org.gnome.Gtranslator'
+
+gtr_buildtype = get_option('buildtype')
+gtr_debug = gtr_minor_version.is_odd() or gtr_buildtype.contains('debug')
+
+if gtr_debug
+ profile = 'Devel'
+ name_suffix = ' (Development)'
+ vcs_tag = run_command(find_program('git'), 'rev-parse', '--short', 'HEAD').stdout().strip()
+ version_suffix = '-' + (vcs_tag == '' ? 'devel' : vcs_tag)
+else
+ profile = ''
+ name_suffix = ''
+ version_suffix = ''
+endif
+
+gtr_app_id = gtr_namespace + profile
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
['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_DATADIR', gtr_datadir],
+ ['PACKAGE_HELPDIR', join_paths(gtr_datadir, 'gnome', 'help')],
+ ['PACKAGE_LIBDIR', gtr_libdir],
+ ['PACKAGE_LOCALEDIR', gtr_localedir],
['PACKAGE_URL', 'https://wiki.gnome.org/Apps/Gtranslator'],
- ['PACKAGE_VERSION', gtranslator_version],
- ['VERSION', gtranslator_version],
- ['PACKAGE_APPID', application_id],
- ['GETTEXT_PACKAGE', meson.project_name()]
+ ['PACKAGE_VERSION', gtr_version],
+ ['PACKAGE_APPID', gtr_app_id],
+ # i18
+ ['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'),
-]
+common_flags = ['-DHAVE_CONFIG_H']
-if gtranslator_debug
- common_flags += [
- '-DG_DISABLE_CAST_CHECKS'
- ]
-elif gtranslator_buildtype == 'release'
+if gtr_debug
+ common_flags += ['-DG_DISABLE_CAST_CHECKS']
+elif gtr_buildtype == 'release'
common_flags += [
'-DG_DISABLE_ASSERT',
'-DG_DISABLE_CHECKS',
- '-DG_DISABLE_CAST_CHECKS'
+ '-DG_DISABLE_CAST_CHECKS',
]
endif
add_project_arguments(common_flags, language: 'c')
+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')
################
# Dependencies #
################
+glib_dep = dependency('glib-2.0', version: '>= 2.36.0')
gtk_dep = dependency('gtk+-3.0', version: '>= 3.22.20')
-glib_dep = dependency('glib-2.0', version: '>=2.36.0')
-gda_dep = dependency('libgda-5.0')
-gtranslator_deps = [
- iso_codes_dep,
- po_dep,
- gtk_dep,
+iso_codes_dep = dependency('iso-codes', version: '>= 0.35')
+config_h.set_quoted('PACKAGE_ISO_CODES_PREFIX', iso_codes_dep.get_pkgconfig_variable('prefix'))
+
+gtr_deps = [
glib_dep,
- gda_dep,
+ gtk_dep,
+ iso_codes_dep,
+ dependency('libgda-5.0'),
+ dependency('gio-2.0', version: '>= 2.36.0'),
+ dependency('gsettings-desktop-schemas'),
dependency('gspell-1', version: '>= 1.2.0'),
- 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')
+ dependency('gthread-2.0', version: '>= 2.13.0'),
+ dependency('gtksourceview-3.0', version: '>= 3.0.0'),
+ dependency('libxml-2.0', version: '>= 2.4.12'),
+ cc.find_library('gettextpo'),
]
-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')
-
+gtr_schemasdir = dependency('gio-2.0').get_pkgconfig_variable('schemasdir', define_variable: ['datadir',
gtr_datadir])
+if gtr_schemasdir == ''
+ gtr_schemasdir = join_paths(gtr_datadir, 'glib-2.0', 'schemas')
+ message(gtr_schemasdir)
+endif
###########
# Subdirs #
###########
-subdir('build-aux')
subdir('data')
subdir('src')
subdir('po')
subdir('help')
subdir('man')
+enable_gtk_doc = get_option('gtk_doc')
if enable_gtk_doc
subdir('doc/reference')
endif
-output = '\n\n GTranslator ' + gtranslator_version + '\n'
+configure_file(
+ output: 'config.h',
+ configuration: config_h,
+)
+
+meson.add_install_script(
+ 'build-aux/meson/meson_post_install.py',
+ gtr_datadir,
+ gtr_schemasdir,
+)
+
+output = '\n\n GTranslator ' + gtr_version + '\n'
output += ' =========================\n\n'
-output += ' Source ..........................: ' + meson.source_root() + '\n'
-output += ' Prefix ..........................: ' + gtranslator_prefix + '\n'
+output += ' Source ..........................: ' + meson.current_source_dir() + '\n'
+output += ' Prefix ..........................: ' + gtr_prefix + '\n'
output += ' Compiler ........................: ' + cc.get_id() + '\n\n'
output += ' Development options\n'
-output += ' Enable Debug: ...................: ' + gtranslator_debug.to_string() + '\n'
+output += ' Enable Debug: ...................: ' + gtr_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'
+output += ' Now type "ninja -C ' + meson.current_build_dir() + '" to build ' + meson.project_name() +
'\n\n'
message(output)
diff --git a/meson_options.txt b/meson_options.txt
index 9f819ac5..658725e8 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,2 +1 @@
-option('documentation', type: 'boolean', value: false, description: 'use gtk-doc to build documentation')
-option('profile', type: 'combo', choices: [ 'default', 'development' ], value: 'default')
+option('gtk_doc', type: 'boolean', value: false, description: 'use gtk-doc to build documentation')
diff --git a/src/meson.build b/src/meson.build
index e2c24ad9..88bff489 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,113 +1,117 @@
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'])
+subdir('translation-memory')
-gtr_marshal_c = gtr_marshal[0]
-gtr_marshal_h = gtr_marshal[1]
+enum_headers = 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',
+)
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-projects.c',
- 'gtr-progress.c',
- 'gtr-window.c'
+ '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-projects.c',
+ 'gtr-progress.c',
+ 'gtr-window.c',
)
-sources += [gtr_marshal_c, gtr_marshal_h]
+marshal = 'gtr-marshal'
-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',
+sources += gnome.genmarshal(
+ marshal,
+ sources: marshal + '.list',
+ prefix: marshal.underscorify(),
+ extra_args: [
+ '-UG_ENABLE_DEBUG',
+ '--prototypes',
+ ],
+ install_header: true,
+ install_dir: gtr_includedir,
)
enum_types = 'gtr-enum-types'
+
sources += gnome.mkenums(
enum_types,
- sources: header_files,
+ sources: enum_headers,
c_template: enum_types + '.c.template',
- h_template: enum_types + '.h.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'
+ 'gtranslator-menu.ui',
+ 'gtranslator-ui.xml',
+ '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
+ 'gtr-resources',
+ 'gtranslator.gresource.xml',
+ c_name: 'gtr_resources',
+ dependencies: resource_data,
+ export: true,
)
#######################
@@ -116,11 +120,20 @@ sources += gnome.compile_resources(
incs = [
top_inc,
- include_directories('translation-memory'),
+ translation_mem_inc,
]
-subdir('translation-memory')
+libgtranslator = shared_library(
+ meson.project_name(),
+ sources: sources + translation_mem_sources,
+ include_directories: incs,
+ dependencies: gtr_deps,
+)
+libgtranslator_dep = declare_dependency(
+ include_directories: src_inc,
+ link_with: libgtranslator,
+)
###############
# gtranslator #
@@ -128,9 +141,9 @@ subdir('translation-memory')
executable(
meson.project_name(),
- sources + files('main.c'),
- include_directories: incs,
- dependencies: gtranslator_deps,
- install: true,
- install_dir: gtranslator_bindir
+ 'main.c',
+ include_directories: top_inc,
+ dependencies: gtr_deps,
+ objects: libgtranslator.extract_all_objects(),
+ install: true,
)
diff --git a/src/translation-memory/meson.build b/src/translation-memory/meson.build
index 2ed682da..4b794cf8 100644
--- a/src/translation-memory/meson.build
+++ b/src/translation-memory/meson.build
@@ -1,36 +1,33 @@
-memory_resource_data = files(
- 'gtr-translation-memory-dialog.ui',
-)
-
-memory_resource = files('gtr-translation-memory.gresource.xml')
-
-sources += gnome.compile_resources(
- 'gtr-translation-memory-resources', memory_resource,
- source_dir: src_dir,
- dependencies: memory_resource_data,
- export: true
-)
+translation_mem_inc = include_directories('.')
-sources += files(
+translation_mem_sources = files(
+ 'gda/gda-utils.c',
+ 'gda/gtr-gda.c',
'gtr-translation-memory.c',
'gtr-translation-memory-dialog.c',
'gtr-translation-memory-ui.c',
'gtr-translation-memory-utils.c',
)
-subdir('gda')
+resource_data = files('gtr-translation-memory-dialog.ui')
+
+translation_mem_sources += gnome.compile_resources(
+ 'gtr-translation-memory-resources',
+ 'gtr-translation-memory.gresource.xml',
+ dependencies: resource_data,
+ export: true,
+)
# GSettings schema
-memory_schema_conf = configuration_data()
-memory_schema_conf.set('GETTEXT_PACKAGE', meson.project_name())
+translation_mem_schema_conf = configuration_data()
+translation_mem_schema_conf.set('GETTEXT_PACKAGE', meson.project_name())
-memory_schema = 'org.gnome.gtranslator.plugins.translation-memory.gschema.xml'
+schema = 'org.gnome.gtranslator.plugins.translation-memory.gschema.xml'
-schema_xml = configure_file(
- input: memory_schema + '.in',
- output: memory_schema,
+configure_file(
+ input: schema + '.in',
+ output: schema,
+ configuration: translation_mem_schema_conf,
install: true,
- install_dir: gtranslator_schemadir,
- configuration: memory_schema_conf
+ install_dir: gtr_schemasdir,
)
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]