Commit 032ac8f3 authored by Paolo Borelli's avatar Paolo Borelli

build: add meson build system

parent 03ada3b0
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'),
)
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,
)
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')
#!/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')])
#!/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"
i18n.gettext(meson.project_name(), preset: 'glib')
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
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment