Skip to content

Commit 5167c80

Browse files
committed
Update build script
1 parent b657035 commit 5167c80

File tree

2 files changed

+35
-11
lines changed

2 files changed

+35
-11
lines changed

build.bat renamed to build.cmd

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ SET INNOSETUP=%CD%\nvm.iss
33
SET ORIG=%CD%
44
REM SET GOPATH=%CD%\src
55
SET GOBIN=%CD%\bin
6+
SET GOBINS=%CD%\bins
67
REM Support for older architectures
7-
SET GOARCH=amd64
8+
rem SET GOARCH=386
89

910
REM Cleanup existing build if it exists
1011
if exist src\nvm.exe (
@@ -16,19 +17,28 @@ echo ----------------------------
1617
echo Building nvm.exe
1718
echo ----------------------------
1819
cd .\src
19-
go build nvm.go
20+
SET GOARCH=386
21+
go build -o %GOBINS%\nvm.exe nvm.go
22+
SET GOARCH=amd64
23+
go build -o %GOBINS%\nvm-64.exe nvm.go
24+
SET GOARCH=arm64
25+
go build -o %GOBINS%\nvm-arm64.exe nvm.go
2026

2127
REM Group the file with the helper binaries
22-
move nvm.exe "%GOBIN%"
28+
rem move nvm.exe "%GOBIN%"
2329
cd ..\
2430

2531
REM Codesign the executable
2632
echo ----------------------------
2733
echo Sign the nvm executable...
2834
echo ----------------------------
29-
buildtools\signtool.exe sign /debug /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a "%GOBIN%\nvm.exe"
35+
buildtools\signtool.exe sign /debug /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a "%GOBINS%\nvm.exe"
36+
buildtools\signtool.exe sign /debug /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a "%GOBINS%\nvm-64.exe"
37+
buildtools\signtool.exe sign /debug /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a "%GOBINS%\nvm-arm64.exe"
3038

31-
for /f %%i in ('"%GOBIN%\nvm.exe" version') do set AppVersion=%%i
39+
for /f %%i in ('"%GOBINS%\nvm.exe" version') do set AppVersion=%%i
40+
for /f %%i in ('"%GOBINS%\nvm-64.exe" version') do set AppVersion=%%i
41+
for /f %%i in ('"%GOBINS%\nvm-arm64.exe" version') do set AppVersion=%%i
3242
echo nvm.exe v%AppVersion% built.
3343

3444
REM Create the distribution folder
@@ -46,15 +56,20 @@ REM Create the distribution directory
4656
mkdir "%DIST%"
4757

4858
REM Create the "no install" zip version
49-
for %%a in ("%GOBIN%") do (buildtools\zip -j -9 -r "%DIST%\nvm-noinstall.zip" "%CD%\LICENSE" %%a\* -x "%GOBIN%\nodejs.ico")
59+
for %%a in ("%GOBIN%" "%GOBINS%") do (buildtools\zip -j -9 -r "%DIST%\nvm-noinstall.zip" "%CD%\LICENSE" %%a\* -x "%GOBIN%\nodejs.ico")
5060

5161
REM Generate update utility
5262
echo ----------------------------
5363
echo Generating update utility...
5464
echo ----------------------------
5565
cd .\updater
56-
go build nvm-update.go
57-
move nvm-update.exe "%DIST%"
66+
SET GOARCH=386
67+
go build -o %DIST%\nvm-update.exe nvm-update.go
68+
SET GOARCH=amd64
69+
go build -o %DIST%\nvm-update-64.exe nvm-update.go
70+
SET GOARCH=arm64
71+
go build -o %DIST%\nvm-update-arm64.exe nvm-update.go
72+
rem move nvm-update.exe "%DIST%"
5873
cd ..\
5974

6075
REM Generate the installer (InnoSetup)
@@ -72,6 +87,8 @@ echo ----------------------------
7287
echo Sign the updater...
7388
echo ----------------------------
7489
buildtools\signtool.exe sign /debug /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a "%DIST%\nvm-update.exe"
90+
buildtools\signtool.exe sign /debug /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a "%DIST%\nvm-update-64.exe"
91+
buildtools\signtool.exe sign /debug /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a "%DIST%\nvm-update-arm64.exe"
7592

7693
echo ----------------------------
7794
echo Bundle the installer...
@@ -82,9 +99,11 @@ buildtools\zip -j -9 -r "%DIST%\nvm-setup.zip" "%DIST%\nvm-setup.exe"
8299
echo ----------------------------
83100
echo Bundle the updater...
84101
echo ----------------------------
85-
buildtools\zip -j -9 -r "%DIST%\nvm-update.zip" "%DIST%\nvm-update.exe"
102+
buildtools\zip -j -9 -r "%DIST%\nvm-update.zip" "%DIST%\nvm-update.exe" "%DIST%\nvm-update-64.exe" "%DIST%\nvm-update-arm64.exe"
86103

87104
del "%DIST%\nvm-update.exe"
105+
del "%DIST%\nvm-update-64.exe"
106+
del "%DIST%\nvm-update-arm64.exe"
88107
del "%DIST%\nvm-setup.exe"
89108

90109
REM Generate checksums
@@ -97,7 +116,9 @@ echo complete
97116
echo ----------------------------
98117
echo Cleaning up...
99118
echo ----------------------------
100-
del "%GOBIN%\nvm.exe"
119+
del "%GOBINS%\nvm.exe"
120+
del "%GOBINS%\nvm-64.exe"
121+
del "%GOBINS%\nvm-arm64.exe"
101122
echo complete
102123
@REM del %GOBIN%\nvm-update.exe
103124
@REM del %GOBIN%\nvm-setup.exe

nvm.iss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
5353
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
5454

5555
[Files]
56-
Source: "{#ProjectRoot}\bin\*"; DestDir: "{app}"; BeforeInstall: PreInstall; Flags: ignoreversion recursesubdirs createallsubdirs; Excludes: "{#ProjectRoot}\bin\install.cmd"
56+
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"
57+
Source: "{#ProjectRoot}\bins\nvm-arm64.exe"; DestDir: "{app}"; DestName: "nvm.exe"; Check: InstallARM64; Flags: solidbreak
58+
Source: "{#ProjectRoot}\bins\nvm-64.exe"; DestDir: "{app}"; DestName: "nvm.exe"; Check: InstallX64; Flags: solidbreak
59+
Source: "{#ProjectRoot}\bins\nvm.exe"; DestDir: "{app}"; DestName: "nvm.exe"; Check: InstallOtherArch;
5760

5861
[Icons]
5962
Name: "{group}\{#MyAppShortName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{#MyIcon}"

0 commit comments

Comments
 (0)