chore: Update package.json version to 1.1.5 and optimize platform flags

This commit is contained in:
Mauro Balades 2024-07-26 20:39:50 +02:00
parent f4081a12de
commit 5116b2d0ab
6 changed files with 105 additions and 9 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "@zen-browser/surfer", "name": "@zen-browser/surfer",
"version": "1.1.2", "version": "1.1.5",
"description": "Simplifying building firefox forks!", "description": "Simplifying building firefox forks!",
"main": "index.js", "main": "index.js",
"bin": { "bin": {

View file

@ -62,8 +62,9 @@ const applyConfig = async (os: string) => {
templateOptions templateOptions
) )
const osMozconfig = os === 'windows' ? 'linux' : os; // Windows uses the linux mozconfig
const osConfig = stringTemplate( const osConfig = stringTemplate(
readFileSync(resolve(CONFIGS_DIR, os, 'mozconfig')).toString(), readFileSync(resolve(CONFIGS_DIR, osMozconfig, 'mozconfig')).toString(),
templateOptions templateOptions
) )

View file

@ -53,7 +53,7 @@ async function unpackFirefoxSource(name: string): Promise<void> {
// //
// If BSD tar adds --transform support in the future, we can use that // If BSD tar adds --transform support in the future, we can use that
// instead // instead
if ((process as any).surferPlatform == 'darwin') { if (process.platform == 'darwin') {
// GNU Tar doesn't come preinstalled on any MacOS machines, so we need to // GNU Tar doesn't come preinstalled on any MacOS machines, so we need to
// check for it and ask for the user to install it if necessary // check for it and ask for the user to install it if necessary
if (!commandExistsSync('gtar')) { if (!commandExistsSync('gtar')) {

View file

@ -42,6 +42,7 @@ const BRANDING_STORE = join(ENGINE_DIR, 'browser', 'branding')
const BRANDING_FF = join(BRANDING_STORE, 'unofficial') const BRANDING_FF = join(BRANDING_STORE, 'unofficial')
const REQUIRED_FILES = ['logo.png'] const REQUIRED_FILES = ['logo.png']
const BRANDING_NSIS = 'branding.nsi';
const CSS_REPLACE_REGEX = new RegExp( const CSS_REPLACE_REGEX = new RegExp(
'#130829|hsla\\(235, 43%, 10%, .5\\)', '#130829|hsla\\(235, 43%, 10%, .5\\)',
@ -199,9 +200,9 @@ async function copyMozFiles(
(file) => !existsSync(join(outputPath, file.replace(BRANDING_FF, ''))) (file) => !existsSync(join(outputPath, file.replace(BRANDING_FF, '')))
) )
const css = files.filter((file) => extname(file).includes('css')) const css = files.filter((file) => extname(file).includes('css'));
const everythingElse = files.filter((file) => !css.includes(file)) const everythingElse = files.filter((file) => !css.includes(file) && !file.includes(BRANDING_NSIS));
for (const [contents, path] of css for (const [contents, path] of css
.map((filePath) => [ .map((filePath) => [
@ -217,6 +218,12 @@ async function copyMozFiles(
writeFileSync(path, contents) writeFileSync(path, contents)
} }
const brandingNsis = files.filter((file) => file.includes(BRANDING_NSIS));
console.assert(brandingNsis.length == 1, 'There should only be one branding.nsi file');
const outputBrandingNsis = join(outputPath, brandingNsis[0].replace(BRANDING_FF, ''));
log.debug('Configuring branding.nsi into ' + outputBrandingNsis);
configureBrandingNsis(outputBrandingNsis, brandingConfig);
// Copy everything else from the default firefox branding directory // Copy everything else from the default firefox branding directory
for (const file of everythingElse) { for (const file of everythingElse) {
mkdirpSync(dirname(join(outputPath, file.replace(BRANDING_FF, '')))) mkdirpSync(dirname(join(outputPath, file.replace(BRANDING_FF, ''))))
@ -254,3 +261,91 @@ export async function apply(name: string): Promise<void> {
await setupLocale(outputPath, brandingConfig) await setupLocale(outputPath, brandingConfig)
await copyMozFiles(outputPath, brandingConfig) await copyMozFiles(outputPath, brandingConfig)
} }
function configureBrandingNsis(brandingNsis: string, brandingConfig: {
backgroundColor: string
brandShorterName: string
brandShortName: string
brandFullName: string
brandingGenericName: string
brandingVendor: string
}) {
writeFileSync(brandingNsis, `
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# NSIS branding defines for official release builds.
# The nightly build branding.nsi is located in browser/installer/windows/nsis/
# The unofficial build branding.nsi is located in browser/branding/unofficial/
# BrandFullNameInternal is used for some registry and file system values
# instead of BrandFullName and typically should not be modified.
!define BrandFullNameInternal "${brandingConfig.brandFullName}"
!define BrandFullName "${brandingConfig.brandFullName}"
!define CompanyName "${brandingConfig.brandingVendor}"
!define URLInfoAbout "https://get-zen.vercel.app"
!define URLUpdateInfo "https://get-zen.vercel.app/release-notes/\${AppVersion}"
!define HelpLink "https://github.com/zen-browser/desktop/issues"
; The OFFICIAL define is a workaround to support different urls for Release and
; Beta since they share the same branding when building with other branches that
; set the update channel to beta.
!define OFFICIAL
!define URLStubDownloadX86 "https://download.mozilla.org/?os=win&lang=\${AB_CD}&product=firefox-latest"
!define URLStubDownloadAMD64 "https://download.mozilla.org/?os=win64&lang=\${AB_CD}&product=firefox-latest"
!define URLStubDownloadAArch64 "https://download.mozilla.org/?os=win64-aarch64&lang=\${AB_CD}&product=firefox-latest"
!define URLManualDownload "https://get-zen.vercel.app/download"
!define URLSystemRequirements "https://www.mozilla.org/firefox/system-requirements/"
!define Channel "release"
# The installer's certificate name and issuer expected by the stub installer
!define CertNameDownload "${brandingConfig.brandFullName}"
!define CertIssuerDownload "DigiCert SHA2 Assured ID Code Signing CA"
# Dialog units are used so the UI displays correctly with the system's DPI
# settings. These are tweaked to look good with the en-US strings; ideally
# we would customize them for each locale but we don't really have a way to
# implement that and it would be a ton of work for the localizers.
!define PROFILE_CLEANUP_LABEL_TOP "50u"
!define PROFILE_CLEANUP_LABEL_LEFT "22u"
!define PROFILE_CLEANUP_LABEL_WIDTH "175u"
!define PROFILE_CLEANUP_LABEL_HEIGHT "100u"
!define PROFILE_CLEANUP_LABEL_ALIGN "left"
!define PROFILE_CLEANUP_CHECKBOX_LEFT "22u"
!define PROFILE_CLEANUP_CHECKBOX_WIDTH "175u"
!define PROFILE_CLEANUP_BUTTON_LEFT "22u"
!define INSTALL_HEADER_TOP "70u"
!define INSTALL_HEADER_LEFT "22u"
!define INSTALL_HEADER_WIDTH "180u"
!define INSTALL_HEADER_HEIGHT "100u"
!define INSTALL_BODY_LEFT "22u"
!define INSTALL_BODY_WIDTH "180u"
!define INSTALL_INSTALLING_TOP "115u"
!define INSTALL_INSTALLING_LEFT "270u"
!define INSTALL_INSTALLING_WIDTH "150u"
!define INSTALL_PROGRESS_BAR_TOP "100u"
!define INSTALL_PROGRESS_BAR_LEFT "270u"
!define INSTALL_PROGRESS_BAR_WIDTH "150u"
!define INSTALL_PROGRESS_BAR_HEIGHT "12u"
!define PROFILE_CLEANUP_CHECKBOX_TOP_MARGIN "12u"
!define PROFILE_CLEANUP_BUTTON_TOP_MARGIN "12u"
!define PROFILE_CLEANUP_BUTTON_X_PADDING "80u"
!define PROFILE_CLEANUP_BUTTON_Y_PADDING "8u"
!define INSTALL_BODY_TOP_MARGIN "20u"
# Font settings that can be customized for each channel
!define INSTALL_HEADER_FONT_SIZE 20
!define INSTALL_HEADER_FONT_WEIGHT 600
!define INSTALL_INSTALLING_FONT_SIZE 15
!define INSTALL_INSTALLING_FONT_WEIGHT 600
# UI Colors that can be customized for each channel
!define COMMON_TEXT_COLOR 0x000000
!define COMMON_BACKGROUND_COLOR 0xFFFFFF
!define INSTALL_INSTALLING_TEXT_COLOR 0xFFFFFF
# This color is written as 0x00BBGGRR because it's actually a COLORREF value.
!define PROGRESS_BAR_BACKGROUND_COLOR 0xFFAA00
`);
}

View file

@ -29,7 +29,7 @@ export const copyManual = async (name: string): Promise<void> => {
} }
if ( if (
(process as any).surferPlatform == 'win32' && process.platform == 'win32' &&
!config.buildOptions.windowsUseSymbolicLinks !config.buildOptions.windowsUseSymbolicLinks
) { ) {
// Make the directory if it doesn't already exist. // Make the directory if it doesn't already exist.

View file

@ -62,12 +62,12 @@ export MOZ_APPUPDATE_HOST=${
function getPlatformOptimiseFlags(): string { function getPlatformOptimiseFlags(): string {
let optimiseFlags = `# Unknown platform ${(process as any).surferPlatform}` let optimiseFlags = `# Unknown platform ${(process as any).surferPlatform}`
if (process.env.ZEN_GA_GENERATE_PROFILE === '1') { if (process.env.ZEN_GA_GENERATE_PROFILE === '1') {
return `ac_add_options --enable-optimize="-O2"` return `ac_add_options --enable-optimize="-O2 -w"`
} }
switch ((process as any).surferPlatform) { switch ((process as any).surferPlatform) {
case 'linux': { case 'linux': {
optimiseFlags = `ac_add_options --enable-optimize="-march=x86-64-v3 -msse3 -mtune=haswell -O3 -w"` optimiseFlags = `ac_add_options --enable-optimize="-march=x86-64-v3 -msse3 -mtune=haswell -O3 -w -mavx -maes"`
break break
} }
case 'darwin': { case 'darwin': {
@ -75,7 +75,7 @@ function getPlatformOptimiseFlags(): string {
break break
} }
case 'win32': { case 'win32': {
optimiseFlags = `ac_add_options --enable-optimize="-Qvec -w -ftree-vectorize -msse3 -mssse3 -msse4.1 -mtune=haswell"` optimiseFlags = `ac_add_options --enable-optimize="-march=x86-64-v3 -Qvec -w -ftree-vectorize -msse3 -mssse3 -msse4.1 -mtune=haswell -mavx -maes"`
break break
} }
} }