已开启
Backport upstream MR 94: build support for libical 4.x #7
Funda Wang创建于 7 天前
Backport upstream MR 94: build support for libical 4.x #7
已开启
Funda Wang创建于 7 天前
2 个文件变更+360-2
@@ -0,0 +1,346 @@
1+From c6808fd5827e47a1f2b888fa67373e189cff6297 Mon Sep 17 00:00:00 2001
2+From: Funda Wang <fundawang@yeah.net>
3+Date: Mon, 31 Aug 2026 17:59:34 +0800
4+Subject: [PATCH] Backport upstream MR 94: build support for libical 4.x
5+ 
6+Port the upstream xfce orage merge request 94 ("build: Support libical
7+4.x") onto the 4.18.0 autotools tarball so orage builds against both
8+libical 3.x and 4.x:
9+ 
10+- configure.ac: also require libicalss (>= 3.0) when libical >= 4.0 and
11+ append its flags to LIBICAL_LIBS/LIBICAL_CFLAGS
12+- src/ical-archive.c, src/ical-code.c, src/ical-expimp.c: guard the
13+ libical 4.x API changes (icalrecurrencetype pointer API, by[] arrays,
14+ icaltime_add/icaltime_subtract renames, icalcomponent_clone, const
15+ icaltime_span, NULL varargs sentinel) with ICAL_CHECK_VERSION(4, 0, 0)
16+ 
17+Co-Authored-By: AtomCode (deepseek-v4-flash) <noreply@atomgit.com>
18+---
19+ configure.ac | 6 +++
20+ src/ical-archive.c | 20 +++++----
21+ src/ical-code.c | 101 ++++++++++++++++++++++++++++++++++-----------
22+ src/ical-expimp.c | 4 ++
23+ 4 files changed, 100 insertions(+), 31 deletions(-)
24+ 
25+diff --git a/configure.ac b/configure.ac
26+index a433b08..3adf329 100644
27+--- a/configure.ac
28++++ b/configure.ac
29+@@ -98,6 +98,12 @@ if test "$LIBICAL_VERSION" = "3.0.15"; then
30+ AC_MSG_ERROR(["unsupported libical version $LIBICAL_VERSION, see https://gitlab.xfce.org/apps/orage/-/issues/20"])
31+ fi
32+
33++if pkg-config --atleast-version=4.0 libical; then
34++ XDT_CHECK_PACKAGE([LIBICALSS], [libicalss], [3.0])
35++ LIBICAL_LIBS="$LIBICAL_LIBS $LIBICALSS_LIBS"
36++ LIBICAL_CFLAGS="$LIBICAL_CFLAGS $LIBICALSS_CFLAGS"
37++fi
38++
39+ dnl **********************************
40+ dnl *** check if we have _NL_TIME_FIRST_WEEKDAY
41+ dnl *** note that it is an enum and not a define
42+diff --git a/src/ical-archive.c b/src/ical-archive.c
43+index 18bcc9f..d369e77 100644
44+--- a/src/ical-archive.c
45++++ b/src/ical-archive.c
46+@@ -67,6 +67,12 @@
47+ #include "parameters.h"
48+ #include "interface.h"
49+
50++#if ICAL_CHECK_VERSION(4, 0, 0)
51++#define icalcomponent_new_clone icalcomponent_clone
52++#define icaltime_add icalduration_extend
53++#define icaltime_subtract icalduration_from_times
54++#endif
55++
56+ #ifdef HAVE_ARCHIVE
57+ gboolean xfical_archive_open(void)
58+ {
59+@@ -132,7 +138,11 @@ static void xfical_icalcomponent_archive_recurrent (icalcomponent *e,
60+ const gint threshold_months)
61+ {
62+ struct icaltimetype sdate, edate, nsdate, nedate;
63++#if ICAL_CHECK_VERSION(4, 0, 0)
64++ struct icalrecurrencetype *rrule;
65++#else
66+ struct icalrecurrencetype rrule;
67++#endif
68+ struct icaldurationtype duration;
69+ icalrecur_iterator* ri;
70+ gchar *stz_loc = NULL, *etz_loc = NULL;
71+@@ -249,10 +259,7 @@ static void xfical_icalcomponent_archive_recurrent (icalcomponent *e,
72+ if (stz_loc == NULL)
73+ icalcomponent_add_property(e, icalproperty_new_dtstart(nsdate));
74+ else
75+- icalcomponent_add_property(e
76+- , icalproperty_vanew_dtstart(nsdate
77+- , icalparameter_new_tzid(stz_loc)
78+- , 0));
79++ icalcomponent_add_property (e, icalproperty_vanew_dtstart (nsdate, icalparameter_new_tzid (stz_loc), NULL));
80+ if (upd_edate) {
81+ if (!has_orig_dtend) {
82+ text = g_strdup(icalproperty_as_ical_string(pdtend));
83+@@ -266,10 +273,7 @@ static void xfical_icalcomponent_archive_recurrent (icalcomponent *e,
84+ if (etz_loc == NULL)
85+ icalcomponent_add_property(e, icalproperty_new_dtend(nedate));
86+ else
87+- icalcomponent_add_property(e
88+- , icalproperty_vanew_dtend(nedate
89+- , icalparameter_new_tzid(etz_loc)
90+- , 0));
91++ icalcomponent_add_property (e, icalproperty_vanew_dtend (nedate, icalparameter_new_tzid (etz_loc), NULL));
92+ }
93+ }
94+ }
95+diff --git a/src/ical-code.c b/src/ical-code.c
96+index e28e9c1..0718591 100644
97+--- a/src/ical-code.c
98++++ b/src/ical-code.c
99+@@ -71,6 +71,13 @@
100+ #include "interface.h"
101+ #include "xfical_exception.h"
102+
103++#if ICAL_CHECK_VERSION(4, 0, 0)
104++#define icaltime_add icalduration_extend
105++#define icaltime_subtract icalduration_from_times
106++#define icaldurationtype_from_int icaldurationtype_from_seconds
107++#define icaldurationtype_as_int icaldurationtype_as_seconds
108++#endif
109++
110+ static void xfical_alarm_build_list_internal(gboolean first_list_today);
111+
112+ typedef struct _xfical_timezone_array
113+@@ -900,10 +907,7 @@ static icalcomponent *appt_add_alarm_internal_base(xfical_appt *appt
114+ if (appt->alarm_related_start)
115+ icalcomponent_add_property(ialarm, icalproperty_new_trigger(trg));
116+ else
117+- icalcomponent_add_property(ialarm
118+- , icalproperty_vanew_trigger(trg
119+- , icalparameter_new_related(ICAL_RELATED_END)
120+- , 0));
121++ icalcomponent_add_property (ialarm, icalproperty_vanew_trigger (trg, icalparameter_new_related (ICAL_RELATED_END), NULL));
122+ if (appt->alarm_persistent)
123+ icalcomponent_add_property(ialarm
124+ , icalproperty_new_from_string("X-ORAGE-PERSISTENT-ALARM:YES"));
125+@@ -994,7 +998,11 @@ static void appt_add_exception_internal(xfical_appt *appt
126+ static void appt_add_recur_internal(xfical_appt *appt, icalcomponent *icmp)
127+ {
128+ gchar recur_str[1001], *recur_p, *recur_p2;
129++#if ICAL_CHECK_VERSION(4, 0, 0)
130++ struct icalrecurrencetype *rrule;
131++#else
132+ struct icalrecurrencetype rrule;
133++#endif
134+ struct icaltimetype wtime;
135+ gchar *byday_a[] = {"MO", "TU", "WE", "TH", "FR", "SA", "SU"};
136+ const char *text;
137+@@ -1023,7 +1031,6 @@ static void appt_add_recur_internal(xfical_appt *appt, icalcomponent *icmp)
138+ break;
139+ default:
140+ g_warning ("%s: Unsupported freq", G_STRFUNC);
141+- icalrecurrencetype_clear(&rrule);
142+ }
143+ if (appt->interval > 1) { /* not default, need to insert it */
144+ recur_p += g_sprintf(recur_p, ";INTERVAL=%d", appt->interval);
145+@@ -1082,8 +1089,14 @@ static void appt_add_recur_internal(xfical_appt *appt, icalcomponent *icmp)
146+ if (g_par.ical_weekstartday)
147+ g_sprintf(recur_p, ";WKST=%s", byday_a[g_par.ical_weekstartday]);
148+ }
149++#if ICAL_CHECK_VERSION(4, 0, 0)
150++ rrule = icalrecurrencetype_new_from_string (recur_str);
151++ icalcomponent_add_property (icmp, icalproperty_new_rrule (rrule));
152++ icalrecurrencetype_unref (rrule);
153++#else
154+ rrule = icalrecurrencetype_from_string(recur_str);
155+ icalcomponent_add_property(icmp, icalproperty_new_rrule(rrule));
156++#endif
157+ if (appt->type == XFICAL_TYPE_TODO) {
158+ if (appt->recur_todo_base_start)
159+ icalcomponent_add_property(icmp
160+@@ -1117,11 +1130,8 @@ static void appt_add_starttime_internal(xfical_appt *appt, icalcomponent *icmp)
161+ , icalproperty_new_dtstart(wtime));
162+ }
163+ else {
164+- /* FIXME: add this vtimezone to vcalendar if it is not there */
165+- icalcomponent_add_property(icmp
166+- , icalproperty_vanew_dtstart(wtime
167+- , icalparameter_new_tzid(appt->start_tz_loc)
168+- , 0));
169++ /* FIXME: add this vtimezone to vcalendar if it is not there */
170++ icalcomponent_add_property (icmp, icalproperty_vanew_dtstart (wtime, icalparameter_new_tzid (appt->start_tz_loc), NULL));
171+ }
172+ }
173+ else { /* floating time */
174+@@ -1161,17 +1171,11 @@ static void appt_add_endtime_internal(xfical_appt *appt, icalcomponent *icmp)
175+ if (strcmp(appt->end_tz_loc, "UTC") == 0)
176+ wtime = icaltime_convert_to_zone(wtime, utc_icaltimezone);
177+ else if (strcmp(appt->end_tz_loc, "floating") != 0) {
178+- /* FIXME: add this vtimezone to vcalendar if it is not there */
179++ /* FIXME: add this vtimezone to vcalendar if it is not there */
180+ if (appt->type == XFICAL_TYPE_EVENT)
181+- icalcomponent_add_property(icmp
182+- , icalproperty_vanew_dtend(wtime
183+- , icalparameter_new_tzid(appt->end_tz_loc)
184+- , 0));
185++ icalcomponent_add_property (icmp, icalproperty_vanew_dtend (wtime, icalparameter_new_tzid (appt->end_tz_loc), NULL));
186+ else if (appt->type == XFICAL_TYPE_TODO)
187+- icalcomponent_add_property(icmp
188+- , icalproperty_vanew_due(wtime
189+- , icalparameter_new_tzid(appt->end_tz_loc)
190+- , 0));
191++ icalcomponent_add_property (icmp, icalproperty_vanew_due (wtime, icalparameter_new_tzid (appt->end_tz_loc), NULL));
192+ end_time_done = TRUE;
193+ }
194+ }
195+@@ -1602,9 +1606,19 @@ static void ical_appt_get_rrule_internal (G_GNUC_UNUSED icalcomponent *c,
196+ {
197+ struct icalrecurrencetype rrule;
198+ int i, cnt, day;
199++ short by_day;
200+ GDateTime *gdt;
201+
202++#if ICAL_CHECK_VERSION(4, 0, 0)
203++ struct icalrecurrencetype *pr;
204++ pr = icalproperty_get_rrule (p);
205++ if (pr != NULL)
206++ rrule = *pr;
207++ else
208++ memset (&rrule, 0, sizeof (rrule));
209++#else
210+ rrule = icalproperty_get_rrule(p);
211++#endif
212+ switch (rrule.freq) {
213+ case ICAL_DAILY_RECURRENCE:
214+ appt->freq = XFICAL_FREQ_DAILY;
215+@@ -1641,12 +1655,29 @@ static void ical_appt_get_rrule_internal (G_GNUC_UNUSED icalcomponent *c,
216+ else
217+ appt->recur_limit = 0;
218+ }
219++#if ICAL_CHECK_VERSION(4, 0, 0)
220++ if (rrule.by[ICAL_BY_DAY].size > 0)
221++ {
222++#else
223+ if (rrule.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) {
224++#endif
225+ for (i=0; i <= 6; i++)
226+ appt->recur_byday[i] = FALSE;
227+- for (i=0; i <= 6 && rrule.by_day[i] != ICAL_RECURRENCE_ARRAY_MAX; i++) {
228+- cnt = (int)floor((double)(rrule.by_day[i]/8));
229+- day = abs(rrule.by_day[i]-8*cnt);
230++ for (i = 0; i <= 6 &&
231++#if ICAL_CHECK_VERSION(4, 0, 0)
232++ i < rrule.by[ICAL_BY_DAY].size;
233++#else
234++ rrule.by_day[i] != ICAL_RECURRENCE_ARRAY_MAX;
235++#endif
236++ i++)
237++ {
238++#if ICAL_CHECK_VERSION(4, 0, 0)
239++ by_day = rrule.by[ICAL_BY_DAY].data[i];
240++#else
241++ by_day = rrule.by_day[i];
242++#endif
243++ cnt = (int)floor((double)(by_day/8));
244++ day = abs(by_day-8*cnt);
245+ switch (day) {
246+ case ICAL_MONDAY_WEEKDAY:
247+ appt->recur_byday[0] = TRUE;
248+@@ -1680,7 +1711,7 @@ static void ical_appt_get_rrule_internal (G_GNUC_UNUSED icalcomponent *c,
249+ break;
250+ default:
251+ g_critical ("%s: unknown weekday %s: %d/%d (%x)", G_STRFUNC,
252+- appt->uid, rrule.by_day[i], i, rrule.by_day[i]);
253++ appt->uid, by_day, i, by_day);
254+ break;
255+ }
256+ }
257+@@ -2406,7 +2437,11 @@ static alarm_struct *process_alarm_trigger(icalcomponent *c
258+ struct icaltriggertype trg;
259+ icalparameter *trg_related_par;
260+ icalparameter_related rel;
261++#if ICAL_CHECK_VERSION(4, 0, 0)
262++ struct icalrecurrencetype *rrule;
263++#else
264+ struct icalrecurrencetype rrule;
265++#endif
266+ icalrecur_iterator* ri;
267+ xfical_period per;
268+ struct icaltimetype next_alarm_time, next_start_time, next_end_time,
269+@@ -2880,7 +2915,11 @@ static xfical_appt *xfical_appt_get_next_on_day_internal (const gchar *a_day
270+ gboolean recurrent_date_found=FALSE;
271+ char *uid;
272+ xfical_appt *appt;
273++#if ICAL_CHECK_VERSION(4, 0, 0)
274++ struct icalrecurrencetype *rrule;
275++#else
276+ struct icalrecurrencetype rrule;
277++#endif
278+ icalrecur_iterator* ri;
279+ icalcomponent_kind ikind = ICAL_VEVENT_COMPONENT;
280+ const gchar *start_str;
281+@@ -3070,7 +3109,11 @@ static gboolean xfical_mark_calendar_days(GtkCalendar *gtkcal
282+ /* note that this not understand timezones, but gets always raw time,
283+ * which we need to convert to correct timezone */
284+ static void mark_calendar (G_GNUC_UNUSED icalcomponent *c,
285++#if ICAL_CHECK_VERSION(4, 0, 0)
286++ const icaltime_span *span,
287++#else
288+ icaltime_span *span,
289++#endif
290+ void *data)
291+ {
292+ struct icaltimetype sdate, edate;
293+@@ -3141,7 +3184,11 @@ static void xfical_mark_calendar_from_component(GtkCalendar *gtkcal
294+ {
295+ xfical_period per;
296+ struct icaltimetype nsdate, nedate;
297++#if ICAL_CHECK_VERSION(4, 0, 0)
298++ struct icalrecurrencetype *rrule;
299++#else
300+ struct icalrecurrencetype rrule;
301++#endif
302+ icalrecur_iterator* ri;
303+ icalproperty *p = NULL;
304+ gboolean marked;
305+@@ -3323,7 +3370,11 @@ void xfical_mark_calendar(GtkCalendar *gtkcal)
306+
307+ /* note that this not understand timezones, but gets always raw time,
308+ * which we need to convert to correct timezone */
309++#if ICAL_CHECK_VERSION(4, 0, 0)
310++static void add_appt_to_list (icalcomponent *c, const icaltime_span *span, void *data)
311++#else
312+ static void add_appt_to_list(icalcomponent *c, icaltime_span *span , void *data)
313++#endif
314+ {
315+ xfical_appt *appt;
316+ struct icaltimetype sdate, edate;
317+@@ -3468,7 +3519,11 @@ static void xfical_get_each_app_within_time_internal (const gchar *a_day,
318+ data1.orig_start_hour = start.hour;
319+ /* FIXME: hack to fix year to be newer than 1970 based on BUG 9507 */
320+ if (start.year < 1970) {
321++#if ICAL_CHECK_VERSION(4, 0, 0)
322++ c2 = icalcomponent_clone (c);
323++#else
324+ c2 = icalcomponent_new_clone(c);
325++#endif
326+ p = icalcomponent_get_first_property(c2, ICAL_DTSTART_PROPERTY);
327+ start = icalproperty_get_dtstart(p);
328+ g_debug ("%s: Adjusting temporarily old DTSTART time %d", G_STRFUNC,
329+diff --git a/src/ical-expimp.c b/src/ical-expimp.c
330+index 4234933..86bdb43 100644
331+--- a/src/ical-expimp.c
332++++ b/src/ical-expimp.c
333+@@ -67,6 +67,10 @@
334+ #include "parameters.h"
335+ #include "interface.h"
336+
337++#if ICAL_CHECK_VERSION(4, 0, 0)
338++#define icalcomponent_new_clone(_c) icalcomponent_clone (_c)
339++#endif
340++
341+ static void add_event (icalcomponent *c, gboolean *ical_opened)
342+ {
343+ icalcomponent *ca;
344+--
345+2.52.0
346+ 
@@ -2,16 +2,19 @@
2 2 
3Name: orage3Name: orage
4Version: 4.18.04Version: 4.18.0
5-Release: 15+Release: 2
6Summary: Time-managing application for the Xfce desktop environment6Summary: Time-managing application for the Xfce desktop environment
7License: GPL-2.0-or-later7License: GPL-2.0-or-later
8URL: https://docs.xfce.org/apps/orage/start8URL: https://docs.xfce.org/apps/orage/start
9Source0: https://archive.xfce.org/src/apps/%{name}/%{xfceversion}/%{name}-%{version}.tar.bz29Source0: https://archive.xfce.org/src/apps/%{name}/%{xfceversion}/%{name}-%{version}.tar.bz2
10+Patch0: orage-4.18.0-libical4.patch
10BuildRequires: gcc11BuildRequires: gcc
12+BuildRequires: autoconf automake libtool xfce4-dev-tools
11BuildRequires: pkgconfig(gio-2.0) >= 2.58.013BuildRequires: pkgconfig(gio-2.0) >= 2.58.0
12BuildRequires: pkgconfig(glib-2.0) >= 2.58.014BuildRequires: pkgconfig(glib-2.0) >= 2.58.0
13BuildRequires: pkgconfig(gtk+-3.0) >= 3.24.015BuildRequires: pkgconfig(gtk+-3.0) >= 3.24.0
14BuildRequires: pkgconfig(libical) >= 3.016BuildRequires: pkgconfig(libical) >= 3.0
17+BuildRequires: pkgconfig(libicalss)
15BuildRequires: pkgconfig(libnotify) >= 0.7.018BuildRequires: pkgconfig(libnotify) >= 0.7.0
16BuildRequires: pkgconfig(libxfce4ui-2) >= 4.16.019BuildRequires: pkgconfig(libxfce4ui-2) >= 4.16.0
17BuildRequires: pkgconfig(libxfce4util-1.0) >= 4.16.020BuildRequires: pkgconfig(libxfce4util-1.0) >= 4.16.0
@@ -32,7 +35,8 @@ using the Orage Clock plugin for the panel.
32%autosetup -p135%autosetup -p1
33 36 
34%build37%build
35-%configure --disable-static --enable-libical38+autoreconf -fiv
39+%configure --disable-static
36%make_build40%make_build
37 41 
38%install42%install
@@ -51,6 +55,14 @@ using the Orage Clock plugin for the panel.
51%{_metainfodir}/*.appdata.xml55%{_metainfodir}/*.appdata.xml
52 56 
53%changelog57%changelog
58+* Mon Aug 31 2026 Funda Wang <fundawang@yeah.net> - 4.18.0-2
59+- Backport upstream merge request 94 (build: Support libical 4.x) to
60+ build against libical 4.x while keeping libical 3.x support
61+- Regenerate the autotools build files with autoreconf in %build so the
62+ configure.ac change (link libicalss when libical >= 4.0) takes effect
63+- Drop the dead --enable-libical configure flag and add BuildRequires
64+ (autoconf automake libtool xfce4-dev-tools, pkgconfig(libicalss))
65+ 
54* Mon Jul 27 2020 Dillon Chen <dillon.chen@turbolinux.com.cn> - 4.12.1-266* Mon Jul 27 2020 Dillon Chen <dillon.chen@turbolinux.com.cn> - 4.12.1-2
55- Fix source0 url error.67- Fix source0 url error.
56 68