Skip to content

Commit

Permalink
OSX arm64 native support installer sign support
Browse files Browse the repository at this point in the history
  • Loading branch information
cavearr committed Feb 7, 2024
1 parent 031f755 commit 1af46b5
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 58 deletions.
15 changes: 12 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,13 @@ module.exports = function (grunt) {
const CACHE_PYTHON_EXE = CACHE + "/python/" + PYTHON_EXE;

//-- Script for cleaning the dist/icestudio/osx64 folder in MAC
//-- before creating the MAC package
//-- before creating the OSX package
const SCRIPT_OSX = "scripts/repairOSX.sh";
const SCRIPT_OSXARM64 = "scripts/repairOSXarm64.sh";
//-- after creating the OSX package
const SCRIPT_OSX_DMG = "scripts/repairOSXdmg.sh";
const SCRIPT_OSXARM64_DMG = "scripts/repairOSXarm64dmg.sh";


//----------------------------------------------------------------
//-- BUILD DIR. Folder where all the packages for the different
Expand Down Expand Up @@ -503,14 +507,16 @@ module.exports = function (grunt) {
"osx64": [
"exec:repairOSX", //-- Execute a script for MAC
"compress:osx64", //-- Create the Icestudio .zip package
"appdmg" //-- Build the Icestudio appmdg package
"appdmg", //-- Build the Icestudio appmdg package
"exec:repairOSXdmg" //-- Execute a script for MAC
],

//-- TARGET_OSX64
"osxarm64": [
"exec:repairOSXARM64", //-- Execute a script for MAC
"compress:osxarm64", //-- Create the Icestudio .zip package
"appdmg" //-- Build the Icestudio appmdg package
"appdmg", //-- Build the Icestudio appmdg package
"exec:repairOSXARM64dmg" //-- Execute a script for MAC
],


Expand Down Expand Up @@ -916,6 +922,9 @@ module.exports = function (grunt) {
nsis64: MAKE_INSTALLER, //-- Create the Icestudio Windows installer
repairOSX: SCRIPT_OSX, //-- Shell script for mac
repairOSXARM64: SCRIPT_OSXARM64, //-- Shell script for mac
repairOSXdmg: SCRIPT_OSX_DMG, //-- Shell script for mac
repairOSXARM64dmg: SCRIPT_OSXARM64_DMG, //-- Shell script for mac

},

//-- TASK: jshint: Check the .js files
Expand Down
2 changes: 1 addition & 1 deletion app/buildinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"ts":"202402070602"}
{"ts":"202402070902"}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
"fs-xattr": "^0.4.0",
"grunt-appdmg": "github:agoodney/grunt-appdmg"
}
}
}
35 changes: 9 additions & 26 deletions scripts/repairOSX.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,14 @@ GREEN="\033[1;32m"
#-- Start repairing
APPDIR="dist/icestudio/osx64"
if [ -d $APPDIR ]; then
echo "${BLUE}Repairing OSX bundle${NC}"
find "${APPDIR}" -type f -exec file {} \; | grep -E 'Mach-O|dylib' | cut -d: -f1 | xargs -I {} chmod +x "{}"

#BASE_DIR=`find ${APPDIR} -d -name "nwjs Framework.framework"`
#ls "$BASE_DIR" | while read f ; do


# is_link="$BASE_DIR"/"$f"
# if [ -L "$is_link" ] ; then
# echo " Check $is_link"
# echo " =>${RED}Deleting $is_link${NC}"
# else
# rm -f "$is_link"

# echo " =>${GREEN}Preserving $is_link${NC}"
# fi
#done

#echo "${BLUE}Repairing OSX bundle${NC}"
#cp -R "$BASE_DIR"/Versions/A/* "$BASE_DIR"/
#rm -rf "$BASE_DIR"/Versions/Current
#cp -R "$BASE_DIR"/Versions/A "$BASE_DIR"/Versions/Current

echo " =>${BLUE}OSX bundle ${GREEN}OK${NC}"
echo "${BLUE}Repairing OSX bundle${NC}"
find "${APPDIR}" -type f -exec file {} \; | grep -E 'Mach-O|dylib' | cut -d: -f1 | xargs -I {} chmod +x "{}"

