-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnotarize_app.sh
More file actions
executable file
·64 lines (50 loc) · 2.6 KB
/
notarize_app.sh
File metadata and controls
executable file
·64 lines (50 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
set -e
# === Configuration Variables ===
APP_NAME="OpenSuperMLX"
APP_PATH="./build/Build/Products/Release/OpenSuperMLX.app"
ZIP_PATH="./build/OpenSuperMLX.zip"
BUNDLE_ID="org.axot.OpenSuperMLX"
KEYCHAIN_PROFILE="Slava"
CODE_SIGN_IDENTITY="${1}"
DEVELOPMENT_TEAM="8LLDD7HWZK"
rm -rf build
mkdir -p build
echo "Building autocorrect-swift..."
cargo build -p autocorrect-swift --release --target aarch64-apple-darwin --manifest-path=asian-autocorrect/Cargo.toml
cp ./asian-autocorrect/target/aarch64-apple-darwin/release/libautocorrect_swift.dylib ./build/libautocorrect_swift.dylib
install_name_tool -id "@rpath/libautocorrect_swift.dylib" ./build/libautocorrect_swift.dylib
codesign --force --sign "${CODE_SIGN_IDENTITY}" --timestamp ./build/libautocorrect_swift.dylib
echo "Building text-processing-rs..."
cargo build --release --features ffi --target aarch64-apple-darwin --manifest-path=text-processing-rs/Cargo.toml
cp ./text-processing-rs/target/aarch64-apple-darwin/release/libtext_processing_rs.dylib ./build/libtext_processing_rs.dylib
install_name_tool -id "@rpath/libtext_processing_rs.dylib" ./build/libtext_processing_rs.dylib
codesign --force --sign "${CODE_SIGN_IDENTITY}" --timestamp ./build/libtext_processing_rs.dylib
echo "Copying libomp.dylib..."
cp /opt/homebrew/opt/libomp/lib/libomp.dylib ./build/libomp.dylib
install_name_tool -id "@rpath/libomp.dylib" ./build/libomp.dylib
codesign --force --sign "${CODE_SIGN_IDENTITY}" --timestamp ./build/libomp.dylib
"$(dirname "$0")/Scripts/resolve_and_patch.sh"
xcodebuild \
-scheme "OpenSuperMLX" \
-configuration Release \
-destination "platform=macOS,arch=arm64" \
CODE_SIGN_STYLE=Manual \
DEVELOPMENT_TEAM="${DEVELOPMENT_TEAM}" \
CODE_SIGN_IDENTITY="${CODE_SIGN_IDENTITY}" \
OTHER_CODE_SIGN_FLAGS=--timestamp \
CODE_SIGN_INJECT_BASE_ENTITLEMENTS=NO \
-derivedDataPath build \
-clonedSourcePackagesDirPath SourcePackages \
build | xcpretty --simple --color
rm -f "${ZIP_PATH}"
current_dir=$(pwd)
cd $(dirname "${APP_PATH}") && zip -r -y "${current_dir}/${ZIP_PATH}" $(basename "${APP_PATH}")
cd "${current_dir}"
xcrun notarytool submit "${ZIP_PATH}" --wait --keychain-profile "${KEYCHAIN_PROFILE}"
xcrun stapler staple "${APP_PATH}"
swifty-dmg --skipcodesign "${APP_PATH}" --output "${APP_NAME}.dmg" --verbose
codesign --sign "${CODE_SIGN_IDENTITY}" "${APP_NAME}.dmg"
xcrun notarytool submit "${APP_NAME}.dmg" --wait --keychain-profile "${KEYCHAIN_PROFILE}"
xcrun stapler staple "${APP_NAME}.dmg"
echo "Successfully notarized ${APP_NAME}"