From cd44b476f4ffbf37c5d5f5b996ecd711db925576 Mon Sep 17 00:00:00 2001
From: Milan Crha <mcrha@redhat.com>
Date: Tue, 19 Jul 2022 21:25:45 +0200
Subject: [PATCH] build: Build with gcr4 by default
Use -Dgcr3=true to build against gcr3 instead.
The gcr4 is going to replace gcr3, this change prepares it to do.
it also defaults to build with gcr4 for the same reason.
---
meson.build | 10 +++++++++-
meson_options.txt | 1 +
src/vfs.c | 4 ++++
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 813e67b..b418dce 100644
--- a/meson.build
+++ b/meson.build
@@ -35,9 +35,14 @@ gtksourceview = dependency('gtksourceview-3.0')
sqlite = dependency('sqlite3')
cairo = dependency('cairo')
atk = dependency('atk')
-gcr = dependency('gcr-base-3')
cryptui = dependency('cryptui-0.0')
+if get_option('gcr3')
+ gcr = dependency('gcr-base-3')
+else
+ gcr = dependency('gcr-4', version: '>= 3.90.0')
+endif
+
# Options
evolution_support = get_option('evolution')
spell_checking_support = get_option('spell_checking')
@@ -94,6 +99,9 @@ if have_evolution
# https://gitlab.gnome.org/GNOME/almanah/issues/1
#conf.set('EDS_DISABLE_DEPRECATED', 1)
endif
+if get_option('gcr3')
+ conf.set('HAVE_GCR3', 1)
+endif
config = vcs_tag(
input: configure_file(
diff --git a/meson_options.txt b/meson_options.txt
index 85a6860..0c7af1d 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,2 +1,3 @@
option('evolution', type: 'feature', value: 'enabled', description: 'Enable Evolution calendar integration')
option('spell_checking', type: 'feature', value: 'enabled', description: 'Enable spell checking support')
+option('gcr3', type: 'boolean', value: false, description: 'Build with gcr3; if false, builds with gcr4')
diff --git a/src/vfs.c b/src/vfs.c
index fdc9beb..da238e6 100644
--- a/src/vfs.c
+++ b/src/vfs.c
@@ -44,7 +44,11 @@
#include <fcntl.h>
#define GCR_API_SUBJECT_TO_CHANGE
+#ifdef HAVE_GCR3
#include <gcr/gcr-base.h>
+#else
+#include <gcr/gcr.h>
+#endif
#include <gio/gio.h>
#include <glib.h>
#include <glib/gi18n.h>
--
2.35.1