SDL: Add -Wl,-Bstatic to "sdl2-config --static-libs" output

From d6143ab369eb4a39bc78fd6ed7a43e09e3ab900e Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Fri, 3 Jun 2022 23:53:05 +0200
Subject: [PATCH] Add -Wl,-Bstatic to "sdl2-config --static-libs" output

---
 sdl2-config.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sdl2-config.in b/sdl2-config.in
index f6e5a50b3fb..3a87ab85bf2 100644
--- a/sdl2-config.in
+++ b/sdl2-config.in
@@ -53,7 +53,8 @@ while test $# -gt 0; do
 @ENABLE_SHARED_TRUE@      ;;
 @ENABLE_STATIC_TRUE@@ENABLE_SHARED_TRUE@    --static-libs)
 @ENABLE_STATIC_TRUE@@ENABLE_SHARED_FALSE@    --libs|--static-libs)
-@ENABLE_STATIC_TRUE@      echo -L@libdir@ @SDL_LIBS@ @SDL_STATIC_LIBS@
+@ENABLE_STATIC_TRUE@      sdl_static_libs=$(echo "@SDL_LIBS@ @SDL_STATIC_LIBS@" | sed -E "s#-lSDL2[ $]#-Wl,-Bstatic -lSDL2 -Wl,-Bdynamic #g")
+@ENABLE_STATIC_TRUE@      echo -L@libdir@ $sdl_static_libs
 @ENABLE_STATIC_TRUE@      ;;
     *)
       echo "${usage}" 1>&2