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

71 lines
3.0 KiB
Diff

--- a/core/Services/Calendar/EventStore.vala
+++ b/core/Services/Calendar/EventStore.vala
@@ -292,6 +292,7 @@ public class Calendar.EventStore : Objec
// 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
@@ -301,6 +302,9 @@ public class Calendar.EventStore : Objec
} 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.
@@ -311,7 +315,11 @@ public class Calendar.EventStore : Objec
// 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
@@ -56,7 +56,14 @@ libportal_dep = [ dependency('libportal'
add_project_arguments('-DLIBICAL_GLIB_UNSTABLE_API=1', language: 'c')
-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',
--- a/core/Tests/meson.build
+++ b/core/Tests/meson.build
@@ -19,7 +19,11 @@ util_tests = executable(
test('Utils Tests', util_tests, suite: 'core', is_parallel: false)
# We need these three locales to run the tests
-locales = run_command('locale', '-a', check: true).stdout().split('\n')
+locale_bin = find_program('locale', required: false)
+if not locale_bin.found()
+message('EventStore Tests have been disabled, no locale.')
+else
+locales = run_command(locale_bin, '-a', check: true).stdout().split('\n')
if locales.contains ('en_GB.utf8') and locales.contains ('en_US.utf8') and locales.contains ('ar_AE.utf8')
eventstore_tests = executable(
tests_name + '-eventstore',
@@ -30,3 +34,4 @@ if locales.contains ('en_GB.utf8') and l
else
message('EventStore Tests have been disabled, a locale is missing in the system.')
endif
+endif