[d-feet: 3/7] build: Port to meson build system
- From: Thomas Bechtold <toabctl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [d-feet: 3/7] build: Port to meson build system
- Date: Sun, 3 Feb 2019 13:58:51 +0000 (UTC)
commit 84701202b0d1de4273cb39393007aad00e0450e2
Author: Iñigo Martínez <inigomartinez gmail com>
Date: Tue Dec 18 15:55:33 2018 +0100
build: Port to meson build system
meson is a build system focused on speed an ease of use, which
helps speeding up the software development. This patch adds meson
support along autotools.
data/icons/meson.build | 32 ++++++++++++++++++++
data/meson.build | 38 +++++++++++++++++++++++
data/ui/meson.build | 12 ++++++++
help/LINGUAS | 8 +++++
help/meson.build | 10 ++++++
meson.build | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++
meson_options.txt | 1 +
meson_post_install.py | 24 +++++++++++++++
po/meson.build | 1 +
src/dfeet/meson.build | 19 ++++++++++++
src/meson.build | 13 ++++++++
src/tests/meson.build | 26 ++++++++++++++++
12 files changed, 266 insertions(+)
---
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..6ea08fa
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,32 @@
+icon16_data = files(
+ 'hicolor/16x16/apps/org.gnome.dfeet.png',
+ 'hicolor/16x16/apps/dfeet-method-category.png',
+ 'hicolor/16x16/apps/dfeet-method.png',
+ 'hicolor/16x16/apps/dfeet-object.png',
+ 'hicolor/16x16/apps/dfeet-property-category.png',
+ 'hicolor/16x16/apps/dfeet-property.png',
+ 'hicolor/16x16/apps/dfeet-signal-category.png',
+ 'hicolor/16x16/apps/dfeet-signal.png',
+ 'hicolor/16x16/apps/dfeet-icon-default-service.png',
+)
+
+icons = {
+ '16x16': icon16_data,
+ '24x24': 'hicolor/24x24/apps/org.gnome.dfeet.png',
+ '32x32': 'hicolor/32x32/apps/org.gnome.dfeet.png',
+ '48x48': 'hicolor/48x48/apps/org.gnome.dfeet.png',
+ '256x256': 'hicolor/256x256/apps/org.gnome.dfeet.png',
+ 'scalable': 'hicolor/scalable/apps/org.gnome.dfeet.svg',
+}
+
+foreach size, data: icons
+ install_data(
+ data,
+ install_dir: df_datadir / 'icons/hicolor' / size / 'apps',
+ )
+endforeach
+
+install_data(
+ 'HighContrast/scalable/apps/org.gnome.dfeet.svg',
+ install_dir: df_datadir / 'icons/HighContrast/scalable/apps',
+)
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..2d104fb
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,38 @@
+subdir('icons')
+subdir('ui')
+
+desktop_conf = configuration_data()
+desktop_conf.set('PACKAGE', df_name)
+
+desktop = df_namespace + '.desktop'
+
+desktop_in = configure_file(
+ input: desktop + '.in.in',
+ output: '@BASENAME@',
+ configuration: desktop_conf,
+)
+
+custom_target(
+ desktop,
+ input: desktop_in,
+ output: '@BASENAME@',
+ command: intltool_desktop_cmd,
+ install: true,
+ install_dir: df_datadir / 'applications',
+)
+
+appdata = df_namespace + '.appdata.xml'
+
+custom_target(
+ appdata,
+ input: appdata + '.in',
+ output: '@BASENAME@',
+ command: intltool_xml_cmd,
+ install: true,
+ install_dir: df_datadir / 'metainfo',
+)
+
+install_data(
+ df_namespace + '.gschema.xml',
+ install_dir: gio_schemasdir,
+)
diff --git a/data/ui/meson.build b/data/ui/meson.build
new file mode 100644
index 0000000..d7e2621
--- /dev/null
+++ b/data/ui/meson.build
@@ -0,0 +1,12 @@
+ui_data = files(
+ 'addconnectiondialog.ui',
+ 'bus.ui',
+ 'executedialog.ui',
+ 'introspection.ui',
+ 'mainwindow.ui',
+)
+
+install_data(
+ ui_data,
+ install_dir: df_pkgdatadir / 'ui',
+)
diff --git a/help/LINGUAS b/help/LINGUAS
new file mode 100644
index 0000000..4a62a25
--- /dev/null
+++ b/help/LINGUAS
@@ -0,0 +1,8 @@
+# please keep this list sorted alphabetically
+cs
+de
+el
+es
+pl
+pt_BR
+sv
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..328a315
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,10 @@
+sources = [
+ 'basics.page',
+ 'index.page',
+]
+
+gnome.yelp(
+ df_name,
+ sources: sources,
+ media: 'figures/icon.png',
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..7604164
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,82 @@
+project(
+ 'd-feet',
+ version: '0.3.15',
+ license: 'GPL2',
+ meson_version: '>= 0.49.0',
+)
+
+df_name = meson.project_name()
+
+df_prefix = get_option('prefix')
+df_bindir = get_option('bindir')
+df_datadir = get_option('datadir')
+df_libdir = get_option('libdir')
+
+df_pkgdatadir = df_datadir / df_name
+df_pkglibdir = df_libdir / df_name
+
+df_namespace = 'org.gnome.dfeet'
+
+gnome = import('gnome')
+i18n = import('i18n')
+python = import('python').find_installation('python3')
+
+# FIXME: workaround for missing path method
+# https://github.com/mesonbuild/meson/pull/4616
+python_path = find_program('python3').path()
+
+source_root = meson.current_source_dir()
+
+data_dir = source_root / 'data'
+po_dir = source_root / 'po'
+src_dir = source_root / 'src'
+
+intltool_merge = find_program('intltool-merge')
+intltool_cache = po_dir / '.intltool-merge-cache'
+intltool_desktop_cmd = [intltool_merge, '-d', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@']
+intltool_xml_cmd = [intltool_merge, '-x', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@']
+
+top_inc = include_directories('.')
+
+df_conf = configuration_data()
+
+values = [
+ # python
+ ['PYTHON', python_path],
+ ['pythondir', python.get_install_dir()],
+ # directories
+ ['pkglibdir', df_prefix / df_pkglibdir],
+ ['pkgdatadir', df_prefix / df_pkgdatadir],
+ # package
+ ['PACKAGE_NAME', df_name],
+ ['PACKAGE_VERSION', meson.project_version()],
+ # i18n
+ ['GETTEXT_PACKAGE', df_name],
+]
+
+foreach value: values
+ df_conf.set(value[0], value[1])
+endforeach
+
+# just check that they exist
+dependency('gtk+-3.0', version: '>= 3.9.4')
+dependency('gobject-introspection-1.0', version: '>= 0.9.6')
+
+gio_schemasdir = dependency('gio-2.0').get_pkgconfig_variable(
+ 'schemasdir',
+ define_variable: ['datadir', df_prefix / df_datadir],
+ default: df_prefix / df_datadir / 'glib-2.0/schemas',
+)
+
+subdir('po')
+subdir('src')
+subdir('data')
+subdir('help')
+
+meson.add_install_script(
+ 'meson_post_install.py',
+ df_datadir,
+ gio_schemasdir,
+ python_path,
+ python.get_install_dir(),
+)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..28e83bb
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1 @@
+option('tests', type: 'boolean', value: true, description: 'build tests')
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 0000000..cba7705
--- /dev/null
+++ b/meson_post_install.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+import sys
+
+if not os.environ.get('DESTDIR'):
+ prefix = os.environ['MESON_INSTALL_PREFIX']
+
+ icondir = os.path.join(prefix, sys.argv[1], 'icons', 'hicolor')
+ print('Updating icon cache...')
+ subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
+
+ print('Compiling gsettings schemas...')
+ subprocess.call(['glib-compile-schemas', sys.argv[2]])
+
+ python = sys.argv[3]
+ pythondir = os.path.join(prefix, sys.argv[4])
+
+ print('Byte-compiling python modules...')
+ subprocess.call([python, '-m', 'compileall', '-f', '-q', pythondir])
+
+ print('Byte-compiling python modules (optimized versions) ...')
+ subprocess.call([python, '-O', '-m', 'compileall', '-f', '-q', pythondir])
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..9448229
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(df_name, preset: 'glib')
diff --git a/src/dfeet/meson.build b/src/dfeet/meson.build
new file mode 100644
index 0000000..f1460d5
--- /dev/null
+++ b/src/dfeet/meson.build
@@ -0,0 +1,19 @@
+df_data = files(
+ '__init__.py',
+ 'application.py',
+ 'addconnectiondialog.py',
+ 'bus_watch.py',
+ 'dbus_utils.py',
+ 'executemethoddialog.py',
+ 'introspection_helper.py',
+ 'introspection.py',
+ 'settings.py',
+ 'uiloader.py',
+ 'wnck_utils.py',
+ 'window.py',
+)
+
+python.install_sources(
+ df_data,
+ subdir: 'dfeet',
+)
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..97fd1a9
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,13 @@
+configure_file(
+ input: df_name + '.in',
+ output: '@BASENAME@',
+ configuration: df_conf,
+ install: true,
+ install_dir: df_bindir,
+)
+
+subdir('dfeet')
+
+if get_option('tests')
+ subdir('tests')
+endif
diff --git a/src/tests/meson.build b/src/tests/meson.build
new file mode 100644
index 0000000..349a029
--- /dev/null
+++ b/src/tests/meson.build
@@ -0,0 +1,26 @@
+test_conf = configuration_data()
+test_conf.set('PYTHON', python_path)
+test_conf.set('DATA_DIR', data_dir)
+test_conf.set('SRC_DIR', src_dir)
+
+test_name = 'tests.py'
+
+test_py = configure_file(
+ input: test_name + '.in',
+ output: '@BASENAME@',
+ configuration: test_conf,
+)
+
+test(
+ test_name,
+ test_py,
+ workdir: meson.current_source_dir(),
+)
+
+run_command(
+ find_program('pycodestyle-3', 'pycodestyle', 'pep8'),
+ '--exclude=".svn,CVS,.bzr,.hg,.git,__pycache__,.\#*"',
+ '--max-line-length=99',
+ '--ignore=E123,E402,W504',
+ src_dir,
+)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]