From 24c30dcf09a7777aabf262e01fbdde75c6f283ed Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Sat, 22 Dec 2018 17:35:30 +0100 Subject: [PATCH] buildsystem: switch to using meson --- data/icons/meson.build | 11 ++++ data/meson.build | 91 ++++++++++++++++++++++++++++++ data/mime/org.gnome.meld.xml.in | 2 +- data/org.gnome.meld.appdata.xml.in | 24 ++++---- data/org.gnome.meld.desktop.in | 10 ++-- help/LINGUAS | 6 ++ help/meson.build | 23 ++++++++ meson.build | 37 ++++++++++++ meson_post_install.py | 14 +++++ po/meson.build | 1 + 10 files changed, 201 insertions(+), 18 deletions(-) create mode 100644 data/icons/meson.build create mode 100644 data/meson.build create mode 100644 help/LINGUAS create mode 100644 help/meson.build create mode 100644 meson.build create mode 100644 meson_post_install.py create mode 100644 po/meson.build diff --git a/data/icons/meson.build b/data/icons/meson.build new file mode 100644 index 00000000..adfe7a85 --- /dev/null +++ b/data/icons/meson.build @@ -0,0 +1,11 @@ +# Install hicolor icons + + + +# Install HighContrast icons +install_data( + [ + 'HighContrast/scalable/apps/org.gnome.meld.svg' + ], + install_dir: join_paths(get_option('datadir'), 'icons', 'HighContrast', 'scalable', 'apps') +) \ No newline at end of file diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 00000000..4f91b9cc --- /dev/null +++ b/data/meson.build @@ -0,0 +1,91 @@ +# Install desktop file +desktop_file = i18n.merge_file( + input: '@0@.desktop.in'.format(application_id), + output: '@0@.desktop'.format(application_id), + po_dir: join_paths(meson.source_root(), 'po'), + type: 'desktop', + install: true, + install_dir: join_paths(get_option('datadir'), 'applications') +) +# Validate Desktop file +desktop_file_validate = find_program('desktop-file-validate', required: false) +if desktop_file_validate.found() + test ( + 'Validate desktop file', + desktop_file_validate, + args: desktop_file.full_path() + ) +endif +# Install AppData file +appdata_file = i18n.merge_file( + input: '@0@.appdata.xml.in'.format(application_id), + output: '@0@.appdata.xml'.format(application_id), + po_dir: join_paths(meson.source_root(), 'po'), + install: true, + install_dir: join_paths(get_option('datadir'), 'appdata') +) +# Validate AppData file +appstreamcli = find_program('appstream-util', required: false) +if appstreamcli.found() + test ( + 'Validate appdata file', + appstreamcli, + args: [ + 'validate-relax', + appdata_file.full_path() + ] + ) +endif +# Install Schehma file +install_data( + '@0@.gschema.xml'.format(application_id), + install_dir : join_paths(get_option('datadir'), 'glib-2.0', 'schemas') +) +# Install CSS file +install_data( + [ + files('meld.css') + ], + install_dir: join_paths(get_option('datadir'), meson.project_name()) +) +# Install the UI files +install_data( + [ + 'ui/application.ui', + 'ui/appmenu-fallback.xml', + 'ui/dirdiff-ui.xml', + 'ui/dirdiff.ui', + 'ui/EditableList.ui', + 'ui/encoding-selector.ui', + 'ui/filediff-ui.xml', + 'ui/filediff.ui', + 'ui/findbar.ui', + 'ui/language-selector.ui', + 'ui/meldapp-ui.xml', + 'ui/meldapp.ui', + 'ui/patch-dialog.ui', + 'ui/preferences.ui', + 'ui/shortcuts.ui', + 'ui/tab-placeholder.ui', + 'ui/vcview-ui.xml', + 'ui/vcview.ui' + ], + install_dir: join_paths(get_option('datadir'), meson.project_name(), 'ui') +) +# Install the styles files +install_data( + [ + 'styles/meld-base.xml', + 'styles/meld-dark.xml' + ], + install_dir: join_paths(get_option('datadir'), meson.project_name(), 'styles') +) +# Install the mimetypes +appdata_file = i18n.merge_file( + input: join_paths('mime', '@0@.xml.in'.format(application_id)), + output: '@0@.xml'.format(application_id), + po_dir: join_paths(meson.source_root(), 'po'), + install: true, + install_dir: join_paths(get_option('datadir'), 'mime', 'packages') +) +subdir('icons') \ No newline at end of file diff --git a/data/mime/org.gnome.meld.xml.in b/data/mime/org.gnome.meld.xml.in index 365b9b80..e0d714c7 100644 --- a/data/mime/org.gnome.meld.xml.in +++ b/data/mime/org.gnome.meld.xml.in @@ -1,7 +1,7 @@ - <_comment>Meld comparison description + Meld comparison description diff --git a/data/org.gnome.meld.appdata.xml.in b/data/org.gnome.meld.appdata.xml.in index 857764b6..9cbd95a8 100644 --- a/data/org.gnome.meld.appdata.xml.in +++ b/data/org.gnome.meld.appdata.xml.in @@ -2,22 +2,22 @@ org.gnome.meld.desktop - CC0-1.0 - GPL-2.0+ and CC-BY-SA-3.0 - <_name>Meld - <_summary>Compare and merge your files + CC0-1.0 + GPL-2.0+ and CC-BY-SA-3.0 + Meld + Compare and merge your files - <_p> +

