Commit 1edfc7bb authored by Robert Roth's avatar Robert Roth Committed by Iñigo Martínez

meson: Use best practices

parent 434fa580
# Icons
install_subdir('icons',
install_dir: join_paths(get_option('datadir')),
install_dir: datadir,
exclude_files: [ 'Makefile', 'Makefile.in', 'Makefile.am', 'icon-source.svg','.gitignore' ],
)
......@@ -22,28 +22,31 @@ install_data('swell-foop.css',
install_dir: pkgdatadir,
)
desktop = 'swell-foop.desktop'
# Desktop file
i18n.merge_file(
input: 'swell-foop.desktop.in',
output: 'swell-foop.desktop',
input: desktop + '.in',
output: desktop,
type: 'desktop',
po_dir: podir,
install: true,
install_dir: join_paths(get_option('datadir'), 'applications'),
install_dir: join_paths(datadir, 'applications'),
)
appdata = 'swell-foop.appdata.xml'
# Appdata
i18n.merge_file(
input: 'swell-foop.appdata.xml.in',
output: 'swell-foop.appdata.xml',
type: 'xml',
input: appdata + '.in',
output: appdata,
po_dir: podir,
install: true,
install_dir: join_paths(get_option('datadir'), 'metainfo')
install_dir: join_paths(datadir, 'metainfo')
)
# Gschema
install_data('org.gnome.swell-foop.gschema.xml',
install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas'),
install_dir: join_paths(datadir, 'glib-2.0', 'schemas'),
)
swell_foop_help_pages = [
help_pages = [
'legal.xml',
'index.docbook',
]
swell_foop_help_media = [
help_media = [
'figures/play1.png',
'figures/play2.png',
'figures/play3.png',
......@@ -12,6 +12,6 @@ swell_foop_help_media = [
]
gnome.yelp(meson.project_name(),
sources: swell_foop_help_pages,
media: swell_foop_help_media
sources: help_pages,
media: help_media
)
......@@ -16,20 +16,20 @@ pkgdatadir = join_paths (datadir, 'swell-foop')
glib_min_version = '2.36'
glib = dependency('glib-2.0', version: '>= ' + glib_min_version)
gmodule = dependency('gmodule-2.0')
gobject = dependency('gobject-2.0', version: '>= ' + glib_min_version)
gtk = dependency('gtk+-3.0', version: '>= 3.12')
clutter = dependency('clutter-1.0', version: '>= 1.14.0')
clutter_gtk = dependency('clutter-gtk-1.0', version: '>= 1.5.0')
glib_dep = dependency('glib-2.0', version: '>= ' + glib_min_version)
gmodule_dep = dependency('gmodule-2.0')
gobject_dep = dependency('gobject-2.0', version: '>= ' + glib_min_version)
gtk_dep = dependency('gtk+-3.0', version: '>= 3.12')
clutter_dep = dependency('clutter-1.0', version: '>= 1.14.0')
clutter_gtk_dep = dependency('clutter-gtk-1.0', version: '>= 1.5.0')
# Check for compilers
valac = meson.get_compiler('vala')
cc = meson.get_compiler('c')
# Libraries
libmath = cc.find_library('m')
posix = valac.find_library('posix')
libmath_dep = cc.find_library('m')
posix_dep = valac.find_library('posix')
# Configuration
conf = configuration_data()
......@@ -39,11 +39,7 @@ conf.set_quoted('LOCALEDIR', localedir)
conf.set_quoted('DATADIR', pkgdatadir)
conf.set_quoted('VERSION', meson.project_version())
configure_file(output: 'config.h', configuration: conf)
config_h_dir = include_directories('.')
# Extra scripts
meson.add_install_script('meson_post_install.py')
config_h_inc = include_directories('.')
# Subdirs
subdir('data')
......@@ -51,4 +47,6 @@ subdir('src')
subdir('help')
subdir('po')
config_file = configure_file(output: 'config.h', configuration: conf)
# Extra scripts
meson.add_install_script('meson_post_install.py', datadir)
......@@ -2,15 +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'):
icon_dir = os.path.join(sys.argv[1], 'icons', 'hicolor')
schema_dir = os.path.join(sys.argv[1], 'glib-2.0', 'schemas')
print('Update icon cache...')
subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
subprocess.call(['gtk-update-icon-cache', '-f', '-t', icon_dir])
print('Compiling gsettings schemas...')
subprocess.call(['glib-compile-schemas', schemadir])
subprocess.call(['glib-compile-schemas', schema_dir])
swell_foop_sources = [
sources = [
'config.vapi',
'history.vala',
'game.vala',
......@@ -7,31 +7,27 @@ swell_foop_sources = [
'swell-foop.vala',
]
swell_foop_deps = [
posix,
libmath,
gmodule,
glib,
gobject,
gtk,
clutter,
clutter_gtk,
deps = [
posix_dep,
libmath_dep,
gmodule_dep,
glib_dep,
gobject_dep,
gtk_dep,
clutter_dep,
clutter_gtk_dep,
]
swell_foop_c_flags = [
c_flags = [
'-DVERSION="@0@"'.format (meson.project_version ()),
'-DGETTEXT_PACKAGE="@0@"'.format (meson.project_name()),
'-DLOCALEDIR="@0@"'.format (localedir),
'-DDATADIR="@0@"'.format (pkgdatadir),
]
swell_foop_vala_flags = [
'--target-glib', glib_min_version,
]
executable('swell-foop', swell_foop_sources,
dependencies: swell_foop_deps,
vala_args: swell_foop_vala_flags,
c_args: swell_foop_c_flags,
executable('swell-foop', sources,
dependencies: deps,
include_directories: config_h_inc,
c_args: c_flags,
install: true,
)
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