pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

wip/gnome-desktop3: Patch for uselocale() - not provided on NetBSD



Module Name:	pkgsrc-wip
Committed By:	Dan Cîrnaț <dan%alt.md@localhost>
Pushed By:	cirnatdan
Date:		Thu Jun 18 13:47:58 2020 +0200
Changeset:	3d7dd299d93337cbfa74c7d0d0e6e65433fd8901

Modified Files:
	gnome-desktop3/distinfo
Added Files:
	gnome-desktop3/patches/patch-libgnome-desktop_gnome-languages.c
	gnome-desktop3/patches/patch-libgnome-desktop_gnome-wall-clock.c
	gnome-desktop3/patches/patch-tests_wall-clock.c
	gnome-desktop3/patches/patch-tests_wallclock-reftest.c

Log Message:
wip/gnome-desktop3: Patch for uselocale() - not provided on NetBSD

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=3d7dd299d93337cbfa74c7d0d0e6e65433fd8901

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 gnome-desktop3/distinfo                            |   5 +-
 .../patch-libgnome-desktop_gnome-languages.c       | 120 +++++++++++++++++++++
 .../patch-libgnome-desktop_gnome-wall-clock.c      |  37 +++++++
 gnome-desktop3/patches/patch-tests_wall-clock.c    |  54 ++++++++++
 .../patches/patch-tests_wallclock-reftest.c        |  27 +++++
 5 files changed, 242 insertions(+), 1 deletion(-)

diffs:
diff --git a/gnome-desktop3/distinfo b/gnome-desktop3/distinfo
index d0b369b0eb..5737c197d1 100644
--- a/gnome-desktop3/distinfo
+++ b/gnome-desktop3/distinfo
@@ -4,4 +4,7 @@ SHA1 (gnome-desktop-3.36.2.tar.xz) = f55cddb4183399e386e5f10703ab921dedd7f960
 RMD160 (gnome-desktop-3.36.2.tar.xz) = 64d7715f36e383cb763ef5c2b0f29d531050c442
 SHA512 (gnome-desktop-3.36.2.tar.xz) = 764eea5df86a191a4f72a6c5477168795d95d9ad58b53985945e33ab06ea339a1ecf170a1b5ea660d74798c124e58b0f31da6a0b896a0196ea70ce2743604f3d
 Size (gnome-desktop-3.36.2.tar.xz) = 739020 bytes
