Xcode/SDL/pkg-support/codesign-frameworks.sh
author Sam Lantinga
Mon, 07 Jul 2014 23:40:10 -0700
changeset 8995 d095e572e0d5
parent 7550 ff3e041c27f3
child 8996 b8147002c991
permissions -rwxr-xr-x
Fixed code signing release frameworks
slouken@7550
     1
#!/bin/sh
slouken@7550
     2
slouken@8995
     3
# WARNING: You may have to run Clean in Xcode after changing CODE_SIGN_IDENTITY!
slouken@7550
     4
slouken@7550
     5
# Verify that $CODE_SIGN_IDENTITY is set
slouken@7550
     6
if [ -z "$CODE_SIGN_IDENTITY" ] ; then
slouken@7550
     7
    echo "CODE_SIGN_IDENTITY needs to be non-empty for codesigning frameworks!"
slouken@7550
     8
slouken@7550
     9
    if [ "$CONFIGURATION" = "Release" ] ; then
slouken@7550
    10
        exit 1
slouken@7550
    11
    else
slouken@7550
    12
        # Codesigning is optional for non-release builds.
slouken@7550
    13
        exit 0
slouken@7550
    14
    fi
slouken@7550
    15
fi
slouken@7550
    16
slouken@7550
    17
FRAMEWORK_DIR="${TARGET_BUILD_DIR}"
slouken@7550
    18
slouken@7550
    19
# Loop through all frameworks
slouken@8995
    20
FRAMEWORKS=`find "${FRAMEWORK_DIR}" -type d -name "*.framework"`
slouken@7550
    21
RESULT=$?
slouken@7550
    22
if [[ $RESULT != 0 ]] ; then
slouken@7550
    23
    exit 1
slouken@7550
    24
fi
slouken@7550
    25
slouken@8995
    26
echo "Found: ${FRAMEWORKS}"
slouken@7550
    27
slouken@7550
    28
for FRAMEWORK in $FRAMEWORKS;
slouken@7550
    29
do
slouken@7550
    30
    echo "Signing '${FRAMEWORK}'"
slouken@7550
    31
    `codesign -f -v -s "${CODE_SIGN_IDENTITY}" "${FRAMEWORK}"`
slouken@7550
    32
    RESULT=$?
slouken@7550
    33
    if [[ $RESULT != 0 ]] ; then
slouken@7550
    34
        exit 1
slouken@7550
    35
    fi
slouken@7550
    36
done