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

This commit is contained in:
Mauro Balades 2024-08-01 13:32:46 +02:00
parent e82464891f
commit 71fa9b96b5
5 changed files with 34 additions and 17 deletions

View file

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

View file

@ -18,7 +18,7 @@ import sharp from 'sharp'
import pngToIco from 'png-to-ico'
import asyncIcns from 'async-icns'
import { config } from '../..'
import { compatMode, config } from '../..'
import { CONFIGS_DIR, ENGINE_DIR, MELON_TMP_DIR } from '../../constants'
import { log } from '../../log'
import {
@ -260,6 +260,8 @@ export async function apply(name: string): Promise<void> {
await setupImages(configPath, outputPath)
await setupLocale(outputPath, brandingConfig)
await copyMozFiles(outputPath, brandingConfig)
setUpdateURLs();
}
function configureBrandingNsis(brandingNsis: string, brandingConfig: {
@ -349,3 +351,11 @@ function configureBrandingNsis(brandingNsis: string, brandingConfig: {
!define PROGRESS_BAR_BACKGROUND_COLOR 0xFFAA00
`);
}
function setUpdateURLs() {
const baseURL = `URL=https://@MOZ_APPUPDATE_HOST@/updates/browser/%BUILD_TARGET%/%CHANNEL%/update.xml`;
const appIni = join(ENGINE_DIR, 'build', 'application.ini.in');
const appIniContents = readFileSync(appIni).toString();
const updatedAppIni = appIniContents.replace(/URL=.*update.xml/g, baseURL);
writeFileSync(appIni, updatedAppIni);
}

View file

@ -1,10 +1,9 @@
import { existsSync } from 'node:fs'
import { readFile, writeFile } from 'node:fs/promises'
import { parse } from 'ini'
import { isAppleSilicon } from 'is-apple-silicon'
import { dirname, join } from 'node:path'
import { create } from 'xmlbuilder2'
import { bin_name, config } from '../..'
import { bin_name, compatMode, config } from '../..'
import { DIST_DIR, OBJ_DIR } from '../../constants'
import { log } from '../../log'
import {
@ -34,6 +33,9 @@ const ausPlatformsMap = {
],
macosArm: ['Darwin_aarch64-gcc3'],
win64: ['WINNT_x86_64-msvc', 'WINNT_x86_64-msvc-x64'],
linux32: ["Linux_x86-gcc3"],
win32: ["WINNT_x86-msvc", "WINNT_x86-msvc-x86", "WINNT_x86-msvc-x64"]
}
export async function getPlatformConfig() {
@ -46,21 +48,20 @@ export async function getPlatformConfig() {
}
function getReleaseMarName(releaseInfo: ReleaseInfo): string | undefined {
if (isAppleSilicon()) {
log.askForReport()
log.warning('Apple silicon is not yet supported by the distribution script')
if (!releaseInfo.archives) {
log.error('No archives found in the release information')
return
}
switch ((process as any).surferPlatform) {
case 'win32': {
return releaseInfo.x86?.windowsMar
return compatMode ? releaseInfo.archives["windows-x32"] : releaseInfo.archives["windows-x64"];
}
case 'darwin': {
return releaseInfo.x86?.macosMar
return compatMode ? releaseInfo.archives["macos-x64"] : releaseInfo.archives["macos-aarch64"];
}
case 'linux': {
return releaseInfo.x86?.linuxMar
return compatMode ? releaseInfo.archives["linux-x32"] : releaseInfo.archives["linux-x64"];
}
}
}
@ -114,17 +115,17 @@ async function writeUpdateFileToDisk(
function getTargets(): string[] {
if ((process as any).surferPlatform == 'win32') {
return ausPlatformsMap.win64
return compatMode ? ausPlatformsMap.win32 : ausPlatformsMap.win64
}
if ((process as any).surferPlatform == 'linux') {
return ausPlatformsMap.linux64
return compatMode ? ausPlatformsMap.linux32 : ausPlatformsMap.linux64
}
// Everything else will have to be darwin of some kind. So, for future possible
// Apple silicon support, we should chose between the two wisely
// TODO: This is a hack, fix it
if (isAppleSilicon()) {
if (!compatMode) {
return ausPlatformsMap.macosArm
}

View file

@ -48,6 +48,8 @@ export const bin_name = BIN_NAME
const programVersions = []
export const compatMode = process.env.SURFER_COMPAT == '1';
for (const brand in config.brands) {
const brandConfig = config.brands[brand]
programVersions.push({

View file

@ -61,10 +61,14 @@ export interface ReleaseInfo {
repo: string
}
x86?: {
windowsMar?: string
macosMar?: string
linuxMar?: string
archives?: {
"windows-x64"?: string,
"macos-aarch64"?: string,
"macos-x64"?: string,
"linux-x64"?: string,
"windows-x32"?: string,
"linux-x32"?: string,
}
}