Moved code signature step to after the framework build step is complete, and don't hardcode the codesign identity

This commit is contained in:
Sam Lantinga 2015-04-26 20:46:07 -07:00
parent 931f6e4ee5
commit 93bd476de9
2 changed files with 1 additions and 59 deletions

View File

@ -2248,7 +2248,6 @@
BECDF62A0761BA81005FE872 /* Resources */,
BECDF62C0761BA81005FE872 /* Sources */,
BECDF6680761BA81005FE872 /* Frameworks */,
AA5C3FDC17A8C58600D6C8A1 /* Sign Frameworks */,
);
buildRules = (
);
@ -2385,20 +2384,6 @@
/* End PBXRezBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
AA5C3FDC17A8C58600D6C8A1 /* Sign Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Sign Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ \"$USER\" = \"slouken\" ]; then\n CODE_SIGN_IDENTITY=\"Mac Developer: Sam Lantinga (84TP7N5TA4)\" pkg-support/codesign-frameworks.sh || exit 1\nfi";
};
BECDF6BD0761BA81005FE872 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 12;
@ -2406,7 +2391,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# clean up the framework, remove headers, extra files\nmkdir -p build/dmg-tmp\nxcrun CpMac -r $TARGET_BUILD_DIR/SDL2.framework build/dmg-tmp/\n\ncp pkg-support/resources/License.txt 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)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL2 -srcfolder build/dmg-tmp build/SDL2.dmg\n\n# clean up\nrm -rf build/dmg-tmp";
shellScript = "# Sign framework\nif [ \"$SDL_CODESIGN_IDENTITY\" != \"\" ]; then\n codesign --force --sign \"$SDL_CODESIGN_IDENTITY\" $TARGET_BUILD_DIR/SDL2.framework/Versions/A\nfi\n\n# clean up the framework, remove headers, extra files\nmkdir -p build/dmg-tmp\nxcrun CpMac -r $TARGET_BUILD_DIR/SDL2.framework build/dmg-tmp/\n\ncp pkg-support/resources/License.txt 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)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL2 -srcfolder build/dmg-tmp build/SDL2.dmg\n\n# clean up\nrm -rf build/dmg-tmp";
};
/* End PBXShellScriptBuildPhase section */

View File

@ -1,43 +0,0 @@
#!/bin/sh
# WARNING: You may have to run Clean in Xcode after changing CODE_SIGN_IDENTITY!
# Verify that $CODE_SIGN_IDENTITY is set
if [ -z "$CODE_SIGN_IDENTITY" ] ; then
echo "CODE_SIGN_IDENTITY needs to be non-empty for codesigning frameworks!"
if [ "$CONFIGURATION" = "Release" ] ; then
exit 1
else
# Codesigning is optional for non-release builds.
exit 0
fi
fi
FRAMEWORK_DIR="${TARGET_BUILD_DIR}"
# Loop through all frameworks
FRAMEWORKS=`find "${FRAMEWORK_DIR}" -type d -name "*.framework" | sort -r`
RESULT=$?
if [[ $RESULT != 0 ]] ; then
exit 1
fi
for FRAMEWORK in $FRAMEWORKS;
do
if [[ "$CONFIGURATION" = "Release" ]]; then
echo "Stripping '${FRAMEWORK}'"
NAME=$(basename "${FRAMEWORK}" .framework)
xcrun strip -x "${FRAMEWORK}/${NAME}"
RESULT=$?
if [[ $RESULT != 0 ]] ; then
exit 1
fi
fi
echo "Signing '${FRAMEWORK}'"
codesign -f -v -s "${CODE_SIGN_IDENTITY}" "${FRAMEWORK}"
RESULT=$?
if [[ $RESULT != 0 ]] ; then
exit 1
fi
done