Automatically add NSIS plugins as part of the bundle process

Avoids the need to manually copy them into place
This commit is contained in:
Damien Elmes 2023-05-20 10:43:53 +10:00
parent c520b59311
commit c49ea40ddf
3 changed files with 22 additions and 5 deletions

View file

@ -110,11 +110,17 @@ const LINUX_QT_PLUGINS: OnlineArchive = OnlineArchive {
sha256: "66bb568aca7242bc55ad419bf5c96755ca15d2a743e1c3a09cba8b83230b138b",
};
const NSIS_PLUGINS: OnlineArchive = OnlineArchive {
url: "https://github.com/ankitects/anki-bundle-extras/releases/download/anki-2023-05-19/nsis.tar.zst",
sha256: "6133f730ece699de19714d0479c73bc848647d277e9cc80dda9b9ebe532b40a8",
};
fn download_dist_folder_deps(build: &mut Build) -> Result<()> {
let mut bundle_deps = vec![":wheels"];
if cfg!(windows) {
download_and_extract(build, "win_amd64_audio", WIN_AUDIO, empty_manifest())?;
bundle_deps.push(":extract:win_amd64_audio");
download_and_extract(build, "nsis_plugins", NSIS_PLUGINS, empty_manifest())?;
bundle_deps.extend([":extract:win_amd64_audio", ":extract:nsis_plugins"]);
} else if cfg!(target_os = "macos") {
if targetting_macos_arm() {
download_and_extract(build, "mac_arm_audio", MAC_ARM_AUDIO, empty_manifest())?;

View file

@ -1,12 +1,18 @@
;; This installer was written many years ago, and it is probably worth investigating modern
;; installer alternatives.
;; installer alternatives at one point.
!addplugindir .
!include "fileassoc.nsh"
!include WinVer.nsh
!include x64.nsh
; must be installed into NSIS install location
; can be found on https://github.com/ankitects/anki-bundle-extras/releases/tag/anki-2022-02-09
!include nsProcess.nsh
!define nsProcess::FindProcess `!insertmacro nsProcess::FindProcess`
!macro nsProcess::FindProcess _FILE _ERR
nsProcess::_FindProcess /NOUNLOAD `${_FILE}`
Pop ${_ERR}
!macroend
;--------------------------------

View file

@ -100,6 +100,11 @@ fn build_installer(
bundle_root.join("fileassoc.nsh"),
include_str!("../fileassoc.nsh"),
)?;
#[cfg(windows)]
fs::write(
bundle_root.join("nsProcess.dll"),
include_bytes!("../../../../out/extracted/nsis_plugins/nsProcess.dll"),
)?;
let mut cmd = Command::new("c:/program files (x86)/nsis/makensis.exe");
cmd.arg("-V3");
if uninstaller {