新增x86编译
This commit is contained in:
parent
a21cb057ab
commit
735c9ffcfc
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,4 +3,4 @@
|
||||
/src-tauri/target/
|
||||
**/*.rs.bk
|
||||
/src-tauri/model/
|
||||
/src-tauri/vendor/ffmpeg/
|
||||
/src-tauri/vendor/
|
||||
|
||||
@ -63,8 +63,6 @@ Download the installer for your platform from [GitHub Releases](https://github.c
|
||||
| macOS (Apple Silicon) | `.dmg` |
|
||||
| Windows | `.exe` (NSIS Installer) |
|
||||
|
||||
> The Whisper model (~500MB) will be downloaded on first launch. An internet connection is required.
|
||||
|
||||
## Usage
|
||||
|
||||
### Quick Start
|
||||
|
||||
@ -62,7 +62,6 @@ CrossSubtitle-AI 是一款**本地优先**的音视频字幕处理工具。它
|
||||
| macOS (Apple Silicon) | `.dmg` |
|
||||
| Windows | `.exe` (NSIS 安装包) |
|
||||
|
||||
> 首次启动时需要下载 Whisper 模型(约 500MB),请确保网络通畅。
|
||||
|
||||
## 使用方式
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
"prepare-licenses-macos": "python3 ./scripts/prepare-bundled-licenses.py",
|
||||
"tauri-build-app": "npm run prepare-ffmpeg-macos && npm run prepare-licenses-macos && tauri build --bundles app",
|
||||
"tauri-build-dmg": "sh ./scripts/build-macos-dmg.sh",
|
||||
"tauri-build-dmg-x86_64": "TARGET_ARCH=x86_64 sh ./scripts/build-macos-dmg.sh",
|
||||
"tauri-build-windows": "tauri build --bundles nsis"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@ -5,10 +5,26 @@ set -eu
|
||||
ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
APP_NAME="CrossSubtitle-AI"
|
||||
VERSION=$(node -p "require('$ROOT_DIR/package.json').version")
|
||||
ARCH=$(uname -m)
|
||||
APP_PATH="$ROOT_DIR/src-tauri/target/release/bundle/macos/$APP_NAME.app"
|
||||
DMG_DIR="$ROOT_DIR/src-tauri/target/release/bundle/dmg"
|
||||
DMG_PATH="$DMG_DIR/${APP_NAME}_${VERSION}_${ARCH}.dmg"
|
||||
TARGET_ARCH=${TARGET_ARCH:-$(uname -m)}
|
||||
RUST_TARGET=""
|
||||
|
||||
case "$TARGET_ARCH" in
|
||||
arm64) RUST_TARGET="aarch64-apple-darwin" ;;
|
||||
x86_64) RUST_TARGET="x86_64-apple-darwin" ;;
|
||||
*)
|
||||
echo "Unsupported architecture: $TARGET_ARCH"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$(uname -m)" != "$TARGET_ARCH" ]; then
|
||||
TARGET_DIR="$ROOT_DIR/src-tauri/target/${RUST_TARGET}"
|
||||
else
|
||||
TARGET_DIR="$ROOT_DIR/src-tauri/target/release"
|
||||
fi
|
||||
APP_PATH="$TARGET_DIR/bundle/macos/$APP_NAME.app"
|
||||
DMG_DIR="$TARGET_DIR/bundle/dmg"
|
||||
DMG_PATH="$DMG_DIR/${APP_NAME}_${VERSION}_${TARGET_ARCH}.dmg"
|
||||
STAGING_DIR=$(mktemp -d "${TMPDIR:-/tmp}/crosssubtitle-dmg.XXXXXX")
|
||||
|
||||
cleanup() {
|
||||
@ -18,7 +34,16 @@ cleanup() {
|
||||
trap cleanup EXIT
|
||||
|
||||
cd "$ROOT_DIR"
|
||||
npm run tauri-build-app
|
||||
|
||||
export TARGET_ARCH
|
||||
npm run prepare-ffmpeg-macos
|
||||
npm run prepare-licenses-macos
|
||||
|
||||
TAURI_BUILD_OPTS="--bundles app"
|
||||
if [ "$(uname -m)" != "$TARGET_ARCH" ]; then
|
||||
TAURI_BUILD_OPTS="$TAURI_BUILD_OPTS --target $RUST_TARGET"
|
||||
fi
|
||||
npm run tauri -- build $TAURI_BUILD_OPTS
|
||||
|
||||
mkdir -p "$DMG_DIR"
|
||||
rm -f "$DMG_PATH"
|
||||
|
||||
@ -3,13 +3,19 @@
|
||||
set -eu
|
||||
|
||||
ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
TARGET_ARCH=$(uname -m)
|
||||
TARGET_ARCH=${TARGET_ARCH:-$(uname -m)}
|
||||
FFMPEG_SOURCE=${FFMPEG_SOURCE_PATH:-$(command -v ffmpeg)}
|
||||
VENDOR_ROOT="$ROOT_DIR/src-tauri/vendor/ffmpeg/macos-$TARGET_ARCH"
|
||||
BIN_DIR="$VENDOR_ROOT/bin"
|
||||
LIB_DIR="$VENDOR_ROOT/lib"
|
||||
MARK_DIR="$VENDOR_ROOT/.processed"
|
||||
|
||||
for dir in "$ROOT_DIR/src-tauri/vendor/ffmpeg"/macos-*; do
|
||||
if [ -d "$dir" ] && [ "$dir" != "$VENDOR_ROOT" ]; then
|
||||
rm -rf "$dir"
|
||||
fi
|
||||
done
|
||||
|
||||
rm -rf "$VENDOR_ROOT"
|
||||
mkdir -p "$BIN_DIR" "$LIB_DIR" "$MARK_DIR"
|
||||
|
||||
@ -53,7 +59,9 @@ resolve_dep_source() {
|
||||
for candidate in \
|
||||
"$LIB_DIR/$dep_name" \
|
||||
"/opt/homebrew/lib/$dep_name" \
|
||||
$(find /opt/homebrew/Cellar -path "*/lib/$dep_name" -print 2>/dev/null)
|
||||
"/usr/local/lib/$dep_name" \
|
||||
$(find /opt/homebrew/Cellar -path "*/lib/$dep_name" -print 2>/dev/null) \
|
||||
$(find /usr/local/Cellar -path "*/lib/$dep_name" -print 2>/dev/null)
|
||||
do
|
||||
if [ -n "$candidate" ] && [ -f "$candidate" ]; then
|
||||
printf '%s\n' "$candidate"
|
||||
|
||||
@ -3,15 +3,32 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT_DIR = Path(__file__).resolve().parent.parent
|
||||
CELLAR_DIR = Path("/opt/homebrew/Cellar")
|
||||
LICENSE_ROOT = ROOT_DIR / "src-tauri" / "vendor" / "licenses" / "homebrew"
|
||||
LICENSE_BUNDLE_ROOT = ROOT_DIR / "src-tauri" / "vendor" / "licenses_bundle"
|
||||
FFMPEG_RECEIPT = sorted(CELLAR_DIR.glob("ffmpeg/*/INSTALL_RECEIPT.json"))[-1]
|
||||
|
||||
KNOWN_CELLAR_PATHS = [
|
||||
Path(os.environ.get("HOMEBREW_PREFIX", "/opt/homebrew")) / "Cellar",
|
||||
Path("/opt/homebrew/Cellar"),
|
||||
Path("/usr/local/Cellar"),
|
||||
]
|
||||
|
||||
ffmpeg_receipts: list[Path] = []
|
||||
for cellar in KNOWN_CELLAR_PATHS:
|
||||
ffmpeg_receipts.extend(sorted(cellar.glob("ffmpeg/*/INSTALL_RECEIPT.json")))
|
||||
|
||||
if not ffmpeg_receipts:
|
||||
print("Warning: ffmpeg not found in any Homebrew Cellar path. Skipping license collection.")
|
||||
print("To collect licenses, install ffmpeg via Homebrew or set HOMEBREW_PREFIX.")
|
||||
exit(0)
|
||||
|
||||
CELLAR_DIR = ffmpeg_receipts[0].parent.parent.parent
|
||||
FFMPEG_RECEIPT = ffmpeg_receipts[0]
|
||||
LICENSE_PATTERNS = [
|
||||
"LICENSE*",
|
||||
"LICENCE*",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user