mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00

- Switch to Qt 6.8 for repo default, as 6.7 depends on an older libwebp/tiff which is unavailable on newer installs - Drop tools/mac-x86, as we no longer need to test against Qt 5 - Add flags to cross compile wheels on Mac and Linux - Bump glibc target to 2_36, building on Debian Stable - Increase mpv timeout on macOS to allow for initial gatekeeper checks - Ship both arm64 and amd64 uv on Linux, with a bash stub to pick the appropriate arch.
66 lines
2 KiB
Bash
Executable file
66 lines
2 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
# Add Linux cross-compilation target
|
|
rustup target add aarch64-unknown-linux-gnu
|
|
|
|
# Define output paths
|
|
OUTPUT_DIR="../../../out/launcher"
|
|
LAUNCHER_DIR="$OUTPUT_DIR/anki-launcher"
|
|
|
|
# Clean existing output directory
|
|
rm -rf "$LAUNCHER_DIR"
|
|
|
|
# Build binaries for both Linux architectures
|
|
cargo build -p launcher --release --target x86_64-unknown-linux-gnu
|
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
|
|
cargo build -p launcher --release --target aarch64-unknown-linux-gnu
|
|
(cd ../../.. && ./ninja extract:uv_lin_arm)
|
|
|
|
# Create output directory
|
|
mkdir -p "$LAUNCHER_DIR"
|
|
|
|
# Copy binaries and support files
|
|
TARGET_DIR=${CARGO_TARGET_DIR:-../../../target}
|
|
|
|
# Copy launcher binaries with architecture suffixes
|
|
cp "$TARGET_DIR/x86_64-unknown-linux-gnu/release/launcher" "$LAUNCHER_DIR/launcher.amd64"
|
|
cp "$TARGET_DIR/aarch64-unknown-linux-gnu/release/launcher" "$LAUNCHER_DIR/launcher.arm64"
|
|
|
|
# Copy uv binaries with architecture suffixes
|
|
cp "../../../out/extracted/uv/uv" "$LAUNCHER_DIR/uv.amd64"
|
|
cp "../../../out/extracted/uv_lin_arm/uv" "$LAUNCHER_DIR/uv.arm64"
|
|
|
|
# Copy support files from lin directory
|
|
for file in README.md anki.1 anki.desktop anki.png anki.xml anki.xpm install.sh uninstall.sh anki; do
|
|
cp "$file" "$LAUNCHER_DIR/"
|
|
done
|
|
|
|
# Copy additional files from parent directory
|
|
cp ../pyproject.toml "$LAUNCHER_DIR/"
|
|
cp ../../../.python-version "$LAUNCHER_DIR/"
|
|
|
|
# Set executable permissions
|
|
chmod +x \
|
|
"$LAUNCHER_DIR/anki" \
|
|
"$LAUNCHER_DIR/launcher.amd64" \
|
|
"$LAUNCHER_DIR/launcher.arm64" \
|
|
"$LAUNCHER_DIR/uv.amd64" \
|
|
"$LAUNCHER_DIR/uv.arm64" \
|
|
"$LAUNCHER_DIR/install.sh" \
|
|
"$LAUNCHER_DIR/uninstall.sh"
|
|
|
|
# Set proper permissions and create tarball
|
|
chmod -R a+r "$LAUNCHER_DIR"
|
|
|
|
# Create tarball using the same options as the Rust template
|
|
ZSTD="zstd -c --long -T0 -18"
|
|
TRANSFORM="s%^.%anki-launcher%S"
|
|
TARBALL="$OUTPUT_DIR/anki-launcher.tar.zst"
|
|
|
|
tar -I "$ZSTD" --transform "$TRANSFORM" -cf "$TARBALL" -C "$LAUNCHER_DIR" .
|
|
|
|
echo "Build complete:"
|
|
echo "Universal launcher: $LAUNCHER_DIR"
|
|
echo "Tarball: $TARBALL"
|