glib: Update from 2.56.2 to 2.58.1

This commit is contained in:
Fredrik Fornwall 2018-10-07 20:44:57 +02:00
parent ee90bf0d67
commit 560c834820
4 changed files with 65 additions and 49 deletions

View File

@ -1,8 +1,7 @@
TERMUX_PKG_HOMEPAGE=https://developer.gnome.org/glib/
TERMUX_PKG_DESCRIPTION="Library providing core building blocks for libraries and applications written in C"
TERMUX_PKG_VERSION=2.56.2
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=d64abd16813501c956c4e123ae79f47f1b58de573df9fdd3b0795f1e2c1aa789
TERMUX_PKG_VERSION=2.58.1
TERMUX_PKG_SHA256=97d6a9d926b6aa3dfaadad3077cfb43eec74432ab455dff14250c769d526d7d6
TERMUX_PKG_SRCURL=https://ftp.gnome.org/pub/gnome/sources/glib/${TERMUX_PKG_VERSION:0:4}/glib-${TERMUX_PKG_VERSION}.tar.xz
# libandroid-support to get langinfo.h in include path.
TERMUX_PKG_DEPENDS="libffi, pcre, libandroid-support"
@ -25,6 +24,8 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
"
termux_step_pre_configure () {
NOCONFIGURE=1 ./autogen.sh
# glib checks for __BIONIC__ instead of __ANDROID__:
CFLAGS="$CFLAGS -D__BIONIC__=1"

View File

@ -109,27 +109,6 @@ diff -uNr glib-2.56.1/glib/gcharset.c glib-2.56.1.mod/glib/gcharset.c
g_once_init_leave (&alias_table, table);
}
diff -uNr glib-2.56.1/glib/gspawn.c glib-2.56.1.mod/glib/gspawn.c
--- glib-2.56.1/glib/gspawn.c 2018-03-12 18:23:37.000000000 +0200
+++ glib-2.56.1.mod/glib/gspawn.c 2018-06-19 14:34:32.527224095 +0300
@@ -1682,7 +1682,7 @@
new_argv = g_new0 (gchar*, argc + 2); /* /bin/sh and NULL */
- new_argv[0] = (char *) "/bin/sh";
+ new_argv[0] = (char *) "@TERMUX_PREFIX@/bin/sh";
new_argv[1] = (char *) file;
while (argc > 0)
{
@@ -1761,7 +1761,7 @@
* what to search if PATH is unset. POSIX may, dunno.
*/
- path = "/bin:/usr/bin:.";
+ path = "@TERMUX_PREFIX@/bin:@TERMUX_PREFIX@/bin/applets:.";
}
len = strlen (file) + 1;
diff -uNr glib-2.56.1/glib/gutils.c glib-2.56.1.mod/glib/gutils.c
--- glib-2.56.1/glib/gutils.c 2018-01-08 23:34:19.000000000 +0200
+++ glib-2.56.1.mod/glib/gutils.c 2018-06-19 14:35:11.100559415 +0300

View File

@ -0,0 +1,31 @@
diff -u -r ../glib-2.58.1/glib/gspawn.c ./glib/gspawn.c
--- ../glib-2.58.1/glib/gspawn.c 2018-09-21 14:23:53.000000000 +0000
+++ ./glib/gspawn.c 2018-10-07 18:17:08.394012273 +0000
@@ -30,7 +30,9 @@
#include <string.h>
#include <stdlib.h> /* for fdwalk */
#include <dirent.h>
+#ifdef HAVE_POSIX_SPAWN
#include <spawn.h>
+#endif
#ifdef HAVE_CRT_EXTERNS_H
#include <crt_externs.h> /* for _NSGetEnviron */
@@ -2020,7 +2022,7 @@
new_argv = g_new0 (gchar*, argc + 2); /* /bin/sh and NULL */
- new_argv[0] = (char *) "/bin/sh";
+ new_argv[0] = (char *) "@TERMUX_PREFIX@/bin/sh";
new_argv[1] = (char *) file;
while (argc > 0)
{
@@ -2099,7 +2101,7 @@
* what to search if PATH is unset. POSIX may, dunno.
*/
- path = "/bin:/usr/bin:.";
+ path = "@TERMUX_PREFIX@/bin:@TERMUX_PREFIX@/bin/applets:.";
}
len = strlen (file) + 1;

View File

