mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Fat binary, notarization & dmg
This commit is contained in:
parent
90e1264895
commit
5afb78c9f0
3 changed files with 41 additions and 8 deletions
|
@ -5,9 +5,11 @@ set -e
|
||||||
# Define output path
|
# Define output path
|
||||||
OUTPUT_DIR="../../../out/launcher"
|
OUTPUT_DIR="../../../out/launcher"
|
||||||
APP_LAUNCHER="$OUTPUT_DIR/Anki.app"
|
APP_LAUNCHER="$OUTPUT_DIR/Anki.app"
|
||||||
|
rm -rf "$APP_LAUNCHER"
|
||||||
|
|
||||||
# Build rust binary in debug mode
|
# Build binaries for both architectures
|
||||||
cargo build -p launcher
|
cargo build -p launcher --release --target aarch64-apple-darwin
|
||||||
|
cargo build -p launcher --release --target x86_64-apple-darwin
|
||||||
(cd ../../.. && ./ninja launcher:uv_universal)
|
(cd ../../.. && ./ninja launcher:uv_universal)
|
||||||
|
|
||||||
# Ensure output directory exists
|
# Ensure output directory exists
|
||||||
|
@ -19,9 +21,12 @@ rm -rf "$APP_LAUNCHER"
|
||||||
# Create app launcher structure
|
# Create app launcher structure
|
||||||
mkdir -p "$APP_LAUNCHER/Contents/MacOS" "$APP_LAUNCHER/Contents/Resources"
|
mkdir -p "$APP_LAUNCHER/Contents/MacOS" "$APP_LAUNCHER/Contents/Resources"
|
||||||
|
|
||||||
# Copy binaries
|
# Copy binaries in
|
||||||
TARGET_DIR=${CARGO_TARGET_DIR:-target}
|
TARGET_DIR=${CARGO_TARGET_DIR:-target}
|
||||||
cp $TARGET_DIR/debug/launcher "$APP_LAUNCHER/Contents/MacOS/"
|
lipo -create \
|
||||||
|
"$TARGET_DIR/aarch64-apple-darwin/release/launcher" \
|
||||||
|
"$TARGET_DIR/x86_64-apple-darwin/release/launcher" \
|
||||||
|
-output "$APP_LAUNCHER/Contents/MacOS/launcher"
|
||||||
cp "$OUTPUT_DIR/uv" "$APP_LAUNCHER/Contents/MacOS/"
|
cp "$OUTPUT_DIR/uv" "$APP_LAUNCHER/Contents/MacOS/"
|
||||||
|
|
||||||
# Copy support files
|
# Copy support files
|
||||||
|
@ -39,3 +44,9 @@ done
|
||||||
# Check
|
# Check
|
||||||
codesign -vvv "$APP_LAUNCHER"
|
codesign -vvv "$APP_LAUNCHER"
|
||||||
spctl -a "$APP_LAUNCHER"
|
spctl -a "$APP_LAUNCHER"
|
||||||
|
|
||||||
|
# Notarize
|
||||||
|
./notarize.sh "$OUTPUT_DIR"
|
||||||
|
|
||||||
|
# Bundle
|
||||||
|
./dmg/build.sh "$OUTPUT_DIR"
|
|
@ -4,9 +4,9 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# base folder with Anki.app in it
|
# base folder with Anki.app in it
|
||||||
dist=$1
|
output="$1"
|
||||||
dmg_path=$2
|
dist="$1/tmp"
|
||||||
script_folder=$(dirname $0)
|
dmg_path="$output/Anki.dmg"
|
||||||
|
|
||||||
if [ -d "/Volumes/Anki" ]
|
if [ -d "/Volumes/Anki" ]
|
||||||
then
|
then
|
||||||
|
@ -14,9 +14,14 @@ then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -rf $dist $dmg_path
|
||||||
|
mkdir -p $dist
|
||||||
|
rsync -av $output/Anki.app $dist/
|
||||||
|
script_folder=$(dirname $0)
|
||||||
|
|
||||||
echo "bundling..."
|
echo "bundling..."
|
||||||
ln -s /Applications $dist/Applications
|
ln -s /Applications $dist/Applications
|
||||||
mkdir $dist/.background
|
mkdir -p $dist/.background
|
||||||
cp ${script_folder}/anki-logo-bg.png $dist/.background
|
cp ${script_folder}/anki-logo-bg.png $dist/.background
|
||||||
cp ${script_folder}/dmg_ds_store $dist/.DS_Store
|
cp ${script_folder}/dmg_ds_store $dist/.DS_Store
|
||||||
|
|
||||||
|
|
17
qt/launcher/mac/notarize.sh
Executable file
17
qt/launcher/mac/notarize.sh
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Define output path
|
||||||
|
OUTPUT_DIR="$1"
|
||||||
|
APP_LAUNCHER="$OUTPUT_DIR/Anki.app"
|
||||||
|
ZIP_FILE="$OUTPUT_DIR/Anki.zip"
|
||||||
|
|
||||||
|
# Create zip for notarization
|
||||||
|
(cd "$OUTPUT_DIR" && rm -rf Anki.zip && zip -r Anki.zip Anki.app)
|
||||||
|
|
||||||
|
# Upload for notarization
|
||||||
|
xcrun notarytool submit "$ZIP_FILE" -p default --wait
|
||||||
|
|
||||||
|
# Staple the app
|
||||||
|
xcrun stapler staple "$APP_LAUNCHER"
|
Loading…
Reference in a new issue