39 lines
1.4 KiB
Bash
39 lines
1.4 KiB
Bash
|
|
#!/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; }
|
||
|
|
command -v cargo >/dev/null || { echo "Rust is required." >&2; exit 2; }
|
||
|
|
|
||
|
|
corepack enable 2>/dev/null || true
|
||
|
|
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"
|