void-packages/srcpkgs/io.elementary.calendar/patches/00-musl.patch

51 lines
2.1 KiB
Diff

--- a/core/Services/Calendar/EventStore.vala
+++ b/core/Services/Calendar/EventStore.vala
@@ -304,6 +304,7 @@ public class Calendar.EventStore : Object {
// number we want, so we convert the pointer address to a uint to get
// the data. Since the pointer address is actually data, using it as a
// pointer will segfault.
+#if HAVE_NL_TIME_WEEK_1STDAY
uint week_day1 = (uint) Posix.NLTime.WEEK_1STDAY.to_string ();
var week_1stday = 0; // Default to 0 if unrecognized data
if (week_day1 == 19971130) { // Sunday
@@ -313,6 +314,9 @@ public class Calendar.EventStore : Object {
} else {
warning ("Unknown value of _NL_TIME_WEEK_1STDAY: %u", week_day1);
}
+#else
+ var week_1stday = 0;
+#endif
/* The offset between GLib and local POSIX numbering.
* If week_1stday is Monday, data is correct for GLib: Monday=1 through Sunday=7,
* so offset is 0.
@@ -323,7 +327,11 @@ public class Calendar.EventStore : Object {
// Get the start of week
// HACK This line produces a string of 3 bytes. It takes the raw value
// of the first one and uses that as the value of week_start.
+#if HAVE_NL_TIME_FIRST_WEEKDAY
int week_start_posix = Posix.NLTime.FIRST_WEEKDAY.to_string ().data[0];
+#else
+ int week_start_posix = 0;
+#endif
var week_start = week_start_posix + glib_offset;
if (week_start == 0) { // Sunday special case
--- a/meson.build
+++ b/meson.build
@@ -48,7 +48,14 @@ else
add_project_arguments('--vapidir', join_paths(meson.current_source_dir(), 'vapi'), language: 'vala')
endif
-m_dep = meson.get_compiler('c').find_library('m', required : false)
+cc = meson.get_compiler('c')
+m_dep = cc.find_library('m', required : false)
+if cc.has_header_symbol('langinfo.h', '_NL_TIME_FIRST_WEEKDAY')
+ add_project_arguments('--define=HAVE_NL_TIME_FIRST_WEEKDAY', language: 'vala')
+endif
+if cc.has_header_symbol('langinfo.h', '_NL_TIME_WEEK_1STDAY')
+ add_project_arguments('--define=HAVE_NL_TIME_WEEK_1STDAY', language: 'vala')
+endif
gresource_calendar = gnome.compile_resources(
'gresource_calendar',