SDL: ci: verify SDL build system does not include installed SDL headers

From fb8ac1ab7d6a2463ed8b5186adbee885002ee73e Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Fri, 29 Mar 2024 19:04:16 +0100
Subject: [PATCH] ci: verify SDL build system does not include installed SDL
 headers

---
 .github/workflows/psp.yml | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/.github/workflows/psp.yml b/.github/workflows/psp.yml
index 2b1d239fecf7d..37c70ac079711 100644
--- a/.github/workflows/psp.yml
+++ b/.github/workflows/psp.yml
@@ -16,6 +16,21 @@ jobs:
       run: |
         apk update
         apk add cmake gmp mpc1 mpfr4 make pkgconf
+    - name: Pollute PSP SDK with "bad" SDL headers
+      run: |
+        # Create "bad" SDL headers in the PSP SDK.
+        # SDL sources should not use these. 
+        infixes=". psp psp/sdk"
+        for infix in $infixes; do
+          directory="$PSPDEV/$infix/include/SDL3"
+          echo "Creating directory $directory"
+          mkdir -p "$directory"
+          for include in include/SDL3/*.h; do
+            dest="$PSPDEV/$infix/include/SDL3/$(basename "$include")"
+            echo "Creating $dest"
+            echo '#error "System SDL headers must not be used by build system"' >"$dest"
+          done
+        done
     - name: Configure (CMake)
       run: |
         cmake -S . -B build \