SDL: mingw: add pkg-support files (INSTALL.txt and Makefile)

From c81d11fae4ae13390fc7fa52fac962ef5459937b Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Mon, 18 Mar 2024 01:01:39 +0100
Subject: [PATCH] mingw: add pkg-support files (INSTALL.txt and Makefile)

---
 mingw/pkg-support/INSTALL.txt | 18 ++++++++++++++++++
 mingw/pkg-support/Makefile    | 26 ++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 mingw/pkg-support/INSTALL.txt
 create mode 100644 mingw/pkg-support/Makefile

diff --git a/mingw/pkg-support/INSTALL.txt b/mingw/pkg-support/INSTALL.txt
new file mode 100644
index 0000000000000..607dafd0ee0a7
--- /dev/null
+++ b/mingw/pkg-support/INSTALL.txt
@@ -0,0 +1,18 @@
+
+The 32-bit files are in i686-w64-mingw32
+The 64-bit files are in x86_64-w64-mingw32
+
+To install SDL for native development:
+    make native
+
+To install SDL for cross-compiling development:
+    make cross
+
+Look at the example programs in ./test, and check out online documentation:
+    http://wiki.libsdl.org/
+
+Join the SDL developer mailing list if you want to join the community:
+    http://www.libsdl.org/mailing-list.php
+
+That's it!
+Sam Lantinga <slouken@libsdl.org>
diff --git a/mingw/pkg-support/Makefile b/mingw/pkg-support/Makefile
new file mode 100644
index 0000000000000..19732d7d24c61
--- /dev/null
+++ b/mingw/pkg-support/Makefile
@@ -0,0 +1,26 @@
+#
+# Makefile for installing the mingw32 version of the SDL library
+
+CROSS_PATH := /usr/local
+ARCHITECTURES := i686-w64-mingw32 x86_64-w64-mingw32
+
+all install:
+	@echo "Type \"make native\" to install 32-bit to /usr"
+	@echo "Type \"make cross\" to install 32-bit and 64-bit to $(CROSS_PATH)"
+
+native:
+	make install-package arch=i686-w64-mingw32 prefix=/usr
+
+cross:
+	for arch in $(ARCHITECTURES); do \
+	    make install-package arch=$$arch prefix=$(CROSS_PATH)/$$arch; \
+	done
+
+install-package:
+	@if test -d $(arch) && test -d $(prefix); then \
+	    (cd $(arch) && cp -rv bin include lib share $(prefix)/); \
+	    sed "s|^prefix=.*|prefix=$(prefix)|" <$(arch)/lib/pkgconfig/sdl3.pc >$(prefix)/lib/pkgconfig/sdl3.pc; \
+	else \
+	    echo "*** ERROR: $(arch) or $(prefix) does not exist!"; \
+	    exit 1; \
+	fi