@ -1,6 +1,6 @@
diff -u -r ../glib-2.54.2/glib/gtimezone.c ./glib/gtimezone.c
--- ../glib-2.54.2/glib/gtimezone.c 2017-07-14 01:03:39.000000000 +0200
+++ ./glib/gtimezone.c 2018-01-07 23:20:34.447775267 +0100
diff -u -r ../glib-2.58.1/glib/gtimezone.c ./glib/gtimezone.c
--- ../glib-2.58.1/glib/gtimezone.c 2018-09-21 14:23:53.000000000 +0000
+++ ./glib/gtimezone.c 2018-10-07 18:37:37.275489744 +0000
@@ -43,6 +43,10 @@
#include <windows.h>
#endif
@ -12,7 +12,7 @@ diff -u -r ../glib-2.54.2/glib/gtimezone.c ./glib/gtimezone.c
/**
* SECTION:timezone
* @title: GTimeZone
@@ -392,7 +396,131 @@
@@ -399,7 +403,136 @@
gtz->transitions = NULL;
}
@ -28,7 +28,8 @@ diff -u -r ../glib-2.54.2/glib/gtimezone.c ./glib/gtimezone.c
+ * https://android.googlesource.com/platform/system/timezone/+/master/zone_compactor/main/java/ZoneCompactor.java
+ */
+static GBytes *
+zone_info_android (const gchar *identifier)
+zone_info_android (const gchar *identifier,
+ gchar **out_identifier)
+{
+ char sys_timezone[PROP_VALUE_MAX];
+ GMappedFile *file;
@ -65,10 +66,10 @@ diff -u -r ../glib-2.54.2/glib/gtimezone.c ./glib/gtimezone.c
+ tzdata = g_mapped_file_get_contents (file);
+ tzdata_length = g_mapped_file_get_length (file);
+ if (tzdata == NULL || tzdata_length < 24)
+ {
+ g_warning ("Too small tzdata file");
+ goto error;
+ }
+ {
+ g_warning ("Too small tzdata file");
+ goto error;
+ }
+
+ header_index_offset = gint32_from_be (*((gint32_be*) (tzdata + 12)));
+ header_data_offset = gint32_from_be (*((gint32_be*) (tzdata + 16)));
@ -89,9 +90,9 @@ diff -u -r ../glib-2.54.2/glib/gtimezone.c ./glib/gtimezone.c
+ current_index = 0;
+ while (current_index < entry_count)
+ {
+ if (!g_uint_checked_mul(&entry_name_start, current_index, index_entry_size) ||
+ !g_uint_checked_add(&entry_name_start, entry_name_start, header_index_offset) ||
+ !g_uint_checked_add(&entry_name_end, entry_name_start, 40))
+ if (!g_uint_checked_mul (&entry_name_start, current_index, index_entry_size) ||
+ !g_uint_checked_add (&entry_name_start, entry_name_start, header_index_offset) ||
+ !g_uint_checked_add (&entry_name_end, entry_name_start, 40))
+ {
+ g_warning ("Overflow when computing entry name offset");
+ goto error;
@ -117,8 +118,8 @@ diff -u -r ../glib-2.54.2/glib/gtimezone.c ./glib/gtimezone.c
+ goto error;
+ }
+
+ if (!g_uint_checked_add(&zoneinfo_start, header_data_offset, entry_offset) ||
+ !g_uint_checked_add(&zoneinfo_end, zoneinfo_start, entry_length) ||
+ if (!g_uint_checked_add (&zoneinfo_start, header_data_offset, entry_offset) ||
+ !g_uint_checked_add (&zoneinfo_end, zoneinfo_start, entry_length) ||
+ zoneinfo_end > tzdata_length)
+ {
+ g_warning ("Too large zoneinfo entry length");
@ -130,6 +131,10 @@ diff -u -r ../glib-2.54.2/glib/gtimezone.c ./glib/gtimezone.c
+ (GDestroyNotify)g_mapped_file_unref,
+ g_mapped_file_ref (file));
+ g_mapped_file_unref (file);
+
+ if (out_identifier != NULL)
+ *out_identifier = g_strdup (identifier);
+
+ return zoneinfo;
+ }
+ current_index++;
@ -143,9 +148,9 @@ diff -u -r ../glib-2.54.2/glib/gtimezone.c ./glib/gtimezone.c
+#elif defined(G_OS_UNIX)
+
static GBytes*
zone_info_unix (const gchar *identifier)
{
@@ -436,6 +564,10 @@
zone_info_unix (const gchar *identifier,
gchar **out_identifier)
@@ -506,6 +641,10 @@
return zoneinfo;
}
@ -154,17 +159,17 @@ diff -u -r ../glib-2.54.2/glib/gtimezone.c ./glib/gtimezone.c
+#ifdef G_OS_UNIX
+
static void
init_zone_from_iana_info (GTimeZone *gtz, GBytes *zoneinfo)
{
@@ -1387,7 +1519,11 @@
init_zone_from_iana_info (GTimeZone *gtz,
GBytes *zoneinfo,
@@ -1483,7 +1622,11 @@
if (tz->t_info == NULL)
{
#ifdef G_OS_UNIX
+# ifdef __ANDROID__
+ GBytes *zoneinfo = zone_info_android (identifier);
+ GBytes *zoneinfo = zone_info_android (identifier, &resolved_identifier);
+# else
GBytes *zoneinfo = zone_info_unix (identifier);
GBytes *zoneinfo = zone_info_unix (identifier, &resolved_identifier);
+# endif
if (!zoneinfo)
zone_for_constant_offset (tz, "UTC");
else
if (zoneinfo != NULL)
{
init_zone_from_iana_info (tz, zoneinfo, g_steal_pointer (&resolved_identifier));