[almanah/wip/jtojnar/meson: 1/2] build: Add meson build system
- From: Jan Tojnar <jtojnar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [almanah/wip/jtojnar/meson: 1/2] build: Add meson build system
- Date: Wed, 3 Apr 2019 15:11:27 +0000 (UTC)
commit 956d4d1ee81ecab9a82961b93e1eef2c8e85aca3
Author: Jan Tojnar <jtojnar gmail com>
Date: Fri Mar 8 13:11:35 2019 +0100
build: Add meson build system
https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
This breaks intltool translating desktop and appstream with autotools
but it is not a good use of anyones time porting autotools to modern
gettext shortly before dropping it.
build-aux/gpg_check_version.py | 40 +++++++++++
build-aux/post_install.py | 16 +++++
configure.ac | 2 +-
data/almanah.appdata.xml.in | 12 ++--
data/almanah.desktop.in | 8 +--
data/icons/meson.build | 24 +++++++
data/meson.build | 52 ++++++++++++++
meson.build | 128 ++++++++++++++++++++++++++++++++++
meson_options.txt | 2 +
po/POTFILES.in | 7 +-
po/meson.build | 4 ++
src/event-factories/calendar-client.c | 2 +-
src/meson.build | 81 +++++++++++++++++++++
tests/meson.build | 15 ++++
14 files changed, 377 insertions(+), 16 deletions(-)
---
diff --git a/build-aux/gpg_check_version.py b/build-aux/gpg_check_version.py
new file mode 100755
index 0000000..bd1c704
--- /dev/null
+++ b/build-aux/gpg_check_version.py
@@ -0,0 +1,40 @@
+import sys
+import subprocess
+
+# Parses the GPG version from the output of the --version flag.
+# Should work on the output for `gpg`, `gpg2` and `gpgme-config`.
+def parse_version(gpg_output):
+ version_line = gpg_output.splitlines()[0]
+ return version_line.strip().split(' ')[-1]
+
+# Checks whether the GPG version is compatible with the given version.
+# For GPG, this means that the major and minor version should be equal;
+# for GPGME, this means only the major version should be equal.
+def check_version(gpg_version, accepted_version, is_gpgme = False):
+ gpg_major, gpg_minor, gpg_micro = gpg_version.split('.', 2)
+ acc_major, acc_minor, acc_micro = accepted_version.split('.', 2)
+ if is_gpgme:
+ return int(gpg_major) == int(acc_major) and int(gpg_minor) >= int(acc_minor) and int(gpg_micro) >=
int(acc_micro)
+ else:
+ return int(gpg_major) == int(acc_major) and int(gpg_minor) == int(acc_minor) and int(gpg_micro) >=
int(acc_micro)
+
+if len(sys.argv) <= 3:
+ sys.exit(1)
+
+gpg_path = sys.argv[1]
+is_gpgme = True if sys.argv[2].lower() == 'true' else False
+accepted_versions = sys.argv[3:]
+
+# Parse and print the version
+proc = subprocess.Popen([gpg_path, '--version'],
+ stdout=subprocess.PIPE,
+ universal_newlines=True)
+gpg_version = parse_version(proc.stdout.read())
+print(gpg_version, end='')
+
+# Then return whether we're compatible with that version
+for accepted_version in accepted_versions:
+ if check_version(gpg_version, accepted_version, is_gpgme):
+ sys.exit(0)
+
+sys.exit(1)
diff --git a/build-aux/post_install.py b/build-aux/post_install.py
new file mode 100644
index 0000000..aac6992
--- /dev/null
+++ b/build-aux/post_install.py
@@ -0,0 +1,16 @@
+import os
+import subprocess
+import sys
+
+if len(sys.argv) < 3:
+ sys.exit("usage: post_install.py <icondir> <schemadir>")
+
+icondir = sys.argv[1]
+schemadir = sys.argv[2]
+
+if not os.environ.get('DESTDIR'):
+ print('Update icon cache…')
+ subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
+
+ print('Compiling gsettings schemas…')
+ subprocess.call(['glib-compile-schemas', schemadir])
diff --git a/configure.ac b/configure.ac
index 68ecbda..89e312d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -125,7 +125,7 @@ AC_SUBST(STANDARD_LIBS)
dnl Evolution
EDS_MIN_VERSION=2.28
-PKG_CHECK_MODULES(EVO, libecal-1.2 >= 3.5.91 libedataserver-1.2 >= $EDS_MIN_VERSION, have_evo=yes,
have_evo=no)
+PKG_CHECK_MODULES(EVO, libecal-1.2 >= 3.8 libedataserver-1.2 >= $EDS_MIN_VERSION, have_evo=yes, have_evo=no)
if test "x$have_evo" = "xyes"; then
AC_DEFINE(HAVE_EVO, 1, [Defined if libecal-1.2 is installed])
fi
diff --git a/data/almanah.appdata.xml.in b/data/almanah.appdata.xml.in
index 7a81639..1236c1b 100644
--- a/data/almanah.appdata.xml.in
+++ b/data/almanah.appdata.xml.in
@@ -4,18 +4,18 @@
<id>almanah.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0+</project_license>
- <_name>Almanah Diary</_name>
- <_summary>Keep a diary of your life</_summary>
+ <name>Almanah Diary</name>
+ <summary>Keep a diary of your life</summary>
<description>
- <_p>
+ <p>
Almanah Diary is an application to allow you to keep a diary of your life.
- </_p>
- <_p>
+ </p>
+ <p>
You can encrypt the diary to preserve your privacy. It has editing
abilities, including text formatting and printing and shows you a lists
of events which happened (on your computer) for each day (such as tasks
and appointments from Evolution).
- </_p>
+ </p>
</description>
<screenshots>
<screenshot height="450" width="800" type="default">
diff --git a/data/almanah.desktop.in b/data/almanah.desktop.in
index 3fa96ab..00a11b9 100644
--- a/data/almanah.desktop.in
+++ b/data/almanah.desktop.in
@@ -1,9 +1,9 @@
[Desktop Entry]
-_Name=Almanah Diary
-_Comment=Keep a personal diary
-_GenericName=Diary
+Name=Almanah Diary
+Comment=Keep a personal diary
+GenericName=Diary
# TRANSLATORS: Search terms to find this application. Do NOT translate or localize the semicolons! The list
MUST also end with a semicolon!
-_Keywords=diary;journal;
+Keywords=diary;journal;
Exec=almanah
Icon=almanah
Terminal=false
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..f1ac1e7
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,24 @@
+icon_sizes = [
+ '16x16',
+ '22x22',
+ '32x32',
+ '48x48',
+ '256x256',
+]
+
+foreach icon_size : icon_sizes
+ install_data(
+ join_paths(icon_size, 'almanah.png'),
+ install_dir: join_paths(icondir, icon_size, 'apps'),
+ )
+endforeach
+
+install_data(
+ join_paths('scalable', 'almanah-tags-symbolic.svg'),
+ install_dir: join_paths(icondir, 'scalable', 'actions'),
+)
+
+install_data(
+ join_paths('scalable', 'almanah-symbolic.svg'),
+ install_dir: join_paths(icondir, 'scalable', 'apps'),
+)
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..1a5d86f
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,52 @@
+desktop = 'almanah.desktop'
+i18n.merge_file(
+ desktop,
+ type: 'desktop',
+ input: desktop + '.in',
+ output: desktop,
+ po_dir: po_dir,
+ install: true,
+ install_dir: join_paths(datadir, 'applications'),
+)
+if desktop_file_validate.found()
+ test(
+ 'Validating @0@'.format(desktop),
+ desktop_file_validate,
+ args: [desktop],
+ workdir: meson.current_build_dir(),
+ )
+endif
+
+appdata = 'almanah.appdata.xml'
+i18n.merge_file(
+ appdata,
+ input: appdata + '.in',
+ output: appdata,
+ po_dir: po_dir,
+ install: true,
+ install_dir: join_paths(datadir, 'metainfo'),
+)
+if (appstream_util.found())
+ test(
+ 'Validating ' + appdata,
+ appstream_util,
+ args: ['validate', '--nonet', appdata],
+ workdir: meson.current_build_dir(),
+ )
+endif
+
+install_data(
+ 'almanah.convert',
+ install_dir: convertdir,
+)
+
+schema_conf = configuration_data()
+schema_conf.set('GETTEXT_PACKAGE', meson.project_name())
+configure_file(
+ input: 'org.gnome.almanah.gschema.xml.in',
+ output: '@BASENAME@',
+ configuration: schema_conf,
+ install_dir: schemadir,
+)
+
+subdir('icons')
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..30b91ff
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,128 @@
+project(
+ 'almanah',
+ 'c',
+ license: 'GPL3+',
+ version: '0.12.0',
+ default_options: [
+ 'b_ndebug=if-release',
+ ],
+ meson_version: '>= 0.47',
+)
+
+cc = meson.get_compiler('c')
+gnome = import('gnome')
+i18n = import('i18n')
+python3 = import('python3')
+# TODO: switch to python module once meson 0.50 is released
+# https://github.com/mesonbuild/meson/issues/4070
+python = python3.find_python().path()
+data_dir = join_paths(meson.source_root(), 'data')
+po_dir = join_paths(meson.source_root(), 'po')
+
+prefix = get_option('prefix')
+datadir = join_paths(prefix, get_option('datadir'))
+icondir = join_paths(datadir, 'icons', 'hicolor')
+localedir = join_paths(prefix, get_option('localedir'))
+pkgdatadir = join_paths(datadir, meson.project_name())
+schemadir = join_paths(datadir, 'glib-2.0', 'schemas')
+convertdir = join_paths(datadir, 'GConf', 'gsettings')
+
+# Dependencies
+glib = dependency('glib-2.0')
+gtk = dependency('gtk+-3.0', version: '>= 3.15')
+gmodule = dependency('gmodule-2.0')
+gthread = dependency('gthread-2.0')
+gio = dependency('gio-2.0', version: '>= 2.32')
+gtksourceview = dependency('gtksourceview-3.0')
+sqlite = dependency('sqlite3')
+cairo = dependency('cairo')
+atk = dependency('atk')
+gcr = dependency('gcr-base-3')
+cryptui = dependency('cryptui-0.0')
+
+# Options
+evolution_support = get_option('evolution')
+spell_checking_support = get_option('spell_checking')
+
+# Check for GPGME, which doesn't provide a pkgconfig file
+# This code courtesy of seahorse
+min_gpgme_version = '1.0.0'
+gpgme = cc.find_library('gpgme')
+gpgme_config = find_program('gpgme-config')
+gpg_check_version = find_program(join_paths('build-aux', 'gpg_check_version.py'))
+gpgme_version_check = run_command([python, gpg_check_version, gpgme_config.path(), 'true', min_gpgme_version
])
+gpgme_version = gpgme_version_check.stdout()
+message('GPGME version: @0@'.format(gpgme_version))
+if gpgme_version_check.returncode() != 0
+ error('Incompatible version of GPGME. Minimal version required is @0@'.format(min_gpgme_version))
+endif
+
+libecal = dependency('libecal-1.2', version: '>= 3.8', required: evolution_support)
+libedataserver = dependency('libedataserver-1.2', version: '>= 2.28', required: evolution_support)
+have_evolution = libecal.found() and libedataserver.found()
+
+gtkspell = dependency('gtkspell3-3.0', required: spell_checking_support)
+have_spell_check = gtkspell.found()
+
+appstream_util = find_program('appstream-util', required: false)
+desktop_file_validate = find_program('desktop-file-validate', required: false)
+
+almanah_deps = [
+ glib,
+ gtk,
+ gmodule,
+ gthread,
+ gio,
+ gtksourceview,
+ sqlite,
+ cairo,
+ atk,
+ gcr,
+ cryptui,
+ gpgme,
+ libecal,
+ libedataserver,
+ gtkspell,
+]
+
+# configuration
+conf = configuration_data()
+conf.set_quoted('VERSION', '@VCS_TAG@')
+conf.set_quoted('PACKAGE_NAME', meson.project_name())
+conf.set_quoted('PACKAGE_URL', 'https://wiki.gnome.org/Apps/Almanah_Diary')
+conf.set_quoted('PACKAGE_DATA_DIR', pkgdatadir)
+conf.set_quoted('PACKAGE_LOCALE_DIR', localedir)
+conf.set_quoted('MIN_GPGME_VERSION', min_gpgme_version)
+conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+if get_option('buildtype').contains('debug')
+ conf.set('ENABLE_DEBUG', 1)
+endif
+if have_spell_check
+ conf.set('ENABLE_SPELL_CHECKING', 1)
+endif
+if have_evolution
+ conf.set('HAVE_EVO', 1)
+ conf.set('EDS_DISABLE_DEPRECATED', 1)
+endif
+
+config = vcs_tag(
+ input: configure_file(
+ output: 'config.h.in',
+ configuration: conf,
+ ),
+ output: 'config.h',
+)
+
+# Post-install scripts
+meson.add_install_script(
+ python,
+ join_paths(meson.source_root(), 'build-aux', 'post_install.py'),
+ icondir,
+ schemadir,
+)
+
+# Subfolders
+subdir('data')
+subdir('src')
+subdir('po')
+subdir('tests')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..85a6860
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,2 @@
+option('evolution', type: 'feature', value: 'enabled', description: 'Enable Evolution calendar integration')
+option('spell_checking', type: 'feature', value: 'enabled', description: 'Enable spell checking support')
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2d58d06..16c028f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,16 +1,15 @@
# List of source files containing translatable strings.
-[encoding: UTF-8]
data/almanah.appdata.xml.in
data/almanah.desktop.in
-[type: gettext/glade]src/ui/almanah.ui
-[type: gettext/gsettings]data/org.gnome.almanah.gschema.xml.in
+src/ui/almanah.ui
+data/org.gnome.almanah.gschema.xml.in
src/application.c
src/date-entry-dialog.c
src/entry.c
src/events/calendar-appointment.c
src/events/calendar-task.c
src/export-operation.c
-[type: gettext/glade]src/gtk/menus.ui
+src/gtk/menus.ui
src/import-export-dialog.c
src/import-operation.c
src/interface.c
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..15a7c31
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,4 @@
+i18n.gettext(
+ meson.project_name(),
+ preset: 'glib',
+)
diff --git a/src/event-factories/calendar-client.c b/src/event-factories/calendar-client.c
index f0f4726..e76ef3b 100644
--- a/src/event-factories/calendar-client.c
+++ b/src/event-factories/calendar-client.c
@@ -2145,5 +2145,5 @@ calendar_client_set_task_completed (CalendarClient *client,
icalproperty_new_status (status));
}
- e_cal_client_modify_object_sync (esource, ical, CALOBJ_MOD_ALL, NULL, NULL);
+ e_cal_client_modify_object_sync (esource, ical, E_CAL_OBJ_MOD_ALL, NULL, NULL);
}
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..25d7bae
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,81 @@
+enum_headers = [
+ 'event-factory.h',
+]
+
+sources = [
+ 'main.c',
+ 'application.c',
+ 'interface.c',
+ 'main-window.c',
+ 'storage-manager.c',
+ 'search-dialog.c',
+ 'preferences-dialog.c',
+ 'printing.c',
+ 'entry.c',
+ 'event.c',
+ 'event-factory.c',
+ 'event-manager.c',
+ 'date-entry-dialog.c',
+ 'import-export-dialog.c',
+ 'import-operation.c',
+ 'export-operation.c',
+ 'uri-entry-dialog.c',
+ 'widgets/calendar.c',
+ 'widgets/calendar-button.c',
+ 'widgets/eggwrapbox.c',
+ 'widgets/eggwrapbox-enums.c',
+ 'widgets/entry-tags-area.c',
+ 'widgets/hyperlink-tag.c',
+ 'widgets/tag-accessible.c',
+ 'widgets/tag.c',
+ 'widgets/tag-entry.c',
+ 'vfs.c',
+ config,
+]
+
+if have_evolution
+ sources += [
+ 'event-factories/calendar.c',
+ 'event-factories/calendar-client.c',
+ 'event-factories/calendar-sources.c',
+ 'event-factories/e-cell-renderer-color.c',
+ 'event-factories/e-source-selector.c',
+ 'events/calendar-appointment.c',
+ 'events/calendar-task.c',
+ ]
+endif
+
+sources += gnome.compile_resources(
+ 'almanah-resources',
+ 'almanah.gresource.xml',
+ source_dir: [
+ data_dir,
+ ],
+ c_name: 'almanah',
+ export: true,
+)
+
+sources += gnome.mkenums_simple(
+ 'enums',
+ sources: enum_headers,
+)
+
+cflags = [
+ # TODO: get rid of this with autotools
+ '-DHAVE_CONFIG_H=1',
+]
+
+inc = include_directories(
+ '..',
+ 'events',
+ 'event-factories',
+)
+
+almanah = executable(
+ meson.project_name(),
+ sources,
+ dependencies: almanah_deps,
+ include_directories: inc,
+ c_args: cflags,
+ install: true,
+)
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..fc3d9fe
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,15 @@
+cflags = [
+ '-DALMANAH_TESTING',
+]
+
+vfs_test = executable(
+ 'vfs-test',
+ sources: [
+ '../src/vfs.c',
+ 'vfs.c',
+ config,
+ ],
+ dependencies: almanah_deps,
+ include_directories: include_directories('..'),
+ c_args: cflags,
+)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]