redox/recipes/libs/glib/redox.patch
2025-04-10 15:20:26 -06:00

168 lines
4.8 KiB
Diff

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-10 14:12:46.307891418 -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/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-10 15:19:32.649611384 -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-10 14:57:29.342807607 -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-10 14:06:57.909467382 -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-10 14:11:44.020815595 -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>