if [ -n "${CODESIGN_ID}" ]; then
echo "${BLUE}Sign OSX bundle${NC}"
codesign --force --deep --sign "${CODESIGN_ID}" "${APPDIR}/icestudio.app"
fi
echo " =>${BLUE}OSX bundle ${GREEN}OK${NC}"
else

echo " =>${RED} OSX bundle not found"
echo " =>${RED}OSX bundle not found"
fi
36 changes: 9 additions & 27 deletions scripts/repairOSXarm64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,14 @@ GREEN="\033[1;32m"
APPDIR="dist/icestudio/osxarm64"
if [ -d $APPDIR ]; then

echo "${BLUE}Repairing OSX bundle${NC}"
find "${APPDIR}" -type f -exec file {} \; | grep -E 'Mach-O|dylib' | cut -d: -f1 | xargs -I {} chmod +x "{}"

#BASE_DIR=`find ${APPDIR} -d -name "nwjs Framework.framework"`
#ls "$BASE_DIR" | while read f ; do

# is_link="$BASE_DIR"/"$f"

# echo " Check $is_link"
# if [ -L "$is_link" ] ; then
# echo " =>${RED}Deleting $is_link${NC}"
# rm -f "$is_link"
# else

# echo " =>${GREEN}Preserving $is_link${NC}"
# fi
# done

#cp -R "$BASE_DIR"/Versions/A/* "$BASE_DIR"/
#cp -R "$BASE_DIR"/Versions/A "$BASE_DIR"/Versions/Current
##rm -rf "$BASE_DIR"/Versions/Current

echo " =>${BLUE}OSX bundle ${GREEN}OK${NC}"


echo "${BLUE}Repairing OSX bundle${NC}"
find "${APPDIR}" -type f -exec file {} \; | grep -E 'Mach-O|dylib' | cut -d: -f1 | xargs -I {} chmod +x "{}"

if [ -n "${CODESIGN_ID}" ]; then
echo "${BLUE} Sign OSX bundle${NC}"
codesign --force --deep --sign "${CODESIGN_ID}" "${APPDIR}/icestudio.app"
fi
echo " =>${BLUE}OSX bundle ${GREEN}OK${NC}"
else

echo " =>${RED} OSX ARM64 bundle not found"
echo " =>${RED} OSX ARM64 bundle not found"
fi
24 changes: 24 additions & 0 deletions scripts/repairOSXarm64dmg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

#-- Terminal colors
NC="\033[0m" #-- Reset colors
BLUE="\033[1;34m"
RED="\033[1;31m"
GREEN="\033[1;32m"

#-- Start repairing
APPDIR="dist/"
if [ -d $APPDIR ]; then
# Iiterate over .dmg files in dist
for dmg in `ls ${APPDIR}*.dmg`; do
echo "${dmg}"
if [ -f "${dmg}" ]; then
if [ -n "${CODESIGN_ID}" ]; then
echo "${GREEN}Sign OSX bundle for ${dmg}${NC}"
codesign --force --deep --sign "${CODESIGN_ID}" "${dmg}"
fi
fi
done
else
echo " =>${RED} OSX ARM64 bundle not found"
fi
23 changes: 23 additions & 0 deletions scripts/repairOSXdmg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

#-- Terminal colors
NC="\033[0m" #-- Reset colors
BLUE="\033[1;34m"
RED="\033[1;31m"
GREEN="\033[1;32m"

#-- Start repairing
APPDIR="dist/icestudio/osx64"
if [ -d $APPDIR ]; then
# Iiterate over .dmg files in dist
for dmg in `ls ${APPDIR}/*.dmg`; do
if [ -f "$dmg" ]; then
if [ -n "${CODESIGN_ID}" ]; then
echo "${GREEN}Sign OSX bundle for ${dmg}${NC}"
codesign --force --deep --sign "${CODESIGN_ID}" "${dmg}"
fi
fi
done
else
echo " =>${RED} OSX bundle not found"
fi

0 comments on commit 1af46b5

Please sign in to comment.