Skip to content

Commit df2a07b

Browse files
committed
Fix winarm64 build
1 parent 28418a0 commit df2a07b

2 files changed

Lines changed: 22 additions & 13 deletions

File tree

build/win/build.bat

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
SET script_dir=%~dp0
22
SET version=%~1
3+
SET arch=%~2
34
if not defined version SET version=1.0.0
4-
powershell.exe -noprofile -executionpolicy bypass -file %script_dir%build.ps1 -Version %version%
5+
if not defined arch SET arch=x64
6+
powershell.exe -noprofile -executionpolicy bypass -file %script_dir%build.ps1 -Version %version% -Arch %arch%

build/win/build.ps1

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
param (
2-
[string]$Version = "1.0.0"
1+
param (
2+
[string]$Version = "1.0.0",
3+
[ValidateSet("x64", "arm64")]
4+
[string]$Arch = "x64"
35
)
46

57
$ErrorActionPreference = 'Stop'
@@ -18,10 +20,12 @@ New-Item -Path $buildDir -ItemType Directory -Force
1820

1921
#region 7z
2022
$7zDir = Join-Path $buildDir "7z"
21-
$7zDlPath = Join-Path $7zDir "7z25.01-zstd-x64.exe"
2223
New-Item -Path $7zDir -ItemType Directory -Force
24+
25+
$7zFileName = "7z25.01-zstd-$Arch.exe"
26+
$7zDlPath = Join-Path $7zDir $7zFileName
2327
$7zDlSplat = @{
24-
Uri = "https://github.com/mcmilk/7-Zip-zstd/releases/download/v25.01-v1.5.7-R3/7z25.01-zstd-x64.exe"
28+
Uri = "https://github.com/mcmilk/7-Zip-zstd/releases/download/v25.01-v1.5.7-R3/$7zFileName"
2529
OutFile = $7zDlPath
2630
}
2731
Invoke-WebRequest @7zDlSplat
@@ -30,11 +34,13 @@ tar -xzf $7zDlPath -C $7zDir
3034

3135
#region curl-impersonate
3236
$curlDir = Join-Path $buildDir "curl-impersonate"
33-
$curlVersion = "v1.5.1"
34-
$curlArchivePath = Join-Path $curlDir "libcurl-impersonate-$($curlVersion).x86_64-win32.tar.gz"
37+
$curlVersion = "v1.5.6"
38+
$curlTriplet = if ($Arch -eq "arm64") { "arm64-win32" } else { "x86_64-win32" }
39+
$curlArchiveName = "libcurl-impersonate-$($curlVersion).$curlTriplet.tar.gz"
40+
$curlArchivePath = Join-Path $curlDir $curlArchiveName
3541
New-Item -Path "$curlDir" -Type Directory -Force
3642
$curlImpersonateSplat = @{
37-
Uri = "https://github.com/lexiforest/curl-impersonate/releases/download/$($curlVersion)/libcurl-impersonate-$($curlVersion).x86_64-win32.tar.gz"
43+
Uri = "https://github.com/lexiforest/curl-impersonate/releases/download/$($curlVersion)/$curlArchiveName"
3844
OutFile = $curlArchivePath
3945
}
4046
Invoke-WebRequest @curlImpersonateSplat
@@ -49,21 +55,22 @@ Invoke-WebRequest @cacertSplat
4955
#region stalker-gamma-cli
5056
$stalkerCliDir = Join-Path $buildDir "stalker-gamma-cli"
5157
$pathToProject = (Join-Path (Join-Path $repoRoot "stalker-gamma-cli") "stalker-gamma-cli.csproj")
52-
dotnet publish -c Release $pathToProject -o $stalkerCliDir -p:AssemblyVersion=$Version
58+
$dotnetRid = "win-$Arch"
59+
dotnet publish -c Release $pathToProject -o $stalkerCliDir -r $dotnetRid -p:AssemblyVersion=$Version
5360
#endregion
5461

5562
$stalkerCliResourceDir = Join-Path $stalkerCliDir "resources"
5663
New-Item -Path $stalkerCliResourceDir -ItemType Directory -Force
5764

5865
Copy-Item -Path (Join-Path $7zDir "7z.exe") -Destination (Join-Path $stalkerCliResourceDir "7zz.exe")
5966
Copy-Item -Path (Join-Path $7zDir "7z.dll") -Destination (Join-Path $stalkerCliResourceDir "7z.dll")
60-
#Get-ChildItem -Path (Join-Path $curlDir "bin") -File | Where-Object {$_.Extension -ne '.bat'} | ForEach-Object {Copy-Item $_.FullName $stalkerCliDir }
6167
Move-Item (Join-Path (Join-Path $curlDir "bin") "libcurl-impersonate.dll") $stalkerCliDir
6268
Copy-Item -Path (Join-Path $curlDir "cacert.pem") -Destination (Join-Path $stalkerCliDir "cacert.pem")
6369

6470
Remove-Item -Path (Join-Path $stalkerCliDir "*.pdb")
6571

66-
if (Test-Path stalker-gamma+win.x64.zip) {
67-
Remove-Item stalker-gamma+win.x64.zip -Force
72+
$zipName = "stalker-gamma+win.$Arch.zip"
73+
if (Test-Path $zipName) {
74+
Remove-Item $zipName -Force
6875
}
69-
& (Join-Path $7zDir "7z.exe") a -tzip -mx9 -r stalker-gamma+win.x64.zip (Join-Path $stalkerCliDir "*")
76+
& (Join-Path $7zDir "7z.exe") a -tzip -mx9 -r $zipName (Join-Path $stalkerCliDir "*")

0 commit comments

Comments
 (0)