1
0
Fork 1
mirror of https://github.com/zen-browser/desktop.git synced 2025-07-08 00:10:00 +02:00

fix(build): clean up old build artifacts and update packaging process for setup.exe (closes https://github.com/zen-browser/desktop/issues/37)

This commit is contained in:
Mr. M 2025-04-14 00:59:37 +02:00
parent 87124fdaf4
commit a2017cc4c7
3 changed files with 44 additions and 10 deletions

View file

@ -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

View file

@ -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"
}

16
src/makensis-mk.patch Normal file
View file

@ -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' \