[polari/wip/fmuellner/meson: 1/4] build: Support the meson build system
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/meson: 1/4] build: Support the meson build system
- Date: Sun, 5 Mar 2017 01:31:09 +0000 (UTC)
commit c75d943456b1cfca9e77a6d43b0e220f25139804
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Oct 14 08:20:11 2016 +0200
build: Support the meson build system
Meson is the hottest contender to replace the dated autoconf build
system through-out the GNOME project, so supporting it seems like
a good idea, in particular as it can happily coexist with the
existing build system.
Also, did someone mention that it's really fast?
https://bugzilla.gnome.org/show_bug.cgi?id=779599
.gitignore | 1 +
build-aux/meson/meson-postinstall.sh | 5 +++
data/appdata/meson.build | 14 ++++++++
data/icons/meson.build | 2 +
data/meson.build | 36 ++++++++++++++++++++++
help/meson.build | 3 ++
meson.build | 56 ++++++++++++++++++++++++++++++++++
po/meson.build | 2 +
src/meson.build | 55 +++++++++++++++++++++++++++++++++
9 files changed, 174 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 40ccdd3..fb33271 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,7 @@ aclocal.m4
autom4te.cache/
build-aux/*
!build-aux/flatpak
+!build-aux/meson
config.*
configure
data/appdata/*.appdata.valid
diff --git a/build-aux/meson/meson-postinstall.sh b/build-aux/meson/meson-postinstall.sh
new file mode 100755
index 0000000..575aba3
--- /dev/null
+++ b/build-aux/meson/meson-postinstall.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+glib-compile-schemas ${MESON_INSTALL_PREFIX}/share/glib-2.0/schemas
+update-desktop-database -q
+gtk-update-icon-cache -q -t -f ${MESON_INSTALL_PREFIX}/share/icons/hicolor
diff --git a/data/appdata/meson.build b/data/appdata/meson.build
new file mode 100644
index 0000000..69bb3ce
--- /dev/null
+++ b/data/appdata/meson.build
@@ -0,0 +1,14 @@
+appdata = app_id + '.appdata.xml'
+i18n.merge_file('appdata',
+ input: appdata + '.in',
+ output: appdata,
+ po_dir: src_podir,
+ install: true,
+ install_dir: appdatadir)
+
+if (appstream_util.found())
+ test('Validating ' + appdata,
+ appstream_util,
+ args: ['validate', '--nonet', appdata],
+ workdir: meson.current_build_dir())
+endif
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..89b7e41
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,2 @@
+install_subdir('hicolor',
+ install_dir: icondir)
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..8ff0748
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,36 @@
+subdir('appdata')
+subdir('icons')
+
+desktop_file = app_id + '.desktop'
+i18n.merge_file('desktop',
+ input: desktop_file + '.in',
+ output: desktop_file,
+ po_dir: src_podir,
+ install: true,
+ install_dir: desktopdir,
+ type: 'desktop')
+
+if (desktop_file_validate.found())
+ test('Validating ' + desktop_file,
+ desktop_file_validate,
+ args: [desktop_file],
+ workdir: meson.current_build_dir())
+endif
+
+service_conf = configuration_data()
+service_conf.set('bindir', join_paths(prefix, bindir))
+
+services = ['org.freedesktop.Telepathy.Client.Polari.service',
+ app_id + '.service']
+
+foreach s : services
+ configure_file(input: s + '.in',
+ output: s,
+ configuration: service_conf,
+ install_dir: servicedir)
+endforeach
+
+install_data(app_id + '.gschema.xml',
+ install_dir: schemadir)
+install_data(['Polari.client'],
+ install_dir: tpclientdir)
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..d88c01c
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,3 @@
+gnome.yelp(app_id,
+ sources: ['index.page', 'legal.xml'],
+ languages: ['cs', 'de', 'fr', 'hu', 'pt_BR', 'sv'])
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..9960923
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,56 @@
+project('polari', 'c',
+ version: '3.23.91',
+ meson_version: '>= 0.37.0',
+ license: 'GPL2+')
+
+app_id = 'org.gnome.Polari'
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+prefix = get_option('prefix')
+
+bindir = get_option('bindir')
+libdir = get_option('libdir')
+datadir = get_option('datadir')
+
+pkglibdir = join_paths(libdir, meson.project_name())
+pkgdatadir = join_paths(datadir, meson.project_name())
+
+appdatadir = join_paths(datadir, 'appdata')
+desktopdir = join_paths(datadir, 'applications')
+icondir = join_paths(datadir, 'icons')
+schemadir = join_paths(datadir, 'glib-2.0', 'schemas')
+servicedir = join_paths(datadir, 'dbus-1', 'services')
+tpclientdir = join_paths(datadir, 'telepathy', 'clients')
+girdir = join_paths(pkgdatadir, 'gir-1.0')
+typelibdir = join_paths(pkglibdir, 'girepository-1.0')
+
+src_auxdir = join_paths(meson.source_root(), 'build-aux', 'meson')
+src_datadir = join_paths(meson.source_root(), 'data')
+src_podir = join_paths(meson.source_root(), 'po')
+
+gjs_console = find_program('gjs')
+
+desktop_file_validate = find_program('desktop-file-validate', required: false)
+appstream_util = find_program('appstream-util', required: false)
+
+gio = dependency('gio-2.0', version: '>= 2.43.4')
+gtk3 = dependency('gtk+-3.0', version: '>= 3.21.6')
+telepathy_glib = dependency('telepathy-glib')
+girepository = dependency('gobject-introspection-1.0')
+gjs = dependency('gjs-1.0')
+
+cc = meson.get_compiler('c')
+if (cc.has_function('strcasestr'))
+ add_project_arguments('-DHAVE_STRCASECSTR', language: 'c')
+endif
+
+subdir('src')
+subdir('data')
+subdir('po')
+subdir('help')
+
+if (not is_variable('DESTDIR'))
+ meson.add_install_script(join_paths(src_auxdir, 'meson-postinstall.sh'))
+endif
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..fb83741
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,2 @@
+i18n.gettext('polari',
+ args: ['--from-code=UTF-8'])
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..5470ef2
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,55 @@
+script_conf = configuration_data()
+script_conf.set('GJS', gjs_console.path())
+
+script = 'polari-accounts'
+configure_file(input: script + '.in',
+ output: script,
+ configuration: script_conf)
+
+resource_name = app_id + '.data.gresource.xml'
+data_resources = gnome.compile_resources('data-resources',
+ join_paths(src_datadir, resource_name),
+ source_dir: src_datadir,
+ c_name: 'data_resources')
+
+resource_name = app_id + '.src.gresource.xml'
+src_resources = gnome.compile_resources('src-resources',
+ resource_name,
+ c_name: 'src_resources')
+
+exeargs = ['-DPACKAGE_NAME="polari"',
+ '-DPACKAGE_VERSION="@0@"'.format(meson.project_version()),
+ '-DPREFIX="@0@"'.format(prefix),
+ '-DLIBDIR="@0@"'.format(join_paths(prefix, libdir)),
+ '-DPKGLIBDIR="@0@"'.format(join_paths(prefix, pkglibdir))]
+polari = executable('polari',
+ ['polari.c', src_resources, data_resources],
+ dependencies: [gio, girepository, gjs],
+ c_args: exeargs,
+ install: true)
+
+libsources = [join_paths('lib', 'polari-drag-helper.c'),
+ join_paths('lib', 'polari-drag-helper.h'),
+ join_paths('lib', 'polari-room.c'),
+ join_paths('lib', 'polari-room.h'),
+ join_paths('lib', 'polari-util.c'),
+ join_paths('lib', 'polari-util.h')]
+
+libargs = ['-DG_LOG_USE_STRUCTURED',
+ '-DG_LOG_DOMAIN="Polari"']
+libpolari = shared_library('polari-1.0', libsources,
+ dependencies: [gio, gtk3, telepathy_glib],
+ c_args: libargs,
+ install: true,
+ install_dir: pkglibdir)
+
+gnome.generate_gir(libpolari,
+ sources: libsources,
+ nsversion: '1.0',
+ namespace: 'Polari',
+ symbol_prefix: 'polari',
+ identifier_prefix: 'Polari',
+ includes: ['Gio-2.0', 'Gtk-3.0', 'TelepathyGLib-0.12'],
+ install_dir_gir: girdir,
+ install_dir_typelib: typelibdir,
+ install: true)
diff --git a/src/polari-accounts.in b/src/polari-accounts.in
old mode 100644
new mode 100755
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]