redox/recipes/libs/glib/redox.patch
2025-09-08 15:01:42 -06:00

215 lines
6.2 KiB
Diff

diff -ruwN '--exclude=subprojects' glib-2.82.5/gio/glocalfile.c source/gio/glocalfile.c
--- glib-2.82.5/gio/glocalfile.c 2025-02-20 06:08:16.000000000 -0700
+++ source/gio/glocalfile.c 2025-09-08 15:00:09.240010601 -0600
@@ -77,6 +77,10 @@
#include "glib-private.h"
+#if defined(__redox__)
+#undef AT_FDCWD
+#endif
+
#ifdef G_OS_WIN32
#include <windows.h>
#include <io.h>
diff -ruwN '--exclude=subprojects' glib-2.82.5/gio/gnetworking.h.in source/gio/gnetworking.h.in
--- glib-2.82.5/gio/gnetworking.h.in 2025-02-20 06:08:16.000000000 -0700
+++ source/gio/gnetworking.h.in 2025-04-21 14:36:14.671018625 -0600
@@ -40,13 +40,17 @@
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
+#if !defined(__redox__)
#include <resolv.h>
+#endif
#include <sys/socket.h>
#include <sys/un.h>
#include <net/if.h>
#include <arpa/inet.h>
+#if !defined(__redox__)
#include <arpa/nameser.h>
+#endif
@NAMESER_COMPAT_INCLUDE@
#ifndef __GI_SCANNER__
diff -ruwN '--exclude=subprojects' glib-2.82.5/gio/gsocket.c source/gio/gsocket.c
--- glib-2.82.5/gio/gsocket.c 2025-02-20 06:08:16.000000000 -0700
+++ source/gio/gsocket.c 2025-06-16 09:52:49.595949295 -0600
@@ -487,6 +487,7 @@
if (!g_socket_get_option (socket, SOL_SOCKET, SO_TYPE, &value, NULL))
{
errsv = get_socket_errno ();
+ fprintf(stderr, "%s:%d\n", __FILE__, __LINE__);
goto err;
}
@@ -513,6 +514,7 @@
if (getsockname (fd, &address.sa, &addrlen) != 0)
{
errsv = get_socket_errno ();
+ fprintf(stderr, "%s:%d\n", __FILE__, __LINE__);
goto err;
}
@@ -531,11 +533,13 @@
if (!g_socket_get_option (socket, SOL_SOCKET, SO_DOMAIN, &family, NULL))
{
errsv = get_socket_errno ();
+ fprintf(stderr, "%s:%d\n", __FILE__, __LINE__);
goto err;
}
#else
/* This will translate to G_IO_ERROR_FAILED on either unix or windows */
errsv = -1;
+ fprintf(stderr, "%s:%d\n", __FILE__, __LINE__);
goto err;
#endif
}
diff -ruwN '--exclude=subprojects' glib-2.82.5/gio/gthreadedresolver.c source/gio/gthreadedresolver.c
--- glib-2.82.5/gio/gthreadedresolver.c 2025-02-20 06:08:16.000000000 -0700
+++ source/gio/gthreadedresolver.c 2025-04-21 14:36:14.672018626 -0600
@@ -579,8 +579,26 @@
return g_task_propagate_pointer (G_TASK (result), error);
}
+#if defined(__redox__)
+gint
+g_resolver_record_type_to_rrtype (GResolverRecordType type)
+{
+ g_return_val_if_reached (-1);
+}
-#if defined(G_OS_UNIX)
+GList *
+g_resolver_records_from_res_query (const gchar *rrname,
+ gint rrtype,
+ const guint8 *answer,
+ gssize len,
+ gint herr,
+ GError **error)
+{
+ return NULL;
+}
+#endif
+
+#if defined(G_OS_UNIX) && !defined(__redox__)
#if defined __BIONIC__ && !defined BIND_4_COMPAT
/* Copy from bionic/libc/private/arpa_nameser_compat.h
@@ -1308,7 +1326,10 @@
for (;;)
{
g_byte_array_set_size (answer, len * 2);
-#if defined(HAVE_RES_NQUERY)
+#if defined(__redox__)
+ //TODO: implement on redox
+ len = -1;
+#elif defined(HAVE_RES_NQUERY)
len = res_nquery (&res, rrname, C_IN, rrtype, answer->data, answer->len);
#else
len = res_query (rrname, C_IN, rrtype, answer->data, answer->len);
diff -ruwN '--exclude=subprojects' glib-2.82.5/gio/gunixmounts.c source/gio/gunixmounts.c
--- glib-2.82.5/gio/gunixmounts.c 2025-02-20 06:08:16.000000000 -0700
+++ source/gio/gunixmounts.c 2025-04-21 14:36:14.672018626 -0600
@@ -1135,6 +1135,37 @@
return NULL;
}
+/* Redox OS {{{2 */
+#elif defined (__redox__)
+
+static char *
+get_mtab_monitor_file (void)
+{
+ /* TODO: Not implemented */
+ return NULL;
+}
+
+static GUnixMountEntry **
+_g_unix_mounts_get_from_file (const char *table_path,
+ uint64_t *time_read_out,
+ size_t *n_entries_out)
+{
+ /* Not implemented, as per _g_get_unix_mounts() below */
+ if (time_read_out != NULL)
+ *time_read_out = 0;
+ if (n_entries_out != NULL)
+ *n_entries_out = 0;
+
+ return NULL;
+}
+
+static GList *
+_g_get_unix_mounts (void)
+{
+ /* TODO: Not implemented */
+ return NULL;
+}
+
/* Common code {{{2 */
#else
#error No _g_get_unix_mounts() implementation for system
@@ -1745,6 +1776,28 @@
if (time_read_out != NULL)
*time_read_out = 0;
if (n_points_out != NULL)
+ *n_points_out = 0;
+ return NULL;
+}
+
+#elif defined(__redox__)
+
+static GList *
+_g_get_unix_mount_points (void)
+{
+ /* Not implemented */
+ return NULL;
+}
+
+static GUnixMountPoint **
+_g_unix_mount_points_get_from_file (const char *table_path,
+ uint64_t *time_read_out,
+ size_t *n_points_out)
+{
+ /* Not implemented */
+ if (time_read_out != NULL)
+ *time_read_out = 0;
+ if (n_points_out != NULL)
*n_points_out = 0;
return NULL;
}
diff -ruwN '--exclude=subprojects' glib-2.82.5/gio/meson.build source/gio/meson.build
--- glib-2.82.5/gio/meson.build 2025-02-20 06:08:16.000000000 -0700
+++ source/gio/meson.build 2025-04-21 14:36:14.672018626 -0600
@@ -18,7 +18,7 @@
gnetworking_h_nameser_compat_include = ''
-if host_system not in ['windows', 'android']
+if host_system not in ['windows', 'android', 'redox']
# Don't check for C_IN on Android since it does not define it in public
# headers, we define it ourselves wherever necessary
if not cc.compiles('''#include <sys/types.h>
@@ -39,7 +39,7 @@
network_libs = [ ]
network_args = [ ]
-if host_system != 'windows'
+if host_system not in ['windows', 'redox']
# res_query()
res_query_test = '''#include <resolv.h>
int main (int argc, char ** argv) {
diff -ruwN '--exclude=subprojects' glib-2.82.5/gio/xdgmime/xdgmimecache.c source/gio/xdgmime/xdgmimecache.c
--- glib-2.82.5/gio/xdgmime/xdgmimecache.c 2025-02-20 06:08:16.000000000 -0700
+++ source/gio/xdgmime/xdgmimecache.c 2025-04-21 14:36:14.673018628 -0600
@@ -22,7 +22,7 @@
#include <fnmatch.h>
#include <assert.h>
-#include <netinet/in.h> /* for ntohl/ntohs */
+#include <arpa/inet.h> /* for ntohl/ntohs */
#ifdef HAVE_MMAP
#include <sys/mman.h>