SDL_image: Added the ability to build optional frameworks for release builds

From 6c84d93b75fd661f56789bb79c909cb91c602308 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 16 Jul 2022 09:31:59 -0700
Subject: [PATCH] Added the ability to build optional frameworks for release
 builds

---
 Xcode/SDL_image.xcodeproj/project.pbxproj |  2 +-
 Xcode/config.xcconfig                     |  3 +++
 Xcode/pkg-support/resources/ReadMe.txt    | 10 +---------
 3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/Xcode/SDL_image.xcodeproj/project.pbxproj b/Xcode/SDL_image.xcodeproj/project.pbxproj
index 1502daa8..df9b2d51 100644
--- a/Xcode/SDL_image.xcodeproj/project.pbxproj
+++ b/Xcode/SDL_image.xcodeproj/project.pbxproj
@@ -554,7 +554,7 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "PRODUCT_NAME=SDL2_image\n\n# Sign framework\nif [ \"$SDL_CODESIGN_IDENTITY\" != \"\" ]; then\n    codesign --force --deep --sign \"$SDL_CODESIGN_IDENTITY\" $TARGET_BUILD_DIR/$PRODUCT_NAME.framework/Versions/A || exit $?\nfi\n\n# clean up the framework, remove headers, extra files\nmkdir -p build/dmg-tmp\ncp -a $TARGET_BUILD_DIR/$PRODUCT_NAME.framework build/dmg-tmp/\ncp pkg-support/resources/ReadMe.txt build/dmg-tmp\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nrm -rf build/dmg-tmp/.DS_Store\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname $PRODUCT_NAME -srcfolder build/dmg-tmp build/$PRODUCT_NAME.dmg\n\n# clean up\nrm -rf build/dmg-tmp\n";
+			shellScript = "PRODUCT_NAME=SDL2_image\n\n# Sign framework\nif [ \"$SDL_CODESIGN_IDENTITY\" != \"\" ]; then\n    codesign --force --deep --sign \"$SDL_CODESIGN_IDENTITY\" $TARGET_BUILD_DIR/$PRODUCT_NAME.framework/Versions/A || exit $?\nfi\n\n# clean up the framework, remove headers, extra files\nmkdir -p build/dmg-tmp\ncp -a $TARGET_BUILD_DIR/$PRODUCT_NAME.framework build/dmg-tmp/\ncp pkg-support/resources/ReadMe.txt build/dmg-tmp\nfor i in avif jxl webp; do\n    if [ -d $TARGET_BUILD_DIR/$i.framework ]; then\n        mkdir -p build/dmg-tmp/optional\n        cp -a $TARGET_BUILD_DIR/$i.framework build/dmg-tmp/optional/\n    fi\ndone\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nrm -rf build/dmg-tmp/.DS_Store\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname $PRODUCT_NAME -srcfolder build/dmg-tmp build/$PRODUCT_NAME.dmg\n\n# clean up\nrm -rf build/dmg-tmp\n";
 		};
 /* End PBXShellScriptBuildPhase section */
 
diff --git a/Xcode/config.xcconfig b/Xcode/config.xcconfig
index 0ead90ef..90fda061 100644
--- a/Xcode/config.xcconfig
+++ b/Xcode/config.xcconfig
@@ -6,6 +6,9 @@
 // Configuration settings file format documentation can be found at:
 // https://help.apple.com/xcode/#/dev745c5c974
 
+// Include any optional config for this build
+#include? "build.xcconfig"
+
 // Uncomment these lines to enable AVIF support
 // If you do this, you should run external/download.sh to download the decode libraries and add avif.framework to your application bundle.
 //CONFIG_PREPROCESSOR_DEFINITIONS = $(inherited) LOAD_AVIF
diff --git a/Xcode/pkg-support/resources/ReadMe.txt b/Xcode/pkg-support/resources/ReadMe.txt
index 04edf70d..d707a5a2 100644
--- a/Xcode/pkg-support/resources/ReadMe.txt
+++ b/Xcode/pkg-support/resources/ReadMe.txt
@@ -14,6 +14,7 @@ Copy the SDL2_image.framework to /Library/Frameworks
 
 You may alternatively install it in <your home directory>/Library/Frameworks if your access privileges are not high enough. (Be aware that the Xcode templates we provide in the SDL Developer Extras package may require some adjustment for your system if you do this.)
 
+In the optional directory are additional frameworks you can install or include in your application to support more image formats.
 
 Use in CMake projects:
 SDL2_image.framework can be used in CMake projects using the following pattern:
@@ -25,12 +26,3 @@ target_link_libraries(my_game PRIVATE SDL2_image::SDL2_image)
 If SDL2_image.framework is installed in a non-standard location,
 please refer to the following link for ways to configure CMake:
 https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure
-
-
-(Partial) History of PB/Xcode projects:
-2009-09-21 - Updated for 64-bit (Snow Leopard) Universal Binaries.
-	Switched to 10.4 minimum requirement.
-	Switched to ImageIO backend for distribution.
-	Static libraries of libpng and libjpeg are no longer maintained and may eventually be removed.
-
-2006-01-31 - First entry in history. Updated for Universal Binaries. Static libraries of libpng and libjpeg have been brought up-to-date and built as Universal.