From 9ec0dbd031d570c1803e47ba7ec8d40b11044230 Mon Sep 17 00:00:00 2001 From: Alex Kontos Date: Thu, 14 Aug 2025 11:19:16 +0100 Subject: [PATCH] refactor: re-work mozconfigs --- .mozconfig | 17 +++++++--- .mozconfig-aarch64-apple-darwin | 49 +++++++++++++--------------- .mozconfig-x86_64-apple-darwin | 52 ++++++++++++++--------------- .mozconfig-x86_64-pc-linux-gnu | 34 ++++++++++++------- .mozconfig-x86_64-pc-windows-msvc | 54 ++++++++++++++----------------- 5 files changed, 106 insertions(+), 100 deletions(-) diff --git a/.mozconfig b/.mozconfig index 253db873f85f..051579ed469a 100644 --- a/.mozconfig +++ b/.mozconfig @@ -44,21 +44,27 @@ ac_add_options --disable-crashreporter ac_add_options --disable-debug ac_add_options --disable-dmd ac_add_options --disable-geckodriver -ac_add_options --disable-jprof ac_add_options --disable-profiling -ac_add_options --disable-trace-logging -ac_add_options --disable-verify-mar +ac_add_options --disable-tests ac_add_options --disable-updater ac_add_options --enable-application=browser -ac_add_options --enable-bootstrap +# Make sure to have the clang version in sync with your rust version +# curl -L https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.cache.level-3.toolchains.v3.linux64-clang-20.latest/artifacts/public/build/clang.tar.zst -o clang.tar.zst +# tar -xvf clang.tar.zst -C $HOME/.mozbuild +# rm clang.tar.zst +ac_add_options --enable-bootstrap=-clang +ac_add_options --enable-jxl ac_add_options --enable-optimize="-Os -w" -ac_add_options --enable-tests +ac_add_options --enable-unverified-updates ac_add_options --with-app-basename=Waterfox ac_add_options --with-app-name=waterfox ac_add_options --with-branding=waterfox/browser/branding ac_add_options --with-distribution-id=net.waterfox +if [ -d "$PWD"/waterfox/browser/locales/en-GB ]; then + ac_add_options --with-l10n-base="$PWD"/waterfox/browser/locales +fi if test -x "$(command -v sccache)"; then ac_add_options --with-ccache=sccache @@ -69,3 +75,4 @@ fi mk_add_options AUTOCLOBBER=1 mk_add_options MOZ_OBJDIR=./obj-"$(uname -s)"-"$(uname -m)" export MOZ_REQUIRE_SIGNING= +export MOZ_TELEMETRY_REPORTING= diff --git a/.mozconfig-aarch64-apple-darwin b/.mozconfig-aarch64-apple-darwin index b1d2904d27ba..ac86b04708f1 100644 --- a/.mozconfig-aarch64-apple-darwin +++ b/.mozconfig-aarch64-apple-darwin @@ -1,28 +1,13 @@ #!/bin/sh # Targetting ARM64 builds. Expected to be run on Linux. -TOOLS=$HOME/macos-cross -CROSS_SYSROOT=$TOOLS/MacOSX12.3.sdk -export CC="$HOME"/.mozbuild/clang/bin/clang -export CXX="$HOME"/.mozbuild/clang/bin/clang++ -export DMG_TOOL="$TOOLS"/dmg/dmg -export DSYMUTIL="$HOME"/.mozbuild/clang/bin/dsymutil -export HFS_TOOL="$TOOLS"/dmg/hfsplus -export HOST_CFLAGS="-g" -export HOST_CXXFLAGS="-g" -export HOST_LDFLAGS="-g" -export MACOS_SDK_DIR="$CROSS_SYSROOT" -export MKFSHFS="$TOOLS"/hfsplus-tools/newfs_hfs -mk_add_options "export LD_LIBRARY_PATH=$HOME/.mozbuild/clang/lib" -mk_add_options "export PATH=$TOOLS/cctools/bin:$HOME/.mozbuild/clang/bin:$PATH" -unset MOZ_STDCXX_COMPAT - -if test "$WFX_RELEASE"; then - ac_add_options --enable-lto - ac_add_options --enable-optimize="-O3 -mcpu=apple-m1 -w" +if test "$WFX_RELEASE" || test "$WFX_PRE_RELEASE"; then + ac_add_options --enable-lto=cross + ac_add_options --enable-optimize="-mcpu=apple-m1 -O3 -w" ac_add_options --enable-release ac_add_options --enable-rust-simd ac_add_options RUSTC_OPT_LEVEL=3 + export MOZILLA_OFFICIAL=1 export RUSTFLAGS="$RUSTFLAGS -Ctarget-cpu=apple-m1" fi @@ -30,21 +15,32 @@ ac_add_options --disable-crashreporter ac_add_options --disable-debug ac_add_options --disable-dmd ac_add_options --disable-geckodriver -ac_add_options --disable-jprof ac_add_options --disable-profiling ac_add_options --disable-tests -ac_add_options --disable-trace-logging -ac_add_options --disable-verify-mar ac_add_options --enable-application=browser -ac_add_options --enable-bootstrap +ac_add_options --enable-bootstrap=-clang,-sccache if test -x "$(command -v sccache)"; then ac_add_options --with-ccache=sccache elif test -f "$HOME/.mozbuild/sccache/sccache"; then ac_add_options --with-ccache="$HOME"/.mozbuild/sccache/sccache fi ac_add_options --enable-install-strip +ac_add_options --enable-jxl +if test "$GEN_PGO"; then + ac_add_options --enable-profile-generate=cross +elif test "$USE_PGO"; then + ac_add_options --enable-profile-use=cross + ac_add_options --with-pgo-jarlog="$GITHUB_WORKSPACE"/en-US.log + ac_add_options --with-pgo-profile-path="$GITHUB_WORKSPACE"/merged.profdata +fi ac_add_options --enable-strip +if test "$WFX_RELEASE"; then + ac_add_options --enable-update-channel=release +elif test "$WFX_PRE_RELEASE"; then + ac_add_options --enable-update-channel=beta +fi +ac_add_options --enable-unverified-updates ac_add_options --enable-updater ac_add_options --target=aarch64-apple-darwin @@ -53,9 +49,10 @@ ac_add_options --with-app-basename=Waterfox ac_add_options --with-app-name=waterfox ac_add_options --with-branding=waterfox/browser/branding ac_add_options --with-distribution-id=net.waterfox -if test -f "$PWD/browser/locales/l10n"; then - ac_add_options --with-l10n-base="$PWD"/browser/locales/l10n +if [ -d "$PWD"/waterfox/browser/locales/en-GB ]; then + ac_add_options --with-l10n-base="$PWD"/waterfox/browser/locales fi -mk_add_options AUTOCLOBBER=1 +export MOZ_INCLUDE_SOURCE_INFO=1 export MOZ_REQUIRE_SIGNING= +export MOZ_TELEMETRY_REPORTING= diff --git a/.mozconfig-x86_64-apple-darwin b/.mozconfig-x86_64-apple-darwin index 1a111286f193..5a294179a4ca 100644 --- a/.mozconfig-x86_64-apple-darwin +++ b/.mozconfig-x86_64-apple-darwin @@ -1,29 +1,13 @@ #!/bin/sh +# Targetting X64 builds. Expected to be run on Linux. -# Targetting ARM64 builds. Expected to be run on Linux. - -TOOLS=$HOME/macos-cross -CROSS_SYSROOT=$TOOLS/MacOSX12.3.sdk -export CC="$HOME"/.mozbuild/clang/bin/clang -export CXX="$HOME"/.mozbuild/clang/bin/clang++ -export DMG_TOOL="$TOOLS"/dmg/dmg -export DSYMUTIL="$HOME"/.mozbuild/clang/bin/dsymutil -export HFS_TOOL="$TOOLS"/dmg/hfsplus -export HOST_CFLAGS="-g" -export HOST_CXXFLAGS="-g" -export HOST_LDFLAGS="-g" -export MACOS_SDK_DIR="$CROSS_SYSROOT" -export MKFSHFS="$TOOLS"/hfsplus-tools/newfs_hfs -mk_add_options "export LD_LIBRARY_PATH=$HOME/.mozbuild/clang/lib" -mk_add_options "export PATH=$TOOLS/cctools/bin:$HOME/.mozbuild/clang/bin:$PATH" -unset MOZ_STDCXX_COMPAT - -if test "$WFX_RELEASE"; then - ac_add_options --enable-lto - ac_add_options --enable-optimize="-O3 -march=nehalem -mtune=haswell -w" +if test "$WFX_RELEASE" || test "$WFX_PRE_RELEASE"; then + ac_add_options --enable-lto=cross + ac_add_options --enable-optimize="-march=nehalem -mtune=haswell -O3 -w" ac_add_options --enable-release ac_add_options --enable-rust-simd ac_add_options RUSTC_OPT_LEVEL=3 + export MOZILLA_OFFICIAL=1 export RUSTFLAGS="$RUSTFLAGS -Ctarget-cpu=nehalem" fi @@ -31,21 +15,32 @@ ac_add_options --disable-crashreporter ac_add_options --disable-debug ac_add_options --disable-dmd ac_add_options --disable-geckodriver -ac_add_options --disable-jprof ac_add_options --disable-profiling ac_add_options --disable-tests -ac_add_options --disable-trace-logging -ac_add_options --disable-verify-mar ac_add_options --enable-application=browser -ac_add_options --enable-bootstrap +ac_add_options --enable-bootstrap=-clang,-sccache if test -x "$(command -v sccache)"; then ac_add_options --with-ccache=sccache elif test -f "$HOME/.mozbuild/sccache/sccache"; then ac_add_options --with-ccache="$HOME"/.mozbuild/sccache/sccache fi ac_add_options --enable-install-strip +ac_add_options --enable-jxl +if test "$GEN_PGO"; then + ac_add_options --enable-profile-generate=cross +elif test "$USE_PGO"; then + ac_add_options --enable-profile-use=cross + ac_add_options --with-pgo-jarlog="$GITHUB_WORKSPACE"/en-US.log + ac_add_options --with-pgo-profile-path="$GITHUB_WORKSPACE"/merged.profdata +fi ac_add_options --enable-strip +if test "$WFX_RELEASE"; then + ac_add_options --enable-update-channel=release +elif test "$WFX_PRE_RELEASE"; then + ac_add_options --enable-update-channel=beta +fi +ac_add_options --enable-unverified-updates ac_add_options --enable-updater ac_add_options --target=x86_64-apple-darwin @@ -54,9 +49,10 @@ ac_add_options --with-app-basename=Waterfox ac_add_options --with-app-name=waterfox ac_add_options --with-branding=waterfox/browser/branding ac_add_options --with-distribution-id=net.waterfox -if test -f "$PWD/browser/locales/l10n"; then - ac_add_options --with-l10n-base="$PWD"/browser/locales/l10n +if [ -d "$PWD"/waterfox/browser/locales/en-GB ]; then + ac_add_options --with-l10n-base="$PWD"/waterfox/browser/locales fi -mk_add_options AUTOCLOBBER=1 +export MOZ_INCLUDE_SOURCE_INFO=1 export MOZ_REQUIRE_SIGNING= +export MOZ_TELEMETRY_REPORTING= diff --git a/.mozconfig-x86_64-pc-linux-gnu b/.mozconfig-x86_64-pc-linux-gnu index db65d971419e..a0887012089e 100644 --- a/.mozconfig-x86_64-pc-linux-gnu +++ b/.mozconfig-x86_64-pc-linux-gnu @@ -7,17 +7,15 @@ else export CC=clang export CXX=clang++ fi -if test -f "$HOME/.mozbuild/nasm/nasm"; then - export NASM="$HOME"/.mozbuild/nasm/nasm -fi -if test "$WFX_RELEASE"; then +if test "$WFX_RELEASE" || test "$WFX_PRE_RELEASE"; then ac_add_options --enable-lto - ac_add_options --enable-optimize="-O3 -march=core2 -mtune=haswell -w" + ac_add_options --enable-optimize="-march=x86-64-v2 -mtune=generic -O3 -w" ac_add_options --enable-release ac_add_options --enable-rust-simd ac_add_options RUSTC_OPT_LEVEL=3 - export RUSTFLAGS="$RUSTFLAGS -Ctarget-cpu=core2" + export MOZILLA_OFFICIAL=1 + export RUSTFLAGS="$RUSTFLAGS -Ctarget-cpu=x86-64-v2" fi ac_add_options --disable-crashreporter @@ -26,19 +24,33 @@ ac_add_options --disable-dmd ac_add_options --disable-geckodriver ac_add_options --disable-profiling ac_add_options --disable-tests -ac_add_options --disable-verify-mar ac_add_options --enable-alsa ac_add_options --enable-application=browser -ac_add_options --enable-bootstrap +ac_add_options --enable-bootstrap=-clang,-sccache if test -x "$(command -v sccache)"; then ac_add_options --with-ccache=sccache elif test -f "$HOME/.mozbuild/sccache/sccache"; then ac_add_options --with-ccache="$HOME"/.mozbuild/sccache/sccache fi ac_add_options --enable-install-strip +ac_add_options --enable-jxl +ac_add_options --enable-linker=lld +if test "$GEN_PGO"; then + ac_add_options --enable-profile-generate +elif test "$USE_PGO"; then + ac_add_options --enable-profile-use + ac_add_options --with-pgo-jarlog=$PWD/en-US.log + ac_add_options --with-pgo-profile-path=$PWD/merged.profdata +fi ac_add_options --enable-pulseaudio ac_add_options --enable-strip +if test "$WFX_RELEASE"; then + ac_add_options --enable-update-channel=release +elif test "$WFX_PRE_RELEASE"; then + ac_add_options --enable-update-channel=beta +fi +ac_add_options --enable-unverified-updates ac_add_options --enable-updater ac_add_options --target=x86_64-pc-linux-gnu @@ -47,13 +59,13 @@ ac_add_options --with-app-basename=Waterfox ac_add_options --with-app-name=waterfox ac_add_options --with-branding=waterfox/browser/branding ac_add_options --with-distribution-id=net.waterfox -if test -f "$PWD/browser/locales/l10n"; then - ac_add_options --with-l10n-base="$PWD"/browser/locales/l10n +if [ -d "$PWD"/waterfox/browser/locales/en-GB ]; then + ac_add_options --with-l10n-base="$PWD"/waterfox/browser/locales fi if test -f "$PWD/mozilla-api"; then ac_add_options --with-mozilla-api-keyfile="$PWD"/mozilla-api fi export MOZ_INCLUDE_SOURCE_INFO=1 -mk_add_options AUTOCLOBBER=1 export MOZ_REQUIRE_SIGNING= +export MOZ_TELEMETRY_REPORTING= diff --git a/.mozconfig-x86_64-pc-windows-msvc b/.mozconfig-x86_64-pc-windows-msvc index b21c719db890..50f5ad84a608 100644 --- a/.mozconfig-x86_64-pc-windows-msvc +++ b/.mozconfig-x86_64-pc-windows-msvc @@ -1,37 +1,17 @@ #!/bin/sh - export CROSS_BUILD=1 -MSVC="14.32.31326" -WSDK="10.0.22000.0" -TOOLS=$HOME/win-cross -EXTRA_PATH="$HOME/.mozbuild/clang/bin:$TOOLS/visual-c/tools/msvc/$MSVC/bin/hostx64/x64:" -WINDOWSSDKDIR="$TOOLS/win-sdk" - - -export CC="$HOME/.mozbuild/clang/bin/clang-cl" -export CXX="$HOME/.mozbuild/clang/bin/clang-cl" -export DIA_SDK_PATH="$TOOLS/dia-sdk" -export HOST_CC="$HOME/.mozbuild/clang/bin/clang" -export HOST_CXX="$HOME/.mozbuild/clang/bin/clang++" -export MIDL="$TOOLS/wine/bin/widl" export MOZ_INCLUDE_SOURCE_INFO=1 export MOZ_STUB_INSTALLER=1 -export WIN32_REDIST_DIR="$TOOLS/visual-c/redist/msvc/$MSVC/x64/microsoft.vc143.crt" -export WIN_UCRT_REDIST_DIR="$WINDOWSSDKDIR/redist/${WSDK}/ucrt/dlls/x64" -export WINE="$TOOLS/wine/bin/wine64" export WINEDEBUG=-all -mk_add_options "export LD_PRELOAD=$TOOLS/liblowercase/liblowercase.so" -mk_add_options "export LOWERCASE_DIRS=$TOOLS" -mk_add_options "export PATH=$EXTRA_PATH$PATH" - -if test "$WFX_RELEASE"; then - ac_add_options --enable-lto - ac_add_options --enable-optimize="-O2 -Qvec -w -clang:-ftree-vectorize -clang:-march=core2 -clang:-mtune=haswell" +if test "$WFX_RELEASE" || test "$WFX_PRE_RELEASE"; then + ac_add_options --enable-lto=cross + ac_add_options --enable-optimize="-clang:-march=x86-64-v2 -clang:-mtune=generic -O2 -w" ac_add_options --enable-release ac_add_options --enable-rust-simd ac_add_options RUSTC_OPT_LEVEL=3 - export RUSTFLAGS="$RUSTFLAGS -Ctarget-cpu=core2" + export MOZILLA_OFFICIAL=1 + export RUSTFLAGS="$RUSTFLAGS -Ctarget-cpu=x86-64-v2" fi ac_add_options --disable-bits-download @@ -43,17 +23,30 @@ ac_add_options --disable-maintenance-service ac_add_options --disable-parental-controls ac_add_options --disable-profiling ac_add_options --disable-tests -ac_add_options --disable-verify-mar -ac_add_options --enable-bootstrap -ac_add_options --enable-default-browser-agent +ac_add_options --enable-bootstrap=-clang,-sccache if test -x "$(command -v sccache)"; then ac_add_options --with-ccache=sccache elif test -f "$HOME/.mozbuild/sccache/sccache"; then ac_add_options --with-ccache="$HOME"/.mozbuild/sccache/sccache fi +ac_add_options --enable-default-browser-agent ac_add_options --enable-install-strip +ac_add_options --enable-jxl +if test "$GEN_PGO"; then + ac_add_options --enable-profile-generate=cross +elif test "$USE_PGO"; then + ac_add_options --enable-profile-use=cross + ac_add_options --with-pgo-jarlog="$GITHUB_WORKSPACE"/en-US.log + ac_add_options --with-pgo-profile-path="$GITHUB_WORKSPACE"/merged.profdata +fi ac_add_options --enable-strip +if test "$WFX_RELEASE"; then + ac_add_options --enable-update-channel=release +elif test "$WFX_PRE_RELEASE"; then + ac_add_options --enable-update-channel=beta +fi +ac_add_options --enable-unverified-updates ac_add_options --enable-updater ac_add_options --target=x86_64-pc-mingw32 @@ -62,7 +55,8 @@ ac_add_options --with-app-basename=Waterfox ac_add_options --with-app-name=waterfox ac_add_options --with-branding=waterfox/browser/branding ac_add_options --with-distribution-id=net.waterfox -if test -f "$PWD/browser/locales/l10n"; then - ac_add_options --with-l10n-base="$PWD"/browser/locales/l10n +if [ -d "$PWD"/waterfox/browser/locales/en-GB ]; then + ac_add_options --with-l10n-base="$PWD"/waterfox/browser/locales fi export MOZ_REQUIRE_SIGNING= +export MOZ_TELEMETRY_REPORTING=