view mac/finishup.sh @ 2966:48cfd7cb37a6

Add MacOS signing support with environment variable: CODESIGNIDENTITY. Remove the old code to attempt to sign it manually. Instead just specify the signing identity in CODESIGNIDENTITY. Most apps sign it in the "installer" rule, but since we don't have a DMG installer rule for the library, we instead sign it in the finishup script.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 12 Mar 2023 22:34:00 +0000
parents 3dde7456c9f6
children fec8528fcbe8
line wrap: on
line source

#!/bin/sh
PLATFORM=`uname -s`
SRCDIR=$1
BINNAME=$2
IDENTITY=$3

if [ $PLATFORM = "Darwin" ]
then
    mkdir -p $2.app/Contents/MacOS
    mkdir -p $2.app/Contents/Resources

    cat $SRCDIR/mac/Info.template | sed s/APPNAME/$BINNAME/ >  $BINNAME.app/Contents/Info.plist
    cp -f $SRCDIR/mac/PkgInfo $BINNAME.app/Contents 
    cp -f $SRCDIR/mac/file.png $BINNAME.app/Contents/Resources
    cp -f $SRCDIR/mac/folder.png $BINNAME.app/Contents/Resources
    cp -f $SRCDIR/image/test.png $BINNAME.app/Contents/Resources
    cp -f $BINNAME $BINNAME.app/Contents/MacOS
    # Check if there is a certificate to sign with...
    if [ -z "$IDENTITY" ]; then
        echo "No identity set signing AdHoc."
        codesign --deep -s "-" $BINNAME.app
    else
        echo "Signing code with identity: $IDENTITY"
        codesign --deep -s "$IDENTITY" $BINNAME.app
    fi
fi