Skip to content

Commit

Permalink
Added code signature step to Framework build process
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jul 31, 2013
1 parent 8b72f55 commit 011eca3
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Xcode/SDL_mixer.xcodeproj/project.pbxproj
Expand Up @@ -552,6 +552,7 @@
001D90F8108A2CB8006E367C /* Copy Frameworks */,
00938F15108A50740009CF19 /* Create Frameworks symlink */,
AA9F7D9714B143C700278D1E /* Convert SDL includes to SDL Framework includes */,
AA5C3FDE17A8CAB300D6C8A1 /* Sign Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -669,6 +670,20 @@
shellPath = /bin/sh;
shellScript = "cd $SYMROOT/$CONFIGURATION/$FULL_PRODUCT_NAME\nif ! [ -L Frameworks ]; then\n rm -f Frameworks\n ln -s Versions/Current/Frameworks Frameworks\nfi";
};
AA5C3FDE17A8CAB300D6C8A1 /* 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";
};
AA9F7D9714B143C700278D1E /* Convert SDL includes to SDL Framework includes */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
43 changes: 43 additions & 0 deletions Xcode/pkg-support/codesign-frameworks.sh
@@ -0,0 +1,43 @@
#!/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

SAVEIFS=$IFS
IFS=$(echo -en "\n\b")

FRAMEWORK_DIR="${TARGET_BUILD_DIR}"

# Loop through all frameworks
FRAMEWORKS=`find "${FRAMEWORK_DIR}" -type d -name "*.framework" | sed -e "s/\(.*\)/\1\/Versions\/A\//"`
RESULT=$?
if [[ $RESULT != 0 ]] ; then
exit 1
fi

echo "Found:"
echo "${FRAMEWORKS}"

for FRAMEWORK in $FRAMEWORKS;
do
echo "Signing '${FRAMEWORK}'"
`codesign -f -v -s "${CODE_SIGN_IDENTITY}" "${FRAMEWORK}"`
RESULT=$?
if [[ $RESULT != 0 ]] ; then
exit 1
fi
done

# restore $IFS
IFS=$SAVEIFS

0 comments on commit 011eca3

Please sign in to comment.