Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added code signature step to Framework build process
  • Loading branch information
slouken committed Jul 31, 2013
1 parent ddcf093 commit 4c54bb8
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
Expand Up @@ -5,13 +5,13 @@
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>FLAC</string>
<string>webp</string>
<key>CFBundleGetInfoString</key>
<string>libwebp 0.1.3</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>FLAC</string>
<string>webp</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
Expand Down
15 changes: 15 additions & 0 deletions Xcode/SDL_image.xcodeproj/project.pbxproj
Expand Up @@ -256,6 +256,7 @@
AA9EE77214B27810008773C0 /* Copy Frameworks */,
AA9EE77314B2782A008773C0 /* Create Frameworks symlink */,
AA9EE77414B27854008773C0 /* Convert SDL includes to SDL Framework includes */,
AA5C3FDD17A8C97A00D6C8A1 /* Sign Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -362,6 +363,20 @@
/* End PBXRezBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
AA5C3FDD17A8C97A00D6C8A1 /* 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";
};
AA9EE77314B2782A008773C0 /* Create Frameworks symlink */ = {
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 4c54bb8

Please sign in to comment.