Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

chore: add packaging powershell script

Lars Berger67e9c375d681
diff --git a/resources/scripts/package.ps1 b/resources/scripts/package.ps1
new file mode 100644
index 00000000..b3cb2f82
--- /dev/null
+++ b/resources/scripts/package.ps1
@@ -0,0 +1,49 @@
+# Usage: ./resources/scripts/package.ps1 -VERSION_NUMBER 1.0.0
+param(
+ [Parameter(Mandatory=$true)]
+ [string]$VERSION_NUMBER
+)
+
+Write-Output "Packaging with version number: $VERSION_NUMBER"
+
+Write-Output "Creating output directory"
+New-Item -ItemType Directory -Force -Path "out"
+
+Write-Output "Downloading latest Zebar MSI's"
+$latestRelease = 'https://api.github.com/repos/glzr-io/zebar/releases/latest'
+$latestInstallers = Invoke-RestMethod $latestRelease | % assets | ? name -like "*.msi"
+$latestInstallers | % { Invoke-WebRequest $_.browser_download_url -OutFile (Join-Path "out" $_.name) }
+
+# Rust targets to build for (x64 and arm64).
+$rustTargets = @("x86_64-pc-windows-msvc", "aarch64-pc-windows-msvc")
+
+foreach ($target in $rustTargets) {
+ $outDir = if ($target -eq "x86_64-pc-windows-msvc") { "x64" } else { "arm64" }
+ $sourceDir = "target/$target/release"
+
+ Write-Output "Creating output directories for executables"
+ New-Item -ItemType Directory -Force -Path "out/$outDir/noconsole", "out/$outDir/console"
+
+ Write-Output "Building for $target (windows subsystem)"
+ cargo build --locked --release --target $target --features no_console
+ Move-Item -Path "$sourceDir/wm.exe", "$sourceDir/watcher.exe" -Destination "out/$outDir/noconsole"
+
+ Write-Output "Building for $target (console subsystem)"
+ cargo build --locked --release --target $target
+ Move-Item -Path "$sourceDir/wm.exe", "$sourceDir/watcher.exe" -Destination "out/$outDir/console"
+}
+
+# WiX architectures to create installers for (x64 and arm64).
+$wixArchs = @("x64", "arm64")
+
+foreach ($arch in $wixArchs) {
+ Write-Output "Creating MSI installer ($arch)"
+ wix build -arch $arch -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext `
+ -out "./out/installer-$arch.msi" "./resources/wix/standalone.wxs" "./resources/wix/standalone-ui.wxs" `
+ -d VERSION_NUMBER="$VERSION_NUMBER"
+}
+
+Write-Output "Creating universal installer"
+wix build -arch "x64" -ext WixToolset.BootstrapperApplications.wixext `
+ -out "./out/installer-universal.exe" "./resources/wix/bundle.wxs" `
+ -d VERSION_NUMBER="$VERSION_NUMBER"
diff --git a/resources/wix/standalone.wxs b/resources/wix/standalone.wxs
index e78e65a6..64dc416b 100644
--- a/resources/wix/standalone.wxs
+++ b/resources/wix/standalone.wxs
@@ -1,22 +1,12 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
- <Product
- Id="*"
+ <Package
Name="GlazeWM"
- UpgradeCode="ef0f849b-d90d-4647-bb26-730c6fce5f9e"
Version="$(var.VERSION_NUMBER)"
+ UpgradeCode="ef0f849b-d90d-4647-bb26-730c6fce5f9e"
Manufacturer="Glzr Software Pte. Ltd."
- Languages="1033"
- Codepage="1252"
+ Language="1033"
+ Scope="perMachine"
>
- <Package
- Id="*"
- Keywords="Installer"
- InstallerVersion="450"
- Languages="0"
- Compressed="yes"
- InstallScope="perMachine"
- />
-
<!--
Reinstall all files; rewrite all registry entries; reinstall all shortcuts.
Ref: https://docs.microsoft.com/en-us/windows/win32/msi/reinstallmode
@@ -74,5 +64,5 @@
</Component>
</Directory>
</StandardDirectory>
- </Product>
+ </Package>
</Wix>