This file is part of MXE. See LICENSE.md for licensing information.

Contains ad hoc patches for cross building.

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Hans Petter Jansson <hpj@cl.no>
Date: Sat, 5 Feb 2022 00:30:55 +0100
Subject: [PATCH 1/3] Insist that ssize_t is defined


diff --git a/util/cairo-missing/cairo-missing.h b/util/cairo-missing/cairo-missing.h
index 1111111..2222222 100644
--- a/util/cairo-missing/cairo-missing.h
+++ b/util/cairo-missing/cairo-missing.h
@@ -37,6 +37,8 @@
 #include <string.h>
 #include <sys/types.h>
 
+#define _SSIZE_T_DEFINED 1
+
 #ifdef _WIN32
 #include <windows.h>
 

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Hans Petter Jansson <hpj@cl.no>
Date: Sat, 5 Feb 2022 00:32:53 +0100
Subject: [PATCH 2/3] When DllMain is not being run, initialize font face mutex


diff --git a/src/win32/cairo-win32-font.c b/src/win32/cairo-win32-font.c
index 1111111..2222222 100644
--- a/src/win32/cairo-win32-font.c
+++ b/src/win32/cairo-win32-font.c
@@ -1679,6 +1679,10 @@ _cairo_win32_font_face_hash_table_destroy (void)
 {
     cairo_hash_table_t *hash_table;
 
+#ifdef CAIRO_WIN32_STATIC_BUILD
+    CAIRO_MUTEX_INITIALIZE ();
+#endif
+
     /* We manually acquire the lock rather than calling
      * _cairo_win32_font_face_hash_table_lock simply to avoid creating
      * the table only to destroy it again. */
@@ -1694,6 +1698,10 @@ _cairo_win32_font_face_hash_table_destroy (void)
 static cairo_hash_table_t *
 _cairo_win32_font_face_hash_table_lock (void)
 {
+#ifdef CAIRO_WIN32_STATIC_BUILD
+    CAIRO_MUTEX_INITIALIZE ();
+#endif
+
     CAIRO_MUTEX_LOCK (_cairo_win32_font_face_mutex);
 
     if (unlikely (cairo_win32_font_face_hash_table == NULL))

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Taj Morton <tajmorton@gmail.com>
Date: Sun, 23 Mar 2025 19:23:59 +0000
Subject: [PATCH 3/3] Include libstdc++ in private (static) link list to link
 with gcc.

Allows C applications to link to libcairo using gcc (as opposed to
g++) by explicitly linking against libstdc++.

diff --git a/src/meson.build b/src/meson.build
index 1111111..2222222 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -264,6 +264,7 @@ libcairo_dep = declare_dependency(link_with: libcairo,
 pkgmod.generate(libcairo,
   description: 'Multi-platform 2D graphics library',
   subdirs: [meson.project_name()],
+  libraries_private: '-lstdc++',  # Support static linking to cairo using gcc.
 )
 
 meson.override_dependency('cairo', libcairo_dep)