Meld is a visual diff and merge tool targeted at developers. Meld helps you compare files, directories, and version controlled projects. It provides two- and three-way comparison of both files and directories, and supports many version control systems including Git, Mercurial, Bazaar and Subversion. - - <_p> +

+

Meld helps you review code changes, understand patches, and makes enormous merge conflicts slightly less painful. - +

AppMenu @@ -42,9 +42,9 @@ https://gitlab.gnome.org/GNOME/meld/issues http://www.gnome.org/friends/ https://wiki.gnome.org/TranslationProject - kai.willadsen@gmail.com - GNOME - <_developer_name>The GNOME Project + kai.willadsen@gmail.com + GNOME + The GNOME Project meld - +
diff --git a/data/org.gnome.meld.desktop.in b/data/org.gnome.meld.desktop.in index 64466de3..8268e819 100644 --- a/data/org.gnome.meld.desktop.in +++ b/data/org.gnome.meld.desktop.in @@ -1,10 +1,10 @@ [Desktop Entry] -_Name=Meld -_GenericName=Diff Viewer -_X-GNOME-FullName=Meld Diff Viewer -_Comment=Compare and merge your files +Name=Meld +GenericName=Diff Viewer +X-GNOME-FullName=Meld Diff Viewer +Comment=Compare and merge your files # TRANSLATORS: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon! -_Keywords=diff;merge; +Keywords=diff;merge; Exec=meld %F Terminal=false Type=Application diff --git a/help/LINGUAS b/help/LINGUAS new file mode 100644 index 00000000..57b30b6e --- /dev/null +++ b/help/LINGUAS @@ -0,0 +1,6 @@ +cs +de +el +es +pl +sv \ No newline at end of file diff --git a/help/meson.build b/help/meson.build new file mode 100644 index 00000000..13d6d6ba --- /dev/null +++ b/help/meson.build @@ -0,0 +1,23 @@ +help_files = [ + 'C/command-line.page', + 'C/file-changes.page', + 'C/file-filters.page', + 'C/file-mode.page', + 'C/flattened-view.page', + 'C/folder-mode.page', + 'C/index.page', + 'C/introduction.page', + 'C/keyboard-shortcuts.page', + 'C/legal.xml', + 'C/missing-functionality.page', + 'C/preferences.page', + 'C/resolving-conflicts.page', + 'C/text-filters.page', + 'C/vc-mode.page', + 'C/vc-supported.page' +] + + +gnome.yelp(meson.project_name(), + sources: help_files +) diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..48abafe0 --- /dev/null +++ b/meson.build @@ -0,0 +1,37 @@ +project('meld', version: '3.19.1', + meson_version: '>=0.46.0') + +application_id = 'org.gnome.meld' + +python = import('python') +i18n = import('i18n') +gnome = import('gnome') + +python3 = python.find_installation('python3') +if not python3.found() + error('Python 3 is required to build and use Meld') +endif + +dependency('gtk+-3.0', version: '>= 3.20') +dependency('glib-2.0', version: '>= 2.48') +dependency('gtksourceview-3.0', version: '>= 3.20.0') + + + +subdir('data') +subdir('help') +subdir('po') + + +install_data( + [ + 'bin/meld' + ], + install_dir: get_option('bindir') +) +install_subdir( + meson.project_name(), + install_dir: python3.get_path('purelib') +) + +meson.add_install_script('meson_post_install.py') \ No newline at end of file diff --git a/meson_post_install.py b/meson_post_install.py new file mode 100644 index 00000000..83e737e8 --- /dev/null +++ b/meson_post_install.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +from os import environ, path +from subprocess import call + +if not environ.get('DESTDIR', ''): + PREFIX = environ.get('MESON_INSTALL_PREFIX', '/usr/local') + DATA_DIR = path.join(PREFIX, 'share') + print('Updating icon cache...') + call(['gtk-update-icon-cache', '-qtf', path.join(DATA_DIR, 'icons', 'hicolor')]) + print("Compiling new schemas") + call(["glib-compile-schemas", path.join(DATA_DIR, 'glib-2.0', 'schemas')]) + print("Updating desktop database") + call(["update-desktop-database", path.join(DATA_DIR, 'applications')]) \ No newline at end of file diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 00000000..5eab52ee --- /dev/null +++ b/po/meson.build @@ -0,0 +1 @@ +i18n.gettext(meson.project_name(), preset: 'glib') \ No newline at end of file -- GitLab