Skip to content

Commit e8a4a25

Browse files
committed
gnome-calendar: fix build against libical 4.0
gnome-calendar 48.0 fails to compile against libical 4.0 (as shipped by oe-core) because several libical-glib APIs it uses were changed or removed: * i_cal_recurrence_get_by_day()/set_by_day() were replaced by generic accessors taking an ICalRecurrenceByRule selector, i.e. i_cal_recurrence_get_by()/set_by() with I_CAL_BY_DAY. * i_cal_errno_return() was removed in favour of i_cal_error_icalerrno(). * ICalTime became a registered GObject type and libical-glib now defines its g_autoptr() cleanup function itself, making the local G_DEFINE_AUTOPTR_CLEANUP_FUNC (ICalTime, ...) a redefinition. Add a patch guarding all three on ICAL_CHECK_VERSION(4, 0, 0) so the recipe keeps building against both libical 3.x and 4.x. Upstream has not migrated yet, so a version bump does not help here. Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
1 parent 02f8adb commit e8a4a25

2 files changed

Lines changed: 89 additions & 0 deletions

File tree

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Khem Raj <raj.khem@gmail.com>
3+
Date: Thu, 2 Jul 2026 00:00:00 +0000
4+
Subject: [PATCH] Support building against libical 4.0
5+
6+
libical 4.0 changed several parts of its GObject (libical-glib) API in
7+
ways that break gnome-calendar:
8+
9+
* The per-part recurrence accessors i_cal_recurrence_get_by_day() and
10+
i_cal_recurrence_set_by_day() were removed in favour of generic
11+
accessors i_cal_recurrence_get_by()/i_cal_recurrence_set_by() that
12+
take an ICalRecurrenceByRule selector.
13+
14+
* i_cal_errno_return() was removed; the current error number is now
15+
obtained through i_cal_error_icalerrno().
16+
17+
* ICalTime became a registered GObject-derived type and libical-glib
18+
now defines its g_autoptr() cleanup function itself, so the local
19+
G_DEFINE_AUTOPTR_CLEANUP_FUNC() in gcal-utils.h is a redefinition.
20+
21+
Guard all three on ICAL_CHECK_VERSION(4, 0, 0) so the code keeps
22+
building against both libical 3.x and 4.x.
23+
24+
Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues]
25+
26+
Signed-off-by: Khem Raj <raj.khem@gmail.com>
27+
---
28+
src/core/gcal-recurrence.c | 10 ++++++++++
29+
src/gui/importer/gcal-importer.c | 4 ++++
30+
src/utils/gcal-utils.h | 4 ++++
31+
3 files changed, 18 insertions(+)
32+
33+
diff --git a/src/core/gcal-recurrence.c b/src/core/gcal-recurrence.c
34+
index 3d271036..2cdf85c5 100644
35+
--- a/src/core/gcal-recurrence.c
36+
+++ b/src/core/gcal-recurrence.c
37+
@@ -22,6 +22,16 @@
38+
39+
#include <glib.h>
40+
41+
+/* libical 4.0 dropped the per-part i_cal_recurrence_{get,set}_by_day()
42+
+ * accessors in favour of generic ones taking an ICalRecurrenceByRule
43+
+ * selector. Keep the old spelling working when building against it. */
44+
+#if ICAL_CHECK_VERSION (4, 0, 0)
45+
+#define i_cal_recurrence_get_by_day(recur, index) \
46+
+ i_cal_recurrence_get_by ((recur), I_CAL_BY_DAY, (index))
47+
+#define i_cal_recurrence_set_by_day(recur, index, value) \
48+
+ i_cal_recurrence_set_by ((recur), I_CAL_BY_DAY, (index), (value))
49+
+#endif
50+
+
51+
G_DEFINE_BOXED_TYPE (GcalRecurrence, gcal_recurrence, gcal_recurrence_ref, gcal_recurrence_unref)
52+
53+
static void
54+
diff --git a/src/gui/importer/gcal-importer.c b/src/gui/importer/gcal-importer.c
55+
index 7b0bbf10..cfc4eaee 100644
56+
--- a/src/gui/importer/gcal-importer.c
57+
+++ b/src/gui/importer/gcal-importer.c
58+
@@ -147,7 +147,11 @@ read_file_in_thread (GTask *task,
59+
g_assert (g_utf8_validate (contents, length, NULL));
60+
61+
component = i_cal_parser_parse_string (contents);
62+
+#if ICAL_CHECK_VERSION (4, 0, 0)
63+
+ ical_error = i_cal_error_icalerrno ();
64+
+#else
65+
ical_error = i_cal_errno_return ();
66+
+#endif
67+
68+
if (ical_error != I_CAL_NO_ERROR)
69+
{
70+
diff --git a/src/utils/gcal-utils.h b/src/utils/gcal-utils.h
71+
index d7be86d9..0764e6ca 100644
72+
--- a/src/utils/gcal-utils.h
73+
+++ b/src/utils/gcal-utils.h
74+
@@ -47,7 +47,11 @@ typedef void (*GcalAskRecurrenceCallback) (GcalEvent *event,
75+
GcalRecurrenceModType modtype,
76+
gpointer user_data);
77+
78+
+/* libical-glib 4.0 makes ICalTime a registered GObject type and defines the
79+
+ * autoptr cleanup func itself, so only declare it for older libical. */
80+
+#if !ICAL_CHECK_VERSION (4, 0, 0)
81+
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ICalTime, g_object_unref)
82+
+#endif
83+
84+
gchar* gcal_get_weekday (gint i);
85+
86+
--
87+
2.43.0

meta-gnome/recipes-gnome/gnome-calendar/gnome-calendar_48.0.bb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ inherit gnomebase gsettings gtk-icon-cache gettext features_check upstream-versi
2121
REQUIRED_DISTRO_FEATURES = "opengl"
2222
ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"
2323

24+
SRC_URI += "file://0001-Support-building-against-libical-4.0.patch"
25+
2426
SRC_URI[archive.sha256sum] = "e69a5a66be820105a4d823d4dba9b4e6ef9f6e7523978aaf33361ebbb993e604"
2527

2628
FILES:${PN} += " \

0 commit comments

Comments
 (0)