-SHA1 (patch-aa) = a48ffa33fe2a786694af7b7df705ff2b3ae5d260
+SHA1 (patch-libgnome-desktop_gnome-languages.c) = 23efa81b1d5e9fc1ed4909dbbc65eb6a7c0398ec
+SHA1 (patch-libgnome-desktop_gnome-wall-clock.c) = fb8da1dcb408a78cbc427c69d510eaf2ca8a2fe7
+SHA1 (patch-tests_wall-clock.c) = 8272a46ddfa26c1b72204e7d465a5907d01fc266
+SHA1 (patch-tests_wallclock-reftest.c) = 0e3c39623718f0f5a18f86545ba8e4823796a4db
diff --git a/gnome-desktop3/patches/patch-libgnome-desktop_gnome-languages.c b/gnome-desktop3/patches/patch-libgnome-desktop_gnome-languages.c
new file mode 100644
index 0000000000..4055027bcd
--- /dev/null
+++ b/gnome-desktop3/patches/patch-libgnome-desktop_gnome-languages.c
@@ -0,0 +1,120 @@
+$NetBSD$
+
+Replace usage of uselocale() - not available on NetBSD
+
+--- libgnome-desktop/gnome-languages.c.orig	2020-04-29 01:53:29.072934200 +0000
++++ libgnome-desktop/gnome-languages.c
+@@ -303,16 +303,13 @@ language_name_get_codeset_details (const
+                                    gboolean    *is_utf8)
+ {
+         locale_t locale;
+-        locale_t old_locale;
+         const char *codeset = NULL;
+ 
+         locale = newlocale (LC_CTYPE_MASK, language_name, (locale_t) 0);
+         if (locale == (locale_t) 0)
+                 return;
+ 
+-        old_locale = uselocale (locale);
+-
+-        codeset = nl_langinfo (CODESET);
++        codeset = nl_langinfo_l (CODESET, locale);
+ 
+         if (pcodeset != NULL) {
+                 *pcodeset = g_strdup (codeset);
+@@ -324,7 +321,6 @@ language_name_get_codeset_details (const
+                 *is_utf8 = strcmp (normalized_codeset, "UTF-8") == 0;
+         }
+ 
+-        uselocale (old_locale);
+         freelocale (locale);
+ }
+ 
+@@ -703,14 +699,11 @@ get_translated_language (const char *cod
+         name = NULL;
+         if (language != NULL) {
+                 const char *translated_name;
+-                locale_t loc = 0;
+-                locale_t old_locale = 0;
++                g_autofree char *old_locale = NULL;		
+ 
+                 if (locale != NULL) {
+-                        loc = newlocale (LC_MESSAGES_MASK, locale, (locale_t) 0);
+-                        if (loc == (locale_t) 0)
+-                                return NULL;
+-                        old_locale = uselocale (loc);
++                        old_locale = g_strdup (setlocale (LC_MESSAGES, NULL));
++			setlocale (LC_MESSAGES, locale);
+                 }
+ 
+                 if (is_fallback_language (code)) {
+@@ -723,8 +716,7 @@ get_translated_language (const char *cod
+                 }
+ 
+                 if (locale != NULL) {
+-                        uselocale (old_locale);
+-                        freelocale (loc);
++                        setlocale (LC_MESSAGES, locale);
+                 }
+         }
+ 
+@@ -761,15 +753,12 @@ get_translated_territory (const char *co
+         name = NULL;
+         if (territory != NULL) {
+                 const char *translated_territory;
+-                locale_t loc;
+-                locale_t old_locale;
++                g_autofree char *old_locale = NULL;
+                 g_autofree char *tmp = NULL;
+ 
+                 if (locale != NULL) {
+-                        loc = newlocale (LC_MESSAGES_MASK, locale, (locale_t) 0);
+-                        if (loc == (locale_t) 0)
+-                                return NULL;
+-                        old_locale = uselocale (loc);
++                        old_locale = g_strdup (setlocale (LC_MESSAGES, NULL));
++			setlocale (LC_MESSAGES, locale);
+                 }
+ 
+                 translated_territory = dgettext ("iso_3166", territory);
+@@ -777,8 +766,7 @@ get_translated_territory (const char *co
+                 name = capitalize_utf8_string (tmp);
+ 
+                 if (locale != NULL) {
+-                        uselocale (old_locale);
+-                        freelocale (loc);
++                        setlocale (LC_MESSAGES, old_locale);
+                 }
+         }
+ 
+@@ -1355,17 +1343,13 @@ gnome_get_translated_modifier (const cha
+ {
+         char *retval;
+         GHashTable *modifiers_map;
+-        locale_t loc;
+-        locale_t old_locale;
++	g_autofree char *old_locale = NULL;
+ 
+         g_return_val_if_fail (modifier != NULL, NULL);
+ 
+         if (translation != NULL) {
+-                loc = newlocale (LC_MESSAGES_MASK, translation, (locale_t) 0);
+-                if (loc == (locale_t) 0) {
+-                        return NULL;
+-                }
+-                old_locale = uselocale (loc);
++                old_locale = g_strdup (setlocale (LC_MESSAGES, NULL));
++		setlocale (LC_MESSAGES, translation);
+         }
+ 
+         /* Modifiers as listed in glibc's SUPPORTED file:
+@@ -1405,8 +1389,7 @@ gnome_get_translated_modifier (const cha
+         g_hash_table_destroy (modifiers_map);
+ 
+         if (translation != NULL) {
+-                uselocale (old_locale);
+-                freelocale (loc);
++                setlocale (LC_MESSAGES, old_locale);
+         }
+ 
+         return retval;
diff --git a/gnome-desktop3/patches/patch-libgnome-desktop_gnome-wall-clock.c b/gnome-desktop3/patches/patch-libgnome-desktop_gnome-wall-clock.c
new file mode 100644
index 0000000000..8adb1c1afe
--- /dev/null
+++ b/gnome-desktop3/patches/patch-libgnome-desktop_gnome-wall-clock.c
@@ -0,0 +1,37 @@
+$NetBSD$
+
+Replace usage of uselocale() - not available on NetBSD
+
+--- libgnome-desktop/gnome-wall-clock.c.orig	2020-04-29 01:53:29.076934000 +0000
++++ libgnome-desktop/gnome-wall-clock.c
+@@ -279,22 +279,19 @@ translate_time_format_string (const char
+   const char *locale = g_getenv ("LC_TIME");
+   const char *res;
+   char *sep;
+-  locale_t old_loc;
+-  locale_t loc = (locale_t)0;
++  g_autofree char *old_locale = NULL;
+ 
+-  if (locale)
+-    loc = newlocale (LC_MESSAGES_MASK, locale, (locale_t)0);
+-
+-  old_loc = uselocale (loc);
++  if (locale) {
++    old_locale = g_strdup (setlocale (LC_MESSAGES, NULL));
++    setlocale (LC_MESSAGES, locale);
++  }
+ 
+   sep = strchr (str, '\004');
+   res = g_dpgettext (GETTEXT_PACKAGE, str, sep ? sep - str + 1 : 0);
+ 
+-  uselocale (old_loc);
+-
+-  if (loc != (locale_t)0)
+-    freelocale (loc);
+-
++  if (locale)
++    setlocale (LC_MESSAGES, old_locale);
++  
+   return res;
+ }
+ 
diff --git a/gnome-desktop3/patches/patch-tests_wall-clock.c b/gnome-desktop3/patches/patch-tests_wall-clock.c
new file mode 100644
index 0000000000..65e7bcb4de
--- /dev/null
+++ b/gnome-desktop3/patches/patch-tests_wall-clock.c
@@ -0,0 +1,54 @@
+$NetBSD$
+
+Disable tests that rely on uselocale()
+
+--- tests/wall-clock.c.orig	2020-04-29 01:53:29.099934300 +0000
++++ tests/wall-clock.c
+@@ -30,6 +30,7 @@
+ #define SPACE "  "
+ #define EN_SPACE " "
+ 
++#if !defined(__NetBSD__)
+ static void
+ test_utf8_character (const char *utf8_char,
+                      const char *non_utf8_fallback)
+@@ -149,6 +150,7 @@ test_clock_format_setting (void)
+ 	uselocale (save_locale);
+ 	freelocale (locale);
+ }
++#endif
+ 
+ static gboolean
+ on_notify_clock_timeout (gpointer user_data)
+@@ -194,6 +196,7 @@ test_notify_clock (void)
+ 	g_object_unref (settings);
+ }
+ 
++#if !defined(__NetBSD__)
+ static void
+ test_weekday_setting (void)
+ {
+@@ -245,6 +248,7 @@ test_weekday_setting (void)
+ 	uselocale (save_locale);
+ 	freelocale (locale);
+ }
++#endif
+ 
+ int
+ main (int   argc,
+@@ -254,11 +258,15 @@ main (int   argc,
+ 
+ 	g_test_init (&argc, &argv, NULL);
+ 
++#if !defined(__NetBSD__)
+ 	g_test_add_func ("/wall-clock/colon-vs-ratio", test_colon_vs_ratio);
+ 	g_test_add_func ("/wall-clock/space-vs-en-space", test_space_vs_en_space);
+ 	g_test_add_func ("/wall-clock/24h-clock-format", test_clock_format_setting);
++#endif
+ 	g_test_add_func ("/wall-clock/notify-clock", test_notify_clock);
++#if !defined(__NetBSD__)
+ 	g_test_add_func ("/wall-clock/weekday-setting", test_weekday_setting);
++#endif
+ 
+ 	return g_test_run ();
+ }
diff --git a/gnome-desktop3/patches/patch-tests_wallclock-reftest.c b/gnome-desktop3/patches/patch-tests_wallclock-reftest.c
new file mode 100644
index 0000000000..43c9e4dd87
--- /dev/null
+++ b/gnome-desktop3/patches/patch-tests_wallclock-reftest.c
@@ -0,0 +1,27 @@
+$NetBSD$
+
+Disable tests that rely on uselocale()
+
+--- tests/wallclock-reftest.c.orig	2020-04-29 01:53:29.099934300 +0000
++++ tests/wallclock-reftest.c
+@@ -433,6 +433,7 @@ static void
+ test_ui_file (GFile         *file,
+               gconstpointer  user_data)
+ {
++#if !defined(__NetBSD__)
+   char *ui_file, *reference_file, *locale;
+   cairo_surface_t *ui_image, *reference_image, *diff_image;
+   GtkStyleProvider *provider;
+@@ -494,6 +495,7 @@ test_ui_file (GFile         *file,
+     }
+ 
+   remove_extra_css (provider);
++#endif
+ }
+ 
+ static int
+@@ -612,3 +614,4 @@ main (int argc, char **argv)
+ 
+   return g_test_run ();
+ }
++


Home | Main Index | Thread Index | Old Index