2026-07-17 18:50:58 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
version="${HOLOLAKE_VERSION:-0.1.5}"
|
|
|
|
|
target="x86_64-pc-windows-msvc"
|
|
|
|
|
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
|
|
|
cd "$repo_root"
|
|
|
|
|
|
|
|
|
|
if [[ "$(uname -s)" != "Linux" ]]; then
|
|
|
|
|
echo "This cross-build entrypoint is intended for the JD Linux build node." >&2
|
|
|
|
|
exit 2
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if command -v apt-get >/dev/null 2>&1; then
|
|
|
|
|
apt_prefix=()
|
|
|
|
|
if [[ "$(id -u)" -ne 0 ]]; then apt_prefix=(sudo); fi
|
|
|
|
|
"${apt_prefix[@]}" apt-get update
|
|
|
|
|
"${apt_prefix[@]}" apt-get install -y clang curl lld llvm nsis build-essential pkg-config libssl-dev
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
command -v node >/dev/null || { echo "Node.js is required." >&2; exit 2; }
|
2026-07-17 19:25:40 +08:00
|
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
2026-07-17 19:11:01 +08:00
|
|
|
|
|
|
|
|
if ! command -v cargo >/dev/null 2>&1; then
|
|
|
|
|
command -v curl >/dev/null || { echo "curl is required to install Rust." >&2; exit 2; }
|
2026-07-17 19:16:40 +08:00
|
|
|
export RUSTUP_DIST_SERVER="${RUSTUP_DIST_SERVER:-https://rsproxy.cn}"
|
|
|
|
|
export RUSTUP_UPDATE_ROOT="${RUSTUP_UPDATE_ROOT:-https://rsproxy.cn/rustup}"
|
2026-07-17 19:11:01 +08:00
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
|
|
|
|
|
fi
|
2026-07-17 19:21:48 +08:00
|
|
|
export CARGO_REGISTRIES_CRATES_IO_PROTOCOL="${CARGO_REGISTRIES_CRATES_IO_PROTOCOL:-sparse}"
|
|
|
|
|
export CARGO_REGISTRIES_CRATES_IO_INDEX="${CARGO_REGISTRIES_CRATES_IO_INDEX:-sparse+https://rsproxy.cn/index/}"
|
2026-07-17 19:25:40 +08:00
|
|
|
export CARGO_SOURCE_CRATES_IO_REPLACE_WITH="${CARGO_SOURCE_CRATES_IO_REPLACE_WITH:-rsproxy}"
|
|
|
|
|
export CARGO_SOURCE_RSPROXY_REGISTRY="${CARGO_SOURCE_RSPROXY_REGISTRY:-sparse+https://rsproxy.cn/index/}"
|
2026-07-17 19:11:01 +08:00
|
|
|
|
|
|
|
|
if ! command -v corepack >/dev/null 2>&1; then
|
|
|
|
|
npm install --global corepack
|
|
|
|
|
fi
|
2026-07-17 18:50:58 +08:00
|
|
|
|
|
|
|
|
corepack enable 2>/dev/null || true
|
2026-07-17 19:11:01 +08:00
|
|
|
corepack prepare pnpm@10.25.0 --activate
|
2026-07-17 18:50:58 +08:00
|
|
|
rustup target add "$target"
|
|
|
|
|
command -v cargo-xwin >/dev/null || cargo install cargo-xwin --locked
|
|
|
|
|
|
|
|
|
|
pnpm install --frozen-lockfile
|
|
|
|
|
pnpm tauri build --runner cargo-xwin --target "$target" --bundles nsis
|
|
|
|
|
|
|
|
|
|
bundle_dir="src-tauri/target/$target/release/bundle/nsis"
|
|
|
|
|
installer="$(find "$bundle_dir" -maxdepth 1 -type f -name '*-setup.exe' -print -quit)"
|
|
|
|
|
[[ -n "$installer" ]] || { echo "No NSIS installer was produced." >&2; exit 1; }
|
|
|
|
|
[[ "$(basename "$installer")" == *"$version"* ]] || { echo "Installer filename does not contain version $version: $installer" >&2; exit 1; }
|
|
|
|
|
|
|
|
|
|
node scripts/verify-internal-package-content.mjs dist
|
|
|
|
|
sha256sum "$installer" > "$installer.sha256"
|
|
|
|
|
echo "$installer"
|