2014-04-10 03:29:19 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2014-07-08 08:40:10 +02:00
|
|
|
# WARNING: You may have to run Clean in Xcode after changing CODE_SIGN_IDENTITY!
|
2014-04-10 03:29:19 +02:00
|
|
|
|
|
|
|
# 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
|
2014-07-08 08:48:21 +02:00
|
|
|
FRAMEWORKS=`find "${FRAMEWORK_DIR}" -type d -name "*.framework" | sort -r`
|
2014-04-10 03:29:19 +02:00
|
|
|
RESULT=$?
|
|
|
|
if [[ $RESULT != 0 ]] ; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
for FRAMEWORK in $FRAMEWORKS;
|
|
|
|
do
|
2014-07-08 09:23:36 +02:00
|
|
|
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
|
2014-04-10 03:29:19 +02:00
|
|
|
echo "Signing '${FRAMEWORK}'"
|
2014-07-08 09:23:36 +02:00
|
|
|
codesign -f -v -s "${CODE_SIGN_IDENTITY}" "${FRAMEWORK}"
|
2014-04-10 03:29:19 +02:00
|
|
|
RESULT=$?
|
|
|
|
if [[ $RESULT != 0 ]] ; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|