[gnome-clocks] build: add meson build system



commit 032ac8f3bf590e49cc87f46b93b1b3197156e40d
Author: Paolo Borelli <pborelli gnome org>
Date:   Tue Dec 27 10:34:02 2016 +0100

    build: add meson build system

 data/meson.build             |   56 +++++++++++++++++++++++++++++++++++++
 help/meson.build             |   42 ++++++++++++++++++++++++++++
 meson.build                  |   56 +++++++++++++++++++++++++++++++++++++
 mesonscripts/post_install.py |   19 +++++++++++++
 mesonscripts/release.sh      |   20 +++++++++++++
 po/meson.build               |    1 +
 src/meson.build              |   62 ++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 256 insertions(+), 0 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..d6793bf
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,56 @@
+iconsdir = join_paths(get_option('datadir'), 'icons/hicolor')
+foreach size: ['16x16', '22x22', '32x32', '48x48', '256x256', 'scalable']
+    install_subdir('icons/' + size, install_dir: iconsdir)
+endforeach
+
+install_subdir('images/', install_dir: join_paths(get_option('datadir'), meson.project_name()))
+
+resource_files = files('gnome-clocks.gresource.xml')
+resources = gnome.compile_resources('org.gnome.clocks', resource_files,
+    c_name: 'resources'
+)
+
+custom_target('desktop-file',
+    input: 'org.gnome.clocks.desktop.in',
+    output: 'org.gnome.clocks.desktop',
+    install: true,
+    install_dir: join_paths(get_option('datadir'), 'applications'),
+    command: [msgfmt, '--desktop',
+        '--template', '@INPUT@', '-d', podir, '-o', '@OUTPUT@',
+        '--keyword=X-GNOME-FullName', '--keyword=X-Geoclue-Reason',
+        '--keyword=Name', '--keyword=GenericName', '--keyword=Comment', '--keyword=Keywords'
+    ]
+)
+
+dbusconf = configuration_data()
+dbusconf.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))
+configure_file(
+    input: 'org.gnome.clocks.service.in',
+    output: 'org.gnome.clocks.service',
+    configuration: dbusconf,
+    install: true,
+    install_dir: join_paths(get_option('datadir'), 'dbus-1', 'services'),
+)
+
+custom_target('appdata-file',
+    input: 'org.gnome.clocks.appdata.xml.in',
+    output: 'org.gnome.clocks.appdata.xml',
+    install: true,
+    install_dir: join_paths(get_option('datadir'), 'appdata'),
+    command: [msgfmt, '--xml',
+        '--template', '@INPUT@', '-d', podir, '-o', '@OUTPUT@'],
+)
+
+install_data('org.gnome.clocks.search-provider.ini',
+    install_dir: join_paths(get_option('datadir'), 'gnome-shell', 'search-providers'),
+)
+
+gsettingsconf = configuration_data()
+gsettingsconf.set('GETTEXT_PACKAGE', meson.project_name())
+configure_file(
+    input: 'org.gnome.clocks.gschema.xml.in',
+    output: 'org.gnome.clocks.gschema.xml',
+    configuration: gsettingsconf,
+    install: true,
+    install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas'),
+)
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..dd5bd83
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,42 @@
+help_files = [
+    'alarm-add.page',
+    'alarm-edit.page',
+    'alarm-remove.page',
+    'alarm-snooze-stop.page',
+    'stopwatch.page',
+    'timer.page',
+    'world-add.page',
+    'world-check.page',
+    'world-remove.page',
+    'index.page',
+    'legal.xml'
+]
+
+help_media = [
+    'figures/gnome-clocks.png'
+]
+
+help_linguas = [
+    'ca',
+    'cs',
+    'da',
+    'de',
+    'el',
+    'es',
+    'fi',
+    'fr',
+    'gl',
+    'hu',
+    'id',
+    'ko',
+    'nl',
+    'pt_BR',
+    'ru',
+    'sv'
+]
+
+gnome.yelp(meson.project_version(),
+    sources: help_files,
+    media: help_media,
+    languages: help_linguas,
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..3118911
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,56 @@
+project('gnome-clocks', ['vala', 'c'],
+    version: '3.24.0',
+    license: 'GPL2+',
+    meson_version: '>= 0.37',
+)
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+glib = dependency('glib-2.0', version: '>=2.44')
+gio = dependency('gio-2.0', version: '>=2.44')
+gobject = dependency('gobject-2.0', version: '>=2.44')
+gtk = dependency('gtk+-3.0', version: '>=3.20')
+gsound = dependency('gsound', version: '>=0.98')
+gweather = dependency('gweather-3.0', version: '>=3.14')
+gnomedesktop = dependency('gnome-desktop-3.0', version: '>=3.8')
+geocodeglib = dependency('geocode-glib-1.0', version: '>=1.0')
+libgeoclue = dependency('libgeoclue-2.0', version: '>=2.4')
+
+cc = meson.get_compiler('c')
+math = cc.find_library('m', required: false)
+
+have_first_weekday = cc.compiles('''
+#include <langinfo.h>
+int main() {
+    nl_langinfo(_NL_TIME_FIRST_WEEKDAY);
+}
+''',
+    name: '_NL_TIME_FIRST_WEEKDAY check program'
+)
+
+msgfmt = find_program('msgfmt')
+podir = join_paths(meson.source_root(), 'po')
+
+conf = configuration_data()
+conf.set_quoted('G_LOG_DOMAIN', 'org.gnome.Clocks')
+conf.set_quoted('PACKAGE_NAME', meson.project_name())
+conf.set_quoted('PACKAGE_VERSION', meson.project_version())
+conf.set_quoted('VERSION', meson.project_version())
+conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+conf.set_quoted('DATADIR', join_paths(get_option('prefix'), get_option('datadir')))
+conf.set_quoted('GNOMELOCALEDIR', join_paths(get_option('prefix'), get_option('datadir'), '/locale'))
+if have_first_weekday
+    conf.set('HAVE__NL_TIME_FIRST_WEEKDAY', '1')
+endif
+configure_file(output: 'config.h', configuration: conf)
+config_h_dir = include_directories('.')
+
+meson.add_install_script('mesonscripts/post_install.py')
+
+run_target('release', command: ['mesonscripts/release.sh', meson.project_name(), meson.project_version()])
+
+subdir('data')
+subdir('help')
+subdir('po')
+subdir('src')
diff --git a/mesonscripts/post_install.py b/mesonscripts/post_install.py
new file mode 100755
index 0000000..c1faf09
--- /dev/null
+++ b/mesonscripts/post_install.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python3
+
+import os
+import pathlib
+import subprocess
+
+prefix = pathlib.Path(os.environ.get('MESON_INSTALL_PREFIX', '/usr/local'))
+datadir = prefix / 'share'
+destdir = os.environ.get('DESTDIR', '')
+
+if not destdir:
+    print('Compiling gsettings schemas...')
+    subprocess.call(['glib-compile-schemas', str(datadir / 'glib-2.0' / 'schemas')])
+
+    print('Updating icon cache...')
+    subprocess.call(['gtk-update-icon-cache', '-qtf', str(datadir / 'icons' / 'hicolor')])
+
+    print('Updating desktop database...')
+    subprocess.call(['update-desktop-database', '-q', str(datadir / 'applications')])
diff --git a/mesonscripts/release.sh b/mesonscripts/release.sh
new file mode 100755
index 0000000..6fc6d33
--- /dev/null
+++ b/mesonscripts/release.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+NAME="$1"
+VERSION="$2"
+
+test -n "${MESON_SOURCE_ROOT}" || exit 1
+test -n "${NAME}" || exit 1
+test -n "${VERSION}" || exit 1
+
+cd "${MESON_SOURCE_ROOT}"
+
+echo "Removing old archive…"
+rm -f "${NAME}-${VERSION}.tar"
+rm -f "${NAME}-${VERSION}.tar.xz"
+
+echo "Creating git archive…"
+git archive --prefix="${NAME}-${VERSION}/" --format=tar HEAD -o ${NAME}-${VERSION}.tar
+
+echo "Compressing archive…"
+xz -f "${NAME}-${VERSION}.tar"
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..6d1525e
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,62 @@
+vala_sources = [
+    'alarm.vala',
+    'application.vala',
+    'clock.vala',
+    'geocoding.vala',
+    'main.vala',
+    'search-provider.vala',
+    'stopwatch.vala',
+    'timer.vala',
+    'utils.vala',
+    'widgets.vala',
+    'window.vala',
+    'world.vala'
+]
+
+vapi_sources = [
+    'config.vapi',
+]
+
+c_sources = [
+    'cutils.c'
+]
+
+sources = [
+    vala_sources,
+    vapi_sources,
+    c_sources,
+    resources
+]
+
+vala_args = [
+    '--target-glib', '2.44',
+    '--vapidir', meson.current_source_dir(),
+    '--gresources', resource_files,
+]
+
+c_args = [
+    '-include', 'config.h',
+    '-DGWEATHER_I_KNOW_THIS_IS_UNSTABLE',
+    '-DGNOME_DESKTOP_USE_UNSTABLE_API'
+]
+
+dependencies = [
+    glib,
+    gio,
+    gobject,
+    gtk,
+    gsound,
+    gweather,
+    gnomedesktop,
+    geocodeglib,
+    libgeoclue,
+    math
+]
+
+executable('gnome-clocks', sources,
+    include_directories: config_h_dir,
+    vala_args: vala_args,
+    c_args: c_args,
+    install: true,
+    dependencies: dependencies
+)


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