Skip to content

Commit

Permalink
enable build and package of win32 variant
Browse files Browse the repository at this point in the history
  • Loading branch information
jonof committed Nov 21, 2021
1 parent b5ce335 commit 6ab110c
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 25 deletions.
3 changes: 3 additions & 0 deletions Makefile.msvc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ USE_ASM=0
!else
flags_cl=/arch:IA32
!endif
!if "$(PLATFORM)" == ""
PLATFORM=x86
!endif

!if $(RELEASE)
# release options
Expand Down
69 changes: 45 additions & 24 deletions tools/package-win.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,50 @@ $VERSION = Get-Date -UFormat "%Y%m%d"

$VCVARSALL = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"

if ($Args[0] -eq "build") {
Remove-Item "Makefile.msvcuser" -ErrorAction SilentlyContinue
Remove-Item "jfbuild\Makefile.msvcuser" -ErrorAction SilentlyContinue
& cmd.exe /c "$VCVARSALL" amd64 "&&" nmake /f Makefile.msvc clean all

} elseif ($Args[0] -eq "finish") {
Remove-Item "$PRODUCT-$VERSION-win" -Recurse -ErrorAction SilentlyContinue
Remove-Item "$PRODUCT-$VERSION-win.zip" -ErrorAction SilentlyContinue

$workDir = New-Item "$PRODUCT-$VERSION-win" -ItemType Directory
Copy-Item "sw.exe" $workDir
Copy-Item "build.exe" $workDir
Copy-Item "jfbuild\buildlic.txt" $workDir
Copy-Item "GPL.TXT" $workDir
Set-Content "$workDir\readme.html" (Get-Content "releasenotes.html" `
-Encoding UTF8 -Raw).Replace('$VERSION', $VERSION)

$vcredist = (New-Object -ComObject "WScript.Shell").CreateShortcut("$workDir\Microsoft Visual C++ Redistributable.url")
$vcredist.TargetPath = "https://aka.ms/vs/16/release/vc_redist.x64.exe"
$vcredist.Save()

Compress-Archive "$PRODUCT-$VERSION-win" "$PRODUCT-$VERSION-win.zip" -CompressionLevel Optimal
if ($Args.Length -lt 2) {
Write-Output "package-win.ps1 (amd64|x86) (build|finish)*"
exit
}

if ($Args[0] -eq "amd64") {
$ARCH = "amd64"
$DIRARCH = "win"
} elseif ($Args[0] -eq "x86") {
$ARCH = "x86"
$DIRARCH = "win32"
} else {
Write-Output "package-win.ps1 build"
Write-Output "package-win.ps1 finish"
Write-Warning ("Unknown arch type {0}" -f $Args[0])
exit
}

for ($arg = 1; $arg -lt $Args.Length; $arg++) {
if ($Args[$arg] -eq "build") {
Remove-Item "Makefile.msvcuser" -ErrorAction SilentlyContinue
Remove-Item "jfbuild\Makefile.msvcuser" -ErrorAction SilentlyContinue
& cmd.exe /c "$VCVARSALL" $ARCH 8.1 "&&" nmake /f Makefile.msvc clean all

} elseif ($Args[$arg] -eq "finish") {
Remove-Item "$PRODUCT-$VERSION-$DIRARCH" -Recurse -ErrorAction SilentlyContinue
Remove-Item "$PRODUCT-$VERSION-$DIRARCH.zip" -ErrorAction SilentlyContinue

$workDir = New-Item "$PRODUCT-$VERSION-$DIRARCH" -ItemType Directory
Copy-Item "sw.exe" $workDir
Copy-Item "build.exe" $workDir
Copy-Item "jfbuild\buildlic.txt" $workDir
Copy-Item "GPL.TXT" $workDir
Set-Content "$workDir\readme.html" (Get-Content "releasenotes.html" `
-Encoding UTF8 -Raw).Replace('$VERSION', $VERSION)

$vcredist = (New-Object -ComObject "WScript.Shell").CreateShortcut("$workDir\Microsoft Visual C++ Redistributable.url")
if ($ARCH -eq "amd64") {
$vcredist.TargetPath = "https://aka.ms/vs/16/release/vc_redist.x64.exe"
} else {
$vcredist.TargetPath = "https://aka.ms/vs/16/release/vc_redist.x86.exe"
}
$vcredist.Save()

Compress-Archive "$PRODUCT-$VERSION-$DIRARCH" "$PRODUCT-$VERSION-$DIRARCH.zip" -CompressionLevel Optimal
} else {
Write-Warning ("Unknown action {0}" -f $Args[$arg])
}
}

0 comments on commit 6ab110c

Please sign in to comment.