build: Support libical 4

libical 4 changed several APIs used by GNOME Calendar:

 - libical-glib now provides autoptr cleanup for ICalTime, so only
   define it ourselves for older versions.
 - i_cal_recurrence_get/set_by_day() were removed in favor of the
   dynamically sized by-rule arrays; add local helpers on top of
   i_cal_recurrence_get/set_by().
 - i_cal_errno_return() was renamed to i_cal_error_icalerrno().

Also make the create-tzid event test independent of line folding,
which differs between libical versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-29 08:44:07 -06:00
co-authored by Claude Opus 5.5
parent 8d9eb034c7
commit 8be61e439a
4 changed files with 36 additions and 2 deletions
+6 -2
View File
@@ -323,6 +323,7 @@ event_date_create_tzid (void)
g_autoptr (GDateTime) datetime = NULL;
g_autoptr (GTimeZone) tz = NULL;
g_autofree gchar *ical_string = NULL;
GString *unfolded = NULL;
ECalComponent *comp = NULL;
ICalComponent *ical_comp = NULL;
@@ -352,9 +353,12 @@ event_date_create_tzid (void)
datetime = g_date_time_new (tz, 2017, 8, 18, 3, 00, 00.);
gcal_event_set_date_end (event, datetime);
ical_string = i_cal_component_as_ical_string (ical_comp);
/* Unfold lines, since the folding position differs between libical versions */
unfolded = g_string_new_take (i_cal_component_as_ical_string (ical_comp));
g_string_replace (unfolded, "\r\n ", "", 0);
ical_string = g_string_free (g_steal_pointer (&unfolded), FALSE);
g_assert_true (strstr (ical_string, "DTSTART;TZID=Europe/London:20170818T010000\r\n") != NULL);
g_assert_true (strstr (ical_string, "DTEND;TZID=/freeassociation.sourceforge.net/Europe/London:\r\n 20170818T030000\r\n") != NULL);
g_assert_true (strstr (ical_string, "DTEND;TZID=/freeassociation.sourceforge.net/Europe/London:20170818T030000\r\n") != NULL);
g_clear_pointer (&ical_string, g_free);
g_setenv ("TZ", "UTC", TRUE);