Added code signature step to Framework build process
authorSam Lantinga <slouken@libsdl.org>
Tue, 30 Jul 2013 21:39:38 -0700
changeset 7550ff3e041c27f3
parent 7549 c0a35efb1813
child 7551 823c0c5b2d8d
Added code signature step to Framework build process
Xcode/SDL/SDL.xcodeproj/project.pbxproj
Xcode/SDL/pkg-support/codesign-frameworks.sh
     1.1 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj	Tue Jul 30 20:57:26 2013 -0700
     1.2 +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj	Tue Jul 30 21:39:38 2013 -0700
     1.3 @@ -2155,6 +2155,7 @@
     1.4  				BECDF62A0761BA81005FE872 /* Resources */,
     1.5  				BECDF62C0761BA81005FE872 /* Sources */,
     1.6  				BECDF6680761BA81005FE872 /* Frameworks */,
     1.7 +				AA5C3FDC17A8C58600D6C8A1 /* Sign Frameworks */,
     1.8  			);
     1.9  			buildRules = (
    1.10  			);
    1.11 @@ -2283,6 +2284,20 @@
    1.12  /* End PBXRezBuildPhase section */
    1.13  
    1.14  /* Begin PBXShellScriptBuildPhase section */
    1.15 +		AA5C3FDC17A8C58600D6C8A1 /* Sign Frameworks */ = {
    1.16 +			isa = PBXShellScriptBuildPhase;
    1.17 +			buildActionMask = 2147483647;
    1.18 +			files = (
    1.19 +			);
    1.20 +			inputPaths = (
    1.21 +			);
    1.22 +			name = "Sign Frameworks";
    1.23 +			outputPaths = (
    1.24 +			);
    1.25 +			runOnlyForDeploymentPostprocessing = 0;
    1.26 +			shellPath = /bin/sh;
    1.27 +			shellScript = "if [ \"$USER\" = \"slouken\" ]; then\n    CODE_SIGN_IDENTITY=\"Mac Developer: Sam Lantinga (84TP7N5TA4)\" pkg-support/codesign-frameworks.sh || exit 1\nfi";
    1.28 +		};
    1.29  		BECDF6BD0761BA81005FE872 /* ShellScript */ = {
    1.30  			isa = PBXShellScriptBuildPhase;
    1.31  			buildActionMask = 12;
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/Xcode/SDL/pkg-support/codesign-frameworks.sh	Tue Jul 30 21:39:38 2013 -0700
     2.3 @@ -0,0 +1,43 @@
     2.4 +#!/bin/sh
     2.5 +
     2.6 +# WARNING: You may have to run Clean in Xcode after changing CODE_SIGN_IDENTITY! 
     2.7 +
     2.8 +# Verify that $CODE_SIGN_IDENTITY is set
     2.9 +if [ -z "$CODE_SIGN_IDENTITY" ] ; then
    2.10 +    echo "CODE_SIGN_IDENTITY needs to be non-empty for codesigning frameworks!"
    2.11 +
    2.12 +    if [ "$CONFIGURATION" = "Release" ] ; then
    2.13 +        exit 1
    2.14 +    else
    2.15 +        # Codesigning is optional for non-release builds.
    2.16 +        exit 0
    2.17 +    fi
    2.18 +fi
    2.19 +
    2.20 +SAVEIFS=$IFS
    2.21 +IFS=$(echo -en "\n\b")
    2.22 +
    2.23 +FRAMEWORK_DIR="${TARGET_BUILD_DIR}"
    2.24 +
    2.25 +# Loop through all frameworks
    2.26 +FRAMEWORKS=`find "${FRAMEWORK_DIR}" -type d -name "*.framework" | sed -e "s/\(.*\)/\1\/Versions\/A\//"`
    2.27 +RESULT=$?
    2.28 +if [[ $RESULT != 0 ]] ; then
    2.29 +    exit 1
    2.30 +fi
    2.31 +
    2.32 +echo "Found:"
    2.33 +echo "${FRAMEWORKS}"
    2.34 +
    2.35 +for FRAMEWORK in $FRAMEWORKS;
    2.36 +do
    2.37 +    echo "Signing '${FRAMEWORK}'"
    2.38 +    `codesign -f -v -s "${CODE_SIGN_IDENTITY}" "${FRAMEWORK}"`
    2.39 +    RESULT=$?
    2.40 +    if [[ $RESULT != 0 ]] ; then
    2.41 +        exit 1
    2.42 +    fi
    2.43 +done
    2.44 +
    2.45 +# restore $IFS
    2.46 +IFS=$SAVEIFS