cscg22-gearboy

CSCG 2022 Challenge 'Gearboy'
git clone https://git.sinitax.com/sinitax/cscg22-gearboy
Log | Files | Refs | sfeed.txt

codesign-frameworks.sh (1084B)


      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
      6if [ -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
     15fi
     16
     17FRAMEWORK_DIR="${TARGET_BUILD_DIR}"
     18
     19# Loop through all frameworks
     20FRAMEWORKS=`find "${FRAMEWORK_DIR}" -type d -name "*.framework" | sort -r`
     21RESULT=$?
     22if [[ $RESULT != 0 ]] ; then
     23    exit 1
     24fi
     25
     26for FRAMEWORK in $FRAMEWORKS;
     27do
     28    if [[ "$CONFIGURATION" = "Release" ]]; then
     29        echo "Stripping '${FRAMEWORK}'"
     30        NAME=$(basename "${FRAMEWORK}" .framework)
     31        xcrun strip -x "${FRAMEWORK}/${NAME}"
     32        RESULT=$?
     33        if [[ $RESULT != 0 ]] ; then
     34            exit 1
     35        fi
     36    fi
     37    echo "Signing '${FRAMEWORK}'"
     38    codesign -f -v -s "${CODE_SIGN_IDENTITY}" "${FRAMEWORK}"
     39    RESULT=$?
     40    if [[ $RESULT != 0 ]] ; then
     41        exit 1
     42    fi
     43done