Index: gio/glib-compile-schemas.c
--- gio/glib-compile-schemas.c.orig	2022-11-10 10:18:47.000000000 +0100
+++ gio/glib-compile-schemas.c	2022-11-25 10:47:26.207349000 +0100
@@ -1591,7 +1591,7 @@
 }
 /* Text {{{2 */
 static void
-text (GMarkupParseContext  *context,
+XXXtext (GMarkupParseContext  *context,
       const gchar          *text,
       gsize                 text_len,
       gpointer              user_data,
@@ -1772,7 +1772,7 @@
 parse_gschema_files (gchar    **files,
                      gboolean   strict)
 {
-  GMarkupParser parser = { start_element, end_element, text, NULL, NULL };
+  GMarkupParser parser = { start_element, end_element, XXXtext, NULL, NULL };
   ParseState state = { 0, };
   const gchar *filename;
   GError *error = NULL;
Index: gio/meson.build
--- gio/meson.build.orig	2022-11-25 10:47:26.207569000 +0100
+++ gio/meson.build	2022-11-25 10:47:54.538867000 +0100
@@ -1094,10 +1094,6 @@
   endforeach
 endif
 
-if build_tests
-    subdir('tests')
-endif
-
 # The following is an example for building internal marshallers that are used
 # by GIO. We cannot guarantee glib-genmarshal availability while building GLib
 # so they are pre-generated and placed into gmarshal-internal.[ch].
Index: gio/tests/gdbus-peer.c
--- gio/tests/gdbus-peer.c.orig	2022-11-10 10:18:47.000000000 +0100
+++ gio/tests/gdbus-peer.c	2022-11-25 10:47:26.207872000 +0100
@@ -28,6 +28,7 @@
 /* for open(2) */
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/socket.h>
 #include <fcntl.h>
 #include <string.h>
 
Index: gio/tests/org.gtk.test.gschema.override
Index: gio/tests/org.gtk.test.gschema.xml
Index: gio/xdgmime/xdgmimecache.h
--- gio/xdgmime/xdgmimecache.h.orig	2022-11-10 10:18:47.000000000 +0100
+++ gio/xdgmime/xdgmimecache.h	2022-11-25 10:47:26.207951000 +0100
@@ -46,6 +46,9 @@
 #define _xdg_mime_cache_get_icon                      XDG_RESERVED_ENTRY(cache_get_icon)
 #define _xdg_mime_cache_get_generic_icon              XDG_RESERVED_ENTRY(cache_get_generic_icon)
 #define _xdg_mime_cache_glob_dump                     XDG_RESERVED_ENTRY(cache_glob_dump)
+#define _xdg_mime_cache_is_valid_mime_type            XDG_RESERVED_ENTRY(cache_is_valid_mime_type)
+#define _xdg_mime_cache_mime_type_equal               XDG_RESERVED_ENTRY(cache_mime_type_equal)
+#define _xdg_mime_cache_media_type_equal              XDG_RESERVED_ENTRY(cache_media_type_equal)
 #endif
 
 extern XdgMimeCache **_caches;
Index: glib/gatomic.c
--- glib/gatomic.c.orig	2022-11-10 10:18:47.000000000 +0100
+++ glib/gatomic.c	2022-11-25 10:47:26.208075000 +0100
@@ -21,6 +21,7 @@
 
 #include "config.h"
 
+#include "gthread.h"
 #include "gatomic.h"
 
 /**
Index: glib/gmem.c
--- glib/gmem.c.orig	2022-11-10 10:18:47.000000000 +0100
+++ glib/gmem.c	2022-11-25 10:47:26.208185000 +0100
@@ -59,6 +59,7 @@
 #include "gbacktrace.h"
 #include "gtestutils.h"
 #include "gthread.h"
+#include "gthreadprivate.h"
 #include "glib_trace.h"
 
 /* notes on macros:
Index: glib/gthread-posix.c
--- glib/gthread-posix.c.orig	2022-11-10 10:18:47.000000000 +0100
+++ glib/gthread-posix.c	2022-11-25 10:47:26.208368000 +0100
@@ -106,7 +106,7 @@
   if G_UNLIKELY (mutex == NULL)
     g_thread_abort (errno, "malloc");
 
-#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+#if defined(PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP) && !defined(__FreeBSD__)
   pthread_mutexattr_init (&attr);
   pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
   pattr = &attr;
@@ -115,7 +115,7 @@
   if G_UNLIKELY ((status = pthread_mutex_init (mutex, pattr)) != 0)
     g_thread_abort (status, "pthread_mutex_init");
 
-#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+#if defined(PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP) && !defined(__FreeBSD__)
   pthread_mutexattr_destroy (&attr);
 #endif
 
@@ -287,10 +287,14 @@
   if G_UNLIKELY (mutex == NULL)
     g_thread_abort (errno, "malloc");
 
+#if defined(PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP) && !defined(__FreeBSD__)
   pthread_mutexattr_init (&attr);
   pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
   pthread_mutex_init (mutex, &attr);
   pthread_mutexattr_destroy (&attr);
+#else
+  pthread_mutex_init (mutex, NULL);
+#endif
 
   return mutex;
 }
Index: glib/meson.build
--- glib/meson.build.orig	2022-11-10 10:18:47.000000000 +0100
+++ glib/meson.build	2022-11-25 10:48:16.117934000 +0100
@@ -434,7 +434,7 @@
   include_directories : [configinc, glibinc])
 
 pkg.generate(libglib,
-  libraries : [libintl_deps],
+  libraries : [],
   libraries_private : [win32_ldflags],
   subdirs : ['glib-2.0'],
   extra_cflags : ['-I${libdir}/glib-2.0/include'] + win32_cflags,
@@ -539,6 +539,3 @@
   )
 endif
 
-if build_tests
-  subdir('tests')
-endif
Index: gmodule/gmodule-dl.c
--- gmodule/gmodule-dl.c.orig	2022-11-10 10:18:47.000000000 +0100
+++ gmodule/gmodule-dl.c	2022-11-25 10:47:26.208595000 +0100
@@ -153,6 +153,7 @@
 static gpointer
 _g_module_self (void)
 {
+#ifndef __FreeBSD__
   gpointer handle;
   
   /* to query symbols from the program itself, special link options
@@ -177,6 +178,9 @@
   unlock_dlerror ();
   
   return handle;
+#else
+  return RTLD_DEFAULT;
+#endif
 }
 
 static void
Index: gobject/meson.build
--- gobject/meson.build.orig	2022-11-10 10:18:47.000000000 +0100
+++ gobject/meson.build	2022-11-25 10:47:26.208665000 +0100
@@ -204,6 +204,3 @@
   )
 endif
 
-if build_tests
-  subdir('tests')
-endif
