From: <bor...@us...> - 2021-04-08 16:28:07
|
Revision: 3774 http://sourceforge.net/p/ftm/code/3774 Author: borghesi Date: 2021-04-08 16:28:05 +0000 (Thu, 08 Apr 2021) Log Message: ----------- added script for ftm objects codesign and release Added Paths: ----------- trunk/ftm/distrib/prepare-forum-ftm-package-codesign.sh Added: trunk/ftm/distrib/prepare-forum-ftm-package-codesign.sh =================================================================== --- trunk/ftm/distrib/prepare-forum-ftm-package-codesign.sh (rev 0) +++ trunk/ftm/distrib/prepare-forum-ftm-package-codesign.sh 2021-04-08 16:28:05 UTC (rev 3774) @@ -0,0 +1,248 @@ +#!/bin/bash + +#============================================================================== +# @brief This script prepares a FTM package +# @author thanks to Thibaut Carpentier + +BUILD_DIR="$1" +DIST_DIR=FTM."$2" + +FTM_VERSION="$2" + +echo build directory is ${BUILD_DIR} +echo distribution directory is ${DIST_DIR} + +#============================================================================== +CYAN='\033[0;36m' +BLUE='\033[0;34m' +RED='\033[0;31m' +GREEN='\033[92m' +NC='\033[0m' # No Color + +#============================================================================== +create_subfolders_tree() +{ + # this function creates all the requires subfolders + # $1 : the base folder + mkdir -p -m ug=rwx,o=rx "$1"/FTM/externals/ + mkdir -p -m ug=rwx,o=rx "$1"/FTM/extras/ + mkdir -p -m ug=rwx,o=rx "$1"/FTM/help/ + mkdir -p -m ug=rwx,o=rx "$1"/FTM/examples/ + mkdir -p -m ug=rwx,o=rx "$1"/FTM/examples/ftm/ + mkdir -p -m ug=rwx,o=rx "$1"/FTM/examples/ftm/FTMTutorial-Dobrian/ + mkdir -p -m ug=rwx,o=rx "$1"/FTM/examples/ftm/FTMTutorial-Dobrian/images/ + mkdir -p -m ug=rwx,o=rx "$1"/FTM/examples/gabor/ + mkdir -p -m ug=rwx,o=rx "$1"/FTM/patchers/ + + # set icon + fileicon set "$1"/FTM/ ../ftm.icns +} + +#============================================================================== +change_permission() +{ + # this function change the permission for a given folder + # $1 : the folder + chmod -R o+rx "$1" + chmod -R ug+rwx "$1" +} + +#============================================================================== +code_sign_all() +{ + # $1 : the folder + + VERBOSE=false + + if [ "${VERBOSE}" = true ] ; then + echo -e "Code signing folder ${CYAN}$1/FTM${NC}..." + fi + + # Developer ID Application: INST RECHER COORD ACOUST MUSICALE (3BD2P55TR2) + CODESIGN_IDENTITY=3BD2P55TR2 + + # NB : proper entitlements are required when using the --options=runtime + #ENTITLEMENTS=${BUILD_DIR}/distrib/macosx/FTM-Entitlements.plist + #CODESIGN_CMD="codesign --strict=all --entitlements ${ENTITLEMENTS} --timestamp --force --deep --options=runtime --verbose --sign ${CODESIGN_IDENTITY}" + CODESIGN_CMD="codesign --strict=all --entitlements --timestamp --force --deep --verbose --sign ${CODESIGN_IDENTITY}" + CODESIGN_VERIFY="codesign --verify --strict --deep --no-legacy-signing --verbose=3" + + #============================================================================== + # /external folder + for EXTERNAL in "$1"/FTM/externals/*.mxo; + do + if [ "${VERBOSE}" = true ] ; then + echo -e "Code signing ${CYAN}${EXTERNAL}${NC}..." + fi + ${CODESIGN_CMD} "${EXTERNAL}" + ${CODESIGN_VERIFY} "${EXTERNAL}" + done +} + +#============================================================================== +copy_ftm_data() +{ + # this function copies all the ftm data into the appropriate folder + # $1 : the containing folder + + #### externals ########################################## + + cp -Rf $BUILD_DIR/ftm.mxo "$1"/FTM/externals/ + cp -Rf $BUILD_DIR/ftm.*.mxo "$1"/FTM/externals/ + cp -Rf $BUILD_DIR/gbr.*.mxo "$1"/FTM/externals/ + cp -Rf $BUILD_DIR/mnm.*.mxo "$1"/FTM/externals/ + + #### abstractions ####################################### + + ditto --rsrc ../../patches/max5/abstractions/*.maxpat "$1"/FTM/patchers/ + ditto --rsrc ../../../mnm/patches/max5/abstractions/*.maxpat "$1"/FTM/patchers/ + + #### help ############################################### + + ditto --rsrc ../../patches/max5/help/*.maxhelp "$1"/FTM/help + ditto --rsrc ../../patches/max5/help/*.jpg "$1"/FTM/help + ditto --rsrc ../../patches/max5/help/*.js "$1"/FTM/help + ditto --rsrc ../../patches/max5/help/ftm.classes/*.maxhelp "$1"/FTM/help + ditto --rsrc ../../patches/max5/help/ftm.functions/*.maxhelp "$1"/FTM/help + ditto --rsrc ../../patches/max5/FTMObjectsList.maxpat "$1"/FTM/help/ + ditto --rsrc ../../../gabor/patches/max5/help/*.maxhelp "$1"/FTM/help/ + ditto --rsrc ../../../gabor/patches/max5/help/*.jpg "$1"/FTM/help/ + ditto --rsrc ../../../gabor/patches/max5/GaborObjectList.maxpat "$1"/FTM/help/ + ditto --rsrc ../../../mnm/patches/max5/help/*.maxhelp "$1"/FTM/help/ + ditto --rsrc ../../../mnm/patches/max5/help/*.jpg "$1"/FTM/help/ + ditto --rsrc ../../../mnm/patches/max5/MnmObjectsList.maxpat "$1"/FTM/help/ + + ### examples & tutorials ########################################### + + ditto --rsrc ../../patches/max5/tutorials/*.maxpat "$1"/FTM/examples/ftm/ + ditto --rsrc ../../patches/max5/tutorials/*.jpg "$1"/FTM/examples/ftm/ + ditto --rsrc ../../patches/max5/tutorials/FTMTutorial-Dobrian/*.maxpat "$1"/FTM/examples/ftm/FTMTutorial-Dobrian/ + ditto --rsrc ../../patches/max5/tutorials/FTMTutorial-Dobrian/*.html "$1"/FTM/examples/ftm/FTMTutorial-Dobrian/ + ditto --rsrc ../../patches/max5/tutorials/FTMTutorial-Dobrian/*.aif "$1"/FTM/examples/ftm/FTMTutorial-Dobrian/ + ditto --rsrc ../../patches/max5/tutorials/FTMTutorial-Dobrian/images/*.jpg "$1"/FTM/examples/ftm/FTMTutorial-Dobrian/images/ + + ditto --rsrc ../../../gabor/patches/max5/examples/*.maxpat "$1"/FTM/examples/gabor/ + ditto --rsrc ../../../gabor/patches/max5/tutorials/*.maxpat "$1"/FTM/examples/gabor/ + + #### extras ############################################# + + ditto --rsrc ../../patches/max5/FTM-Overview.maxpat "$1"/"MuBu For Max"/extras/MuBu-Overview.maxpat + + ### package management ##### + + ditto --rsrc ../readme.md "$1"/FTM/readme.md + ditto --rsrc ../icon.png "$1"/FTM/icon.png + ditto --rsrc ../package-info.json "$1"/FTM/package-info.json + + # delete all possible .cstemp files as they would mess up with the codesigning + find ${DIST_DIR} -name "*.cstemp" -type f -delete + + cp ../readme.md "$1"/ +} + +#============================================================================== +# this one is the old version. +# it still works perfectly fine +create_dmg() +{ + # the filename of the final dmg + DATE=`date +%d-%m-%Y` + DMG_FINAL=./FTM-${FTM_VERSION}-macOS-${DATE}.dmg + + # a temporary dmg that will be tweak + DMG_TMP=./FTMTemp.dmg + + # remove the 'dmgcontent' folder if it exists + if [ -d "dmgcontent" ]; then + rm -rf dmgcontent + fi + mkdir dmgcontent + + if [ -f ${DMG_TMP} ]; then + rm -f ${DMG_TMP} + fi + + if [ -f ${DMG_FINAL} ]; then + rm -f ${DMG_FINAL} + fi + + mv Package/** dmgcontent + hdiutil create -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -volname "Ircam FTM" -srcfolder ./dmgcontent "${DMG_TMP}" + rm -rf dmgcontent + rm -rf Package + + # now make the final image a compressed disk image + echo -e "${CYAN}Creating compressed image...${NC}" + hdiutil convert "${DMG_TMP}" -format UDZO -imagekey zlib-level=9 -o "${DMG_FINAL}" + + # remove the temporary dmg + rm -rf "${DMG_TMP}" + + #============================================================================== + # notarize DMG + /bin/bash ~/projects/ftm-and-co/ftm/distrib/ftm.submit.notarization.sh ${DMG_FINAL} +} + +#============================================================================== +create_zip() +{ + # the filename of the final zip + DATE=`date +%d-%m-%Y` + ZIP_FINAL=FTM-${FTM_VERSION}-macOS-${DATE}.zip + + if [ -f "${ZIP_FINAL}" ]; then + rm -f ${ZIP_FINAL} + fi + + cd ./Package + zip --quiet ../${ZIP_FINAL} -r ./FTM + cd .. + rm -rf Package + + # codesign and notarize the zip + /bin/bash ~/projects/ftm-and-co/ftm/distrib/ftm.submit.notarization.sh ${ZIP_FINAL} +} + +#============================================================================== +# The main script starts here +#============================================================================== +mkdir -p -m ug=rwx,o=rx ${DIST_DIR} + +cd ${DIST_DIR} + +echo -e "${CYAN}==============================================================================${NC}" +echo -e "Preparing distribution for FTM ${FTM_VERSION} for Max/MSP" +echo -e "${CYAN}==============================================================================${NC}" + +if [ -d "Package" ]; then + echo "Deleting folders..." + rm -rf Package/ +fi + +#============================================================================== +echo -e "${CYAN}Preparing folder hierarchy...${NC}" +mkdir -p -m ug=rwx,o=rx Package/ +create_subfolders_tree "Package" + +#============================================================================== +echo -e "${CYAN}Copying data...${NC}" +copy_ftm_data "Package" + +#============================================================================== +echo -e "${CYAN}Changing permissions...${NC}" +change_permission "Package/" + +#============================================================================== +echo -e " " +echo -e "${CYAN}Code signing every binary file...${NC}" +code_sign_all "Package" + +#============================================================================== +echo -e " " +echo -e "${CYAN}Creating dmg...${NC}" +create_dmg +#echo -e " " +#echo -e "${CYAN}Creating zip...${NC}" +#create_zip + +exit 0 Property changes on: trunk/ftm/distrib/prepare-forum-ftm-package-codesign.sh ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |