Xcode/SDL/pkg-support/codesign-frameworks.sh
changeset 7550 ff3e041c27f3
child 8995 d095e572e0d5
equal deleted inserted replaced
7549:c0a35efb1813 7550:ff3e041c27f3
       
     1 #!/bin/sh
       
     2 
       
     3 # WARNING: You may have to run Clean in Xcode after changing CODE_SIGN_IDENTITY! 
       
     4 
       
     5 # Verify that $CODE_SIGN_IDENTITY is set
       
     6 if [ -z "$CODE_SIGN_IDENTITY" ] ; then
       
     7     echo "CODE_SIGN_IDENTITY needs to be non-empty for codesigning frameworks!"
       
     8 
       
     9     if [ "$CONFIGURATION" = "Release" ] ; then
       
    10         exit 1
       
    11     else
       
    12         # Codesigning is optional for non-release builds.
       
    13         exit 0
       
    14     fi
       
    15 fi
       
    16 
       
    17 SAVEIFS=$IFS
       
    18 IFS=$(echo -en "\n\b")
       
    19 
       
    20 FRAMEWORK_DIR="${TARGET_BUILD_DIR}"
       
    21 
       
    22 # Loop through all frameworks
       
    23 FRAMEWORKS=`find "${FRAMEWORK_DIR}" -type d -name "*.framework" | sed -e "s/\(.*\)/\1\/Versions\/A\//"`
       
    24 RESULT=$?
       
    25 if [[ $RESULT != 0 ]] ; then
       
    26     exit 1
       
    27 fi
       
    28 
       
    29 echo "Found:"
       
    30 echo "${FRAMEWORKS}"
       
    31 
       
    32 for FRAMEWORK in $FRAMEWORKS;
       
    33 do
       
    34     echo "Signing '${FRAMEWORK}'"
       
    35     `codesign -f -v -s "${CODE_SIGN_IDENTITY}" "${FRAMEWORK}"`
       
    36     RESULT=$?
       
    37     if [[ $RESULT != 0 ]] ; then
       
    38         exit 1
       
    39     fi
       
    40 done
       
    41 
       
    42 # restore $IFS
       
    43 IFS=$SAVEIFS