diff --git a/build/build_macos_qt5.sh b/build/build_macos_qt5.sh index f67cba203..0e93ef394 100755 --- a/build/build_macos_qt5.sh +++ b/build/build_macos_qt5.sh @@ -94,3 +94,7 @@ cp -R -v $LITEIDE_ROOT/bin/gomodifytags liteide/LiteIDE.app/Contents/MacOS cp -R -v $LITEIDE_ROOT/bin/gopls liteide/LiteIDE.app/Contents/MacOS cp -R -v $LITEIDE_ROOT/deploy/* liteide/LiteIDE.app/Contents/Resources cp -R -v $LITEIDE_ROOT/os_deploy/macosx/* liteide/LiteIDE.app/Contents/Resources + +# Hardened Runtime is required on Apple Silicon so CoreText/ImageIO can decode +# Apple Color Emoji (otherwise the editor crashes at 0xbad4007 while painting). +codesign --force --deep --options runtime --entitlements "$LITEIDE_ROOT/src/liteide/LiteIDE.entitlements" --sign - liteide/LiteIDE.app || exit 1 diff --git a/build/build_macos_qt6.sh b/build/build_macos_qt6.sh index 4d7973d69..2438fd6cf 100755 --- a/build/build_macos_qt6.sh +++ b/build/build_macos_qt6.sh @@ -35,3 +35,6 @@ cp "$LITEIDE_ROOT/bin/gocode" "$LITEIDE_ROOT/bin/gotools" \ liteide/LiteIDE.app/Contents/MacOS/ cp -R "$LITEIDE_ROOT/deploy/." liteide/LiteIDE.app/Contents/Resources/ cp -R "$LITEIDE_ROOT/os_deploy/macosx/." liteide/LiteIDE.app/Contents/Resources/ +# Hardened Runtime is required on Apple Silicon so CoreText/ImageIO can decode +# Apple Color Emoji (otherwise the editor crashes at 0xbad4007 while painting). +codesign --force --deep --options runtime --entitlements "$LITEIDE_ROOT/src/liteide/LiteIDE.entitlements" --sign - liteide/LiteIDE.app diff --git a/build/deploy_macos_qt5.sh b/build/deploy_macos_qt5.sh index 8da77ac2b..82c9e7c27 100755 --- a/build/deploy_macos_qt5.sh +++ b/build/deploy_macos_qt5.sh @@ -24,4 +24,6 @@ fi rm -f liteide/LiteIDE.app/Contents/Resources/qt.conf macdeployqt liteide/LiteIDE.app || exit 1 -codesign --force --deep --sign - liteide/LiteIDE.app || exit 1 +# Hardened Runtime is required on Apple Silicon so CoreText/ImageIO can decode +# Apple Color Emoji (otherwise the editor crashes at 0xbad4007 while painting). +codesign --force --deep --options runtime --entitlements "$LITEIDE_ROOT/src/liteide/LiteIDE.entitlements" --sign - liteide/LiteIDE.app || exit 1 diff --git a/liteidex/src/liteide/LiteIDE.entitlements b/liteidex/src/liteide/LiteIDE.entitlements new file mode 100644 index 000000000..c7b92d694 --- /dev/null +++ b/liteidex/src/liteide/LiteIDE.entitlements @@ -0,0 +1,12 @@ + + + + + com.apple.security.cs.allow-dyld-environment-variables + + com.apple.security.cs.allow-unsigned-executable-memory + + com.apple.security.cs.disable-library-validation + + + diff --git a/liteidex/src/liteide/liteide.pro b/liteidex/src/liteide/liteide.pro index 63922a4e6..cf6cea837 100644 --- a/liteidex/src/liteide/liteide.pro +++ b/liteidex/src/liteide/liteide.pro @@ -45,6 +45,9 @@ win32 { } else:macx { ICON = liteide.icns QMAKE_INFO_PLIST = Info.plist + # Apple Silicon crashes in CoreText/ImageIO when drawing emoji unless the + # process is signed with the Hardened Runtime (EXC_ARM_DA_ALIGN / 0xbad4007). + QMAKE_POST_LINK += codesign --force --deep --sign - --options runtime --entitlements $$shell_quote($$PWD/LiteIDE.entitlements) $$shell_quote($$IDE_APP_PATH/$${IDE_APP_TARGET}.app) } else { target.path = $$BINPREFIX INSTALLS += target