From a2017cc4c744fdb4fbe4ee79d8bc199413dbd919 Mon Sep 17 00:00:00 2001 From: "Mr. M" Date: Mon, 14 Apr 2025 00:59:37 +0200 Subject: [PATCH] fix(build): clean up old build artifacts and update packaging process for setup.exe (closes https://github.com/zen-browser/desktop/issues/37) --- .github/workflows/windows-release-build.yml | 3 ++ build/winsign/sign.ps1 | 35 +++++++++++++++------ src/makensis-mk.patch | 16 ++++++++++ 3 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 src/makensis-mk.patch diff --git a/.github/workflows/windows-release-build.yml b/.github/workflows/windows-release-build.yml index 64cdacaa..9f3f9586 100644 --- a/.github/workflows/windows-release-build.yml +++ b/.github/workflows/windows-release-build.yml @@ -285,6 +285,9 @@ jobs: rm -rf engine/obj-${{ matrix.arch }}-pc-windows-msvc/_tests rm -rf engine/obj-${{ matrix.arch }}-pc-windows-msvc/config/autoconf.mk rm -rf engine/obj-${{ matrix.arch }}-pc-windows-msvc/config.statusd/substs/ + rm -rf engine/obj-${{ matrix.arch }}-pc-windows-msvc/dist/install + + find engine/obj-${{ matrix.arch }}-pc-windows-msvc/dist -maxdepth 1 -type f -name "*.zip" -delete cp -r --no-dereference engine/obj-${{ matrix.arch }}-pc-windows-msvc/* obj-${{ matrix.arch }}-pc-windows-msvc/ || true diff --git a/build/winsign/sign.ps1 b/build/winsign/sign.ps1 index bcf55aa5..9068639e 100644 --- a/build/winsign/sign.ps1 +++ b/build/winsign/sign.ps1 @@ -58,25 +58,39 @@ Wait-Job -Name "DownloadGitl10n" function SignAndPackage($name) { echo "Executing on $name" rmdir .\dist -Recurse -ErrorAction SilentlyContinue - rmdir engine\obj-x86_64-pc-windows-msvc\ -Recurse -ErrorAction SilentlyContinue - cp windsign-temp\windows-x64-obj-$name engine\obj-x86_64-pc-windows-msvc\ -Recurse + rmdir engine\obj-$name-pc-windows-msvc\ -Recurse -ErrorAction SilentlyContinue + $objName=$name + # instead of arm, use aarch64 + if ($name -eq "arm64") { + $objName="aarch64" + } - # Configure each time since we are cloning from a linux environment into - # a windows environment, and the build system is not smart enough to detect that - # we are on a different platform. - cd .\engine - .\mach configure - cd .. + echo "Removing old obj dir" + rmdir engine\obj-$objName-pc-windows-msvc\ -Recurse -ErrorAction SilentlyContinue + + echo "Creating new obj dir" + cp windsign-temp\windows-x64-obj-$name engine\obj-$objName-pc-windows-msvc\ -Recurse + + echo "Copying setup.exe into obj dir" + $env:ZEN_SETUP_EXE_PATH="$PWD\windsign-temp\windows-x64-obj-$name\browser\installer\windows\instgen\setup.exe" - echo "Packaging $name" $env:MAR="..\\build\\winsign\\mar.exe" if ($name -eq "arm64") { $env:SURFER_COMPAT="aarch64" } else { $env:SURFER_COMPAT="x86_64" } - echo "Compat Mode? $env:SURFER_COMPAT" + + # Configure each time since we are cloning from a linux environment into + # a windows environment, and the build system is not smart enough to detect that + # we are on a different platform. + cd .\engine + echo "Configuring for $name" + .\mach configure + cd .. + + echo "Packaging $name" npm run package -- --verbose # In the release script, we do the following: @@ -112,6 +126,7 @@ function SignAndPackage($name) { # note: We need to sign it into a parent folder, called windows-x64-signed-$name rmdir .\windsign-temp\windows-binaries\windows-x64-signed-$name -Recurse -ErrorAction SilentlyContinue mv windsign-temp\windows-x64-signed-$name .\windsign-temp\windows-binaries -Force + rmdir engine\obj-$objName-pc-windows-msvc\ -Recurse -ErrorAction SilentlyContinue echo "Finished $name" } diff --git a/src/makensis-mk.patch b/src/makensis-mk.patch new file mode 100644 index 00000000..f26b2250 --- /dev/null +++ b/src/makensis-mk.patch @@ -0,0 +1,16 @@ +diff --git a/toolkit/mozapps/installer/windows/nsis/makensis.mk b/toolkit/mozapps/installer/windows/nsis/makensis.mk +index b4425034fb198fd5303af513d81a3db6b4d14e36..8c44945b4448eb1c69a73894b3e13fc8d2ef3ade 100644 +--- a/toolkit/mozapps/installer/windows/nsis/makensis.mk ++++ b/toolkit/mozapps/installer/windows/nsis/makensis.mk +@@ -64,6 +64,11 @@ endif + ifdef ZIP_IN + installer:: $(CONFIG_DIR)/setup.exe $(ZIP_IN) + @echo 'Packaging $(WIN32_INSTALLER_OUT).' ++ifneq ("$(ZEN_SETUP_EXE_PATH)","") ++ @echo 'setup-zen.exe exists, moving it to setup.exe ($(ZEN_SETUP_EXE_PATH))' ++ rm $(CONFIG_DIR)/setup.exe ++ cp $(ZEN_SETUP_EXE_PATH) $(CONFIG_DIR)/setup.exe ++endif + $(NSINSTALL) -D '$(ABS_DIST)/$(PKG_INST_PATH)' + $(PYTHON3) $(MOZILLA_DIR)/mach repackage installer \ + -o '$(ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe' \