From 4f899da565360cb51ab2d3d43f4c4bf25af2d95f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B0=E6=9C=94?= <565183519@qq.com> Date: Fri, 17 Jul 2026 19:35:18 +0800 Subject: [PATCH] build: package JD Windows binary with NSIS --- scripts/build-windows-jd-cross.sh | 30 ++++++++++++-- scripts/windows-installer.nsi | 66 +++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 4 deletions(-) create mode 100644 scripts/windows-installer.nsi diff --git a/scripts/build-windows-jd-cross.sh b/scripts/build-windows-jd-cross.sh index 84359b2..41a0d7c 100755 --- a/scripts/build-windows-jd-cross.sh +++ b/scripts/build-windows-jd-cross.sh @@ -42,13 +42,35 @@ 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 +# Tauri's Linux CLI intentionally only exposes Linux bundle targets. Compile the +# Windows application with cargo-xwin, then hand the resulting payload to NSIS. +pnpm tauri build --runner cargo-xwin --target "$target" --no-bundle -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; } +release_dir="src-tauri/target/$target/release" +app_exe="$release_dir/tolaria.exe" +[[ -f "$app_exe" ]] || { echo "No Windows executable was produced: $app_exe" >&2; exit 1; } + +bundle_dir="$release_dir/bundle/nsis" +stage_dir="$bundle_dir/stage" +installer="$bundle_dir/HoloLake-Era_${version}_x64-internal-setup.exe" +rm -rf "$stage_dir" +mkdir -p "$stage_dir/resources" "$bundle_dir" +cp "$app_exe" "$stage_dir/HoloLake Era.exe" +cp src-tauri/icons/icon.ico "$stage_dir/icon.ico" +cp -R src-tauri/resources/mcp-server "$stage_dir/resources/" +cp -R src-tauri/resources/agent-docs "$stage_dir/resources/" +cp -R src-tauri/resources/public-architecture "$stage_dir/resources/" + +makensis \ + -DAPP_VERSION="$version" \ + -DSTAGE_DIR="$stage_dir" \ + -DOUTPUT_FILE="$installer" \ + scripts/windows-installer.nsi + +[[ -f "$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 +node scripts/verify-internal-package-content.mjs "$stage_dir" sha256sum "$installer" > "$installer.sha256" echo "$installer" diff --git a/scripts/windows-installer.nsi b/scripts/windows-installer.nsi new file mode 100644 index 0000000..a7f32be --- /dev/null +++ b/scripts/windows-installer.nsi @@ -0,0 +1,66 @@ +Unicode true +RequestExecutionLevel user +SetCompressor /SOLID lzma + +!ifndef APP_VERSION + !error "APP_VERSION is required" +!endif +!ifndef STAGE_DIR + !error "STAGE_DIR is required" +!endif +!ifndef OUTPUT_FILE + !error "OUTPUT_FILE is required" +!endif + +Name "HoloLake Era" +OutFile "${OUTPUT_FILE}" +InstallDir "$LOCALAPPDATA\Programs\HoloLake Era" +InstallDirRegKey HKCU "Software\Guanghu\HoloLake Era" "InstallDir" +Icon "${STAGE_DIR}/icon.ico" +UninstallIcon "${STAGE_DIR}/icon.ico" + +VIProductVersion "0.1.5.0" +VIAddVersionKey "ProductName" "HoloLake Era" +VIAddVersionKey "ProductVersion" "${APP_VERSION}" +VIAddVersionKey "CompanyName" "Guanghu Language World" +VIAddVersionKey "FileDescription" "HoloLake Era internal installer" + +Page directory +Page instfiles +UninstPage uninstConfirm +UninstPage instfiles + +Section "HoloLake Era" SEC_MAIN + SetOutPath "$INSTDIR" + File "${STAGE_DIR}/HoloLake Era.exe" + File "${STAGE_DIR}/icon.ico" + File /r "${STAGE_DIR}/resources" + + WriteUninstaller "$INSTDIR\Uninstall.exe" + WriteRegStr HKCU "Software\Guanghu\HoloLake Era" "InstallDir" "$INSTDIR" + WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\HoloLakeEra" "DisplayName" "HoloLake Era" + WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\HoloLakeEra" "DisplayVersion" "${APP_VERSION}" + WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\HoloLakeEra" "DisplayIcon" "$INSTDIR\icon.ico" + WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\HoloLakeEra" "UninstallString" '"$INSTDIR\Uninstall.exe"' + + CreateDirectory "$SMPROGRAMS\HoloLake Era" + CreateShortcut "$SMPROGRAMS\HoloLake Era\HoloLake Era.lnk" "$INSTDIR\HoloLake Era.exe" "" "$INSTDIR\icon.ico" + CreateShortcut "$DESKTOP\HoloLake Era.lnk" "$INSTDIR\HoloLake Era.exe" "" "$INSTDIR\icon.ico" + + WriteRegStr HKCU "Software\Classes\tolaria" "" "URL:Tolaria Protocol" + WriteRegStr HKCU "Software\Classes\tolaria" "URL Protocol" "" + WriteRegStr HKCU "Software\Classes\tolaria\shell\open\command" "" '"$INSTDIR\HoloLake Era.exe" "%1"' + WriteRegStr HKCU "Software\Classes\guanghu" "" "URL:Guanghu Protocol" + WriteRegStr HKCU "Software\Classes\guanghu" "URL Protocol" "" + WriteRegStr HKCU "Software\Classes\guanghu\shell\open\command" "" '"$INSTDIR\HoloLake Era.exe" "%1"' +SectionEnd + +Section "Uninstall" + Delete "$DESKTOP\HoloLake Era.lnk" + RMDir /r "$SMPROGRAMS\HoloLake Era" + DeleteRegKey HKCU "Software\Classes\tolaria" + DeleteRegKey HKCU "Software\Classes\guanghu" + DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\HoloLakeEra" + DeleteRegKey HKCU "Software\Guanghu\HoloLake Era" + RMDir /r "$INSTDIR" +SectionEnd