From 5167c809dc3acb07f89416d301bc19cbae41f77b Mon Sep 17 00:00:00 2001 From: Wojciech Sobolewski <8691776+wsobolewski@users.noreply.github.com> Date: Mon, 4 Dec 2023 10:16:06 +0100 Subject: [PATCH] Update build script --- build.bat => build.cmd | 41 +++++++++++++++++++++++++++++++---------- nvm.iss | 5 ++++- 2 files changed, 35 insertions(+), 11 deletions(-) rename build.bat => build.cmd (63%) diff --git a/build.bat b/build.cmd similarity index 63% rename from build.bat rename to build.cmd index 37ae22a..65d23fa 100644 --- a/build.bat +++ b/build.cmd @@ -3,8 +3,9 @@ SET INNOSETUP=%CD%\nvm.iss SET ORIG=%CD% REM SET GOPATH=%CD%\src SET GOBIN=%CD%\bin +SET GOBINS=%CD%\bins REM Support for older architectures -SET GOARCH=amd64 +rem SET GOARCH=386 REM Cleanup existing build if it exists if exist src\nvm.exe ( @@ -16,19 +17,28 @@ echo ---------------------------- echo Building nvm.exe echo ---------------------------- cd .\src -go build nvm.go +SET GOARCH=386 +go build -o %GOBINS%\nvm.exe nvm.go +SET GOARCH=amd64 +go build -o %GOBINS%\nvm-64.exe nvm.go +SET GOARCH=arm64 +go build -o %GOBINS%\nvm-arm64.exe nvm.go REM Group the file with the helper binaries -move nvm.exe "%GOBIN%" +rem move nvm.exe "%GOBIN%" cd ..\ REM Codesign the executable echo ---------------------------- echo Sign the nvm executable... echo ---------------------------- -buildtools\signtool.exe sign /debug /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a "%GOBIN%\nvm.exe" +buildtools\signtool.exe sign /debug /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a "%GOBINS%\nvm.exe" +buildtools\signtool.exe sign /debug /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a "%GOBINS%\nvm-64.exe" +buildtools\signtool.exe sign /debug /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a "%GOBINS%\nvm-arm64.exe" -for /f %%i in ('"%GOBIN%\nvm.exe" version') do set AppVersion=%%i +for /f %%i in ('"%GOBINS%\nvm.exe" version') do set AppVersion=%%i +for /f %%i in ('"%GOBINS%\nvm-64.exe" version') do set AppVersion=%%i +for /f %%i in ('"%GOBINS%\nvm-arm64.exe" version') do set AppVersion=%%i echo nvm.exe v%AppVersion% built. REM Create the distribution folder @@ -46,15 +56,20 @@ REM Create the distribution directory mkdir "%DIST%" REM Create the "no install" zip version -for %%a in ("%GOBIN%") do (buildtools\zip -j -9 -r "%DIST%\nvm-noinstall.zip" "%CD%\LICENSE" %%a\* -x "%GOBIN%\nodejs.ico") +for %%a in ("%GOBIN%" "%GOBINS%") do (buildtools\zip -j -9 -r "%DIST%\nvm-noinstall.zip" "%CD%\LICENSE" %%a\* -x "%GOBIN%\nodejs.ico") REM Generate update utility echo ---------------------------- echo Generating update utility... echo ---------------------------- cd .\updater -go build nvm-update.go -move nvm-update.exe "%DIST%" +SET GOARCH=386 +go build -o %DIST%\nvm-update.exe nvm-update.go +SET GOARCH=amd64 +go build -o %DIST%\nvm-update-64.exe nvm-update.go +SET GOARCH=arm64 +go build -o %DIST%\nvm-update-arm64.exe nvm-update.go +rem move nvm-update.exe "%DIST%" cd ..\ REM Generate the installer (InnoSetup) @@ -72,6 +87,8 @@ echo ---------------------------- echo Sign the updater... echo ---------------------------- buildtools\signtool.exe sign /debug /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a "%DIST%\nvm-update.exe" +buildtools\signtool.exe sign /debug /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a "%DIST%\nvm-update-64.exe" +buildtools\signtool.exe sign /debug /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a "%DIST%\nvm-update-arm64.exe" echo ---------------------------- echo Bundle the installer... @@ -82,9 +99,11 @@ buildtools\zip -j -9 -r "%DIST%\nvm-setup.zip" "%DIST%\nvm-setup.exe" echo ---------------------------- echo Bundle the updater... echo ---------------------------- -buildtools\zip -j -9 -r "%DIST%\nvm-update.zip" "%DIST%\nvm-update.exe" +buildtools\zip -j -9 -r "%DIST%\nvm-update.zip" "%DIST%\nvm-update.exe" "%DIST%\nvm-update-64.exe" "%DIST%\nvm-update-arm64.exe" del "%DIST%\nvm-update.exe" +del "%DIST%\nvm-update-64.exe" +del "%DIST%\nvm-update-arm64.exe" del "%DIST%\nvm-setup.exe" REM Generate checksums @@ -97,7 +116,9 @@ echo complete echo ---------------------------- echo Cleaning up... echo ---------------------------- -del "%GOBIN%\nvm.exe" +del "%GOBINS%\nvm.exe" +del "%GOBINS%\nvm-64.exe" +del "%GOBINS%\nvm-arm64.exe" echo complete @REM del %GOBIN%\nvm-update.exe @REM del %GOBIN%\nvm-setup.exe diff --git a/nvm.iss b/nvm.iss index 17b82f2..e51531f 100644 --- a/nvm.iss +++ b/nvm.iss @@ -53,7 +53,10 @@ Name: "english"; MessagesFile: "compiler:Default.isl" Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1 [Files] -Source: "{#ProjectRoot}\bin\*"; DestDir: "{app}"; BeforeInstall: PreInstall; Flags: ignoreversion recursesubdirs createallsubdirs; Excludes: "{#ProjectRoot}\bin\install.cmd" +Source: "{#ProjectRoot}\bin\*"; DestDir: "{app}"; BeforeInstall: PreInstall; Flags: ignoreversion recursesubdirs createallsubdirs; Excludes: "{#ProjectRoot}\bin\install.cmd {#ProjectRoot}\bin\nvm-arm64.exe {#ProjectRoot}\bin\nvm-64.exe {#ProjectRoot}\bin\nvm.exe" +Source: "{#ProjectRoot}\bins\nvm-arm64.exe"; DestDir: "{app}"; DestName: "nvm.exe"; Check: InstallARM64; Flags: solidbreak +Source: "{#ProjectRoot}\bins\nvm-64.exe"; DestDir: "{app}"; DestName: "nvm.exe"; Check: InstallX64; Flags: solidbreak +Source: "{#ProjectRoot}\bins\nvm.exe"; DestDir: "{app}"; DestName: "nvm.exe"; Check: InstallOtherArch; [Icons] Name: "{group}\{#MyAppShortName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{#MyIcon}"