[gnome-klotski] Port to meson
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-klotski] Port to meson
- Date: Sat, 12 Jan 2019 00:54:18 +0000 (UTC)
commit 73e6cee04096b261de7eacf6b3c32711648a7900
Author: Jeremy Bicha <jbicha ubuntu com>
Date: Thu Jan 10 21:44:22 2019 -0500
Port to meson
build-aux/meson_post_install.py | 14 ++++++++
data/meson.build | 76 +++++++++++++++++++++++++++++++++++++++++
help/LINGUAS | 19 +++++++++++
meson.build | 37 ++++++++++++++++++++
po/meson.build | 1 +
src/meson.build | 28 +++++++++++++++
6 files changed, 175 insertions(+)
---
diff --git a/build-aux/meson_post_install.py b/build-aux/meson_post_install.py
new file mode 100644
index 0000000..6d18340
--- /dev/null
+++ b/build-aux/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')])
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..89211a4
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,76 @@
+# Install icons
+icon_sizes = ['16', '22', '24', '32', '48']
+foreach size : icon_sizes
+ install_data(
+ join_paths('icons', 'hicolor', '@0@x@0@'.format(size), '@0@.png'.format(meson.project_name())),
+ install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', '@0@x@0@'.format(size), 'apps')
+ )
+endforeach
+# Install scalable icon
+install_data(
+ join_paths('icons', 'hicolor', 'scalable', '@0@.svg'.format(meson.project_name())),
+ install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', 'scalable', 'apps')
+)
+
+# Install symbolic icon
+install_data(
+ join_paths('icons', 'hicolor', 'scalable', '@0 -symbolic svg'.format(meson.project_name())),
+ install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', 'symbolic', 'apps')
+)
+
+# Install extra icon
+install_data(
+ '@0@.svg'.format(meson.project_name()),
+ install_dir : datadir
+)
+
+# Install gschema
+install_data(
+ '@0 gschema xml'.format(project_id),
+ install_dir : join_paths(get_option('datadir'), 'glib-2.0', 'schemas')
+)
+
+# Desktop file
+desktop_file = i18n.merge_file(
+ input: '@0 desktop in'.format(meson.project_name()),
+ output: '@0@.desktop'.format(meson.project_name()),
+ 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 --no-net',
+ desktop_file_validate,
+ args: [
+ desktop_file.full_path()
+ ]
+ )
+endif
+
+# AppData file
+appdata_file = i18n.merge_file(
+ input: '@0 appdata xml in'.format(meson.project_name()),
+ output: '@0 appdata xml'.format(meson.project_name()),
+ po_dir: join_paths(meson.source_root(), 'po'),
+ install: true,
+ install_dir: join_paths(get_option('datadir'), 'metainfo')
+)
+
+# Validate AppData file
+appstream_util = find_program('appstream-util', required: false)
+if appstream_util.found()
+ test(
+ 'validate-appdata', appstream_util,
+ args: [
+ 'validate-relax', appdata_file.full_path()
+ ]
+ )
+endif
+
+# Install man page
+install_man('@0@.6'.format(meson.project_name()))
diff --git a/help/LINGUAS b/help/LINGUAS
new file mode 100644
index 0000000..d200fdc
--- /dev/null
+++ b/help/LINGUAS
@@ -0,0 +1,19 @@
+C
+ca
+cs
+da
+de
+el
+en_GB
+es
+eu
+fr
+hu
+it
+oc
+pl
+sl
+sr
+sr@latin
+sv
+zh_CN
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..18e4b5c
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,37 @@
+project('gnome-klotski', 'vala', 'c',
+ version: '3.31.3')
+
+project_id = 'org.gnome.klotski'
+i18n = import('i18n')
+gnome = import('gnome')
+# used to run post install script
+python3 = import('python3')
+
+gee_dependency = dependency('gee-0.8')
+glib_dependency = dependency('glib-2.0', version: '>= 2.40.0')
+gnome_games_support_dependency = dependency('libgnome-games-support-1')
+gtk_dependency = dependency('gtk+-3.0', version: '>= 3.12.0')
+rsvg_dependency = dependency('librsvg-2.0', version: '>= 2.32.0')
+posix_dependency = meson.get_compiler('vala').find_library('posix')
+
+# Set gettext package name
+add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format (meson.project_name()), language: 'c')
+
+localedir = join_paths(get_option('prefix'), get_option('localedir'))
+datadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
+
+conf = configuration_data ()
+conf.set_quoted ('VERSION', meson.project_version())
+conf.set_quoted ('GETTEXT_PACKAGE', meson.project_name())
+conf.set_quoted ('DATA_DIRECTORY', datadir)
+conf.set_quoted ('LOCALEDIR', localedir)
+
+configure_file(output: 'config.h', configuration: conf)
+config_h_dir = include_directories('.')
+
+subdir('data')
+subdir('po')
+subdir('src')
+
+meson.add_install_script(python3.find_python().path(),
+ join_paths(meson.source_root(), 'build-aux', meson_post_install.py'))
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..e9b77d7
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(meson.project_name(), preset: 'glib')
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..1e72eea
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,28 @@
+resource_files = files ('@0 gresource xml'.format('klotski'))
+resources = gnome.compile_resources ('klotski', resource_files)
+
+executable(meson.project_name(),[
+ 'config.vapi',
+ 'gnome-klotski.vala',
+ 'klotski-window.vala',
+ 'puzzle.vala',
+ 'puzzle-view.vala'
+ ] + resources,
+ install: true,
+ c_args: [
+ '-include', 'config.h'
+ ],
+ vala_args: [
+ '--gresources', resource_files,
+ '--target-glib', '2.44',
+ '--vapidir', join_paths(meson.current_source_dir(), 'vapi')
+ ],
+ dependencies: [
+ gee_dependency,
+ glib_dependency,
+ gnome_games_support_dependency,
+ gtk_dependency,
+ posix_dependency,
+ rsvg_dependency
+ ]
+)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]