rdobuilder 516605
diff -rupN --no-dereference Pillow-10.1.0/setup.py Pillow-10.1.0-new/setup.py
rdobuilder 516605
--- Pillow-10.1.0/setup.py	2023-10-15 10:59:17.000000000 +0200
rdobuilder 516605
+++ Pillow-10.1.0-new/setup.py	2023-10-15 17:05:40.196995053 +0200
rdobuilder 516605
@@ -136,7 +136,7 @@ class RequiredDependencyException(Except
rdobuilder 516605
     pass
rdobuilder 516605
 
rdobuilder 516605
 
rdobuilder 516605
-PLATFORM_MINGW = os.name == "nt" and "GCC" in sys.version
rdobuilder 516605
+PLATFORM_MINGW = "mingw32" in os.getenv("CC", "")
rdobuilder 516605
 
rdobuilder 516605
 
rdobuilder 516605
 def _dbg(s, tp=None):
rdobuilder 516605
@@ -509,7 +509,7 @@ class pil_build_ext(build_ext):
rdobuilder 516605
         #
rdobuilder 516605
         # add platform directories
rdobuilder 516605
 
rdobuilder 516605
-        if self.disable_platform_guessing:
rdobuilder 516605
+        if self.disable_platform_guessing or PLATFORM_MINGW:
rdobuilder 516605
             pass
rdobuilder 516605
 
rdobuilder 516605
         elif sys.platform == "cygwin":
rdobuilder 516605
@@ -600,7 +600,7 @@ class pil_build_ext(build_ext):
rdobuilder 516605
         # FIXME: check /opt/stuff directories here?
rdobuilder 516605
 
rdobuilder 516605
         # standard locations
rdobuilder 516605
-        if not self.disable_platform_guessing:
rdobuilder 516605
+        if not self.disable_platform_guessing and not PLATFORM_MINGW:
rdobuilder 516605
             _add_directory(library_dirs, "/usr/local/lib")
rdobuilder 516605
             _add_directory(include_dirs, "/usr/local/include")
rdobuilder 516605
 
rdobuilder 516605
@@ -842,7 +842,7 @@ class pil_build_ext(build_ext):
rdobuilder 516605
         if feature.xcb:
rdobuilder 516605
             libs.append(feature.xcb)
rdobuilder 516605
             defs.append(("HAVE_XCB", None))
rdobuilder 516605
-        if sys.platform == "win32":
rdobuilder 516605
+        if sys.platform == "win32" or PLATFORM_MINGW:
rdobuilder 516605
             libs.extend(["kernel32", "user32", "gdi32"])
rdobuilder 516605
         if struct.unpack("h", b"\0\1")[0] == 1:
rdobuilder 516605
             defs.append(("WORDS_BIGENDIAN", None))
rdobuilder 516605
@@ -857,6 +857,8 @@ class pil_build_ext(build_ext):
rdobuilder 516605
         if feature.freetype:
rdobuilder 516605
             srcs = []
rdobuilder 516605
             libs = ["freetype"]
rdobuilder 516605
+            if sys.platform == "win32" or PLATFORM_MINGW:
rdobuilder 516605
+                libs.extend(["dl"])
rdobuilder 516605
             defs = []
rdobuilder 516605
             if feature.raqm:
rdobuilder 516605
                 if not feature.want_vendor("raqm"):  # using system Raqm
rdobuilder 516605
@@ -879,7 +881,7 @@ class pil_build_ext(build_ext):
rdobuilder 516605
 
rdobuilder 516605
         if feature.lcms:
rdobuilder 516605
             extra = []
rdobuilder 516605
-            if sys.platform == "win32":
rdobuilder 516605
+            if sys.platform == "win32" or PLATFORM_MINGW:
rdobuilder 516605
                 extra.extend(["user32", "gdi32"])
rdobuilder 516605
             self._update_extension("PIL._imagingcms", [feature.lcms] + extra)
rdobuilder 516605
         else:
rdobuilder 516605
@@ -898,7 +900,7 @@ class pil_build_ext(build_ext):
rdobuilder 516605
         else:
rdobuilder 516605
             self._remove_extension("PIL._webp")
rdobuilder 516605
 
rdobuilder 516605
-        tk_libs = ["psapi"] if sys.platform in ("win32", "cygwin") else []
rdobuilder 516605
+        tk_libs = ["psapi"] if sys.platform in ("win32", "cygwin") or PLATFORM_MINGW else []
rdobuilder 516605
         self._update_extension("PIL._imagingtk", tk_libs)
rdobuilder 516605
 
rdobuilder 516605
         build_ext.build_extensions(self)
rdobuilder 516605
diff -rupN --no-dereference Pillow-10.1.0/src/libImaging/ImPlatform.h Pillow-10.1.0-new/src/libImaging/ImPlatform.h
rdobuilder 516605
--- Pillow-10.1.0/src/libImaging/ImPlatform.h	2023-10-15 10:59:17.000000000 +0200
rdobuilder 516605
+++ Pillow-10.1.0-new/src/libImaging/ImPlatform.h	2023-10-15 17:05:40.196995053 +0200
rdobuilder 516605
@@ -28,7 +28,7 @@
rdobuilder 516605
 #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
rdobuilder 516605
 
rdobuilder 516605
 #define WIN32_LEAN_AND_MEAN
rdobuilder 516605
-#include <Windows.h>
rdobuilder 516605
+#include <windows.h>
rdobuilder 516605
 
rdobuilder 516605
 #ifdef __CYGWIN__
rdobuilder 516605
 #undef _WIN64