From 0208447c2c028a0ff91d8184233abe1d87b8dd4d Mon Sep 17 00:00:00 2001 From: Alex Kontos Date: Sun, 3 Aug 2025 18:36:10 +0200 Subject: [PATCH] feat: add .mozconfig files for build configurations --- .gitignore | 2 - .mozconfig | 70 +++++++++++++++++++++++++++++++ .mozconfig-aarch64-apple-darwin | 57 +++++++++++++++++++++++++ .mozconfig-x86_64-apple-darwin | 57 +++++++++++++++++++++++++ .mozconfig-x86_64-pc-linux-gnu | 56 +++++++++++++++++++++++++ .mozconfig-x86_64-pc-windows-msvc | 65 ++++++++++++++++++++++++++++ 6 files changed, 305 insertions(+), 2 deletions(-) create mode 100644 .mozconfig create mode 100644 .mozconfig-aarch64-apple-darwin create mode 100644 .mozconfig-x86_64-apple-darwin create mode 100644 .mozconfig-x86_64-pc-linux-gnu create mode 100644 .mozconfig-x86_64-pc-windows-msvc diff --git a/.gitignore b/.gitignore index 54128923383b..c5b000f81ea1 100644 --- a/.gitignore +++ b/.gitignore @@ -49,8 +49,6 @@ ID # User files that may appear at the root /.clang-tidy /.clangd -/.mozconfig* -/mozconfig* /.moz-fast-forward /.moz-vendoring /old-configure diff --git a/.mozconfig b/.mozconfig new file mode 100644 index 000000000000..9672afd59920 --- /dev/null +++ b/.mozconfig @@ -0,0 +1,70 @@ +#!/bin/sh +# For local development builds + +case $(uname -s) in + Darwin) + # Any macOS specific settings + # For release builds we should use -march=core2 -mtune=haswell + export CC=$HOME/.mozbuild/clang/bin/clang + export CXX=$HOME/.mozbuild/clang/bin/clang++ + ;; + MINGW*) + # Any Windows specific settings + ac_add_options --disable-bits-download + ac_add_options --disable-maintenance-service + ac_add_options --disable-parental-controls + ;; + Linux) + # Any Linux specific settings + case $(uname -m) in + x86_64) + if test -d "$HOME/.mozbuild/clang/bin"; then + export CC=$HOME/.mozbuild/clang/bin/clang + export CXX=$HOME/.mozbuild/clang/bin/clang++ + else + export CC=clang + export CXX=clang++ + fi + if test -f "$HOME/.mozbuild/nasm/nasm"; then + export NASM=$HOME/.mozbuild/nasm/nasm + fi + ac_add_options --target=x86_64-pc-linux-gnu + ;; + ppc64le) + export CC=gcc + export CXX=g++ + ac_add_options --enable-optimize="-w" + ac_add_options --target=powerpc64le-unknown-linux-gnu + ;; + esac + ;; +esac + +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-updater + +ac_add_options --enable-application=browser +ac_add_options --enable-bootstrap +ac_add_options --enable-optimize="-Os -w" +ac_add_options --enable-tests + +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 -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 + +mk_add_options AUTOCLOBBER=1 +MOZ_REQUIRE_SIGNING= diff --git a/.mozconfig-aarch64-apple-darwin b/.mozconfig-aarch64-apple-darwin new file mode 100644 index 000000000000..6a14087c0b4c --- /dev/null +++ b/.mozconfig-aarch64-apple-darwin @@ -0,0 +1,57 @@ +# 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-release +fi + +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 +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-optimize="-O3 -mcpu=apple-m1 -w" +ac_add_options --enable-rust-simd +ac_add_options --enable-strip +ac_add_options --enable-updater + +ac_add_options --target=aarch64-apple-darwin + +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 +fi + +mk_add_options AUTOCLOBBER=1 diff --git a/.mozconfig-x86_64-apple-darwin b/.mozconfig-x86_64-apple-darwin new file mode 100644 index 000000000000..42a4907c2d48 --- /dev/null +++ b/.mozconfig-x86_64-apple-darwin @@ -0,0 +1,57 @@ +# 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-release +fi + +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 +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-optimize="-O3 -march=nehalem -mtune=haswell -w" +ac_add_options --enable-rust-simd +ac_add_options --enable-strip +ac_add_options --enable-updater + +ac_add_options --target=x86_64-apple-darwin + +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 +fi + +mk_add_options AUTOCLOBBER=1 diff --git a/.mozconfig-x86_64-pc-linux-gnu b/.mozconfig-x86_64-pc-linux-gnu new file mode 100644 index 000000000000..66c221663d58 --- /dev/null +++ b/.mozconfig-x86_64-pc-linux-gnu @@ -0,0 +1,56 @@ +if test -d "$HOME/.mozbuild/clang/bin"; then + export CC=$HOME/.mozbuild/clang/bin/clang + export CXX=$HOME/.mozbuild/clang/bin/clang++ +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 + ac_add_options --enable-lto + ac_add_options --enable-release +fi + +ac_add_options --disable-crashreporter +ac_add_options --disable-debug +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 +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-optimize="-O3 -march=core2 -mtune=haswell -w" +ac_add_options --enable-pulseaudio +ac_add_options --enable-rust-simd +ac_add_options --enable-strip +ac_add_options --enable-updater + +ac_add_options --target=x86_64-pc-linux-gnu + +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 +fi +if test -f "$PWD/mozilla-api"; then + ac_add_options --with-mozilla-api-keyfile="$PWD"/mozilla-api +fi + +export RUSTC_OPT_LEVEL=2 +export MOZ_INCLUDE_SOURCE_INFO=1 +mk_add_options AUTOCLOBBER=1 +MOZ_REQUIRE_SIGNING= diff --git a/.mozconfig-x86_64-pc-windows-msvc b/.mozconfig-x86_64-pc-windows-msvc new file mode 100644 index 000000000000..635607cb3ae6 --- /dev/null +++ b/.mozconfig-x86_64-pc-windows-msvc @@ -0,0 +1,65 @@ +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:" +export 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 RUSTC_OPT_LEVEL=2 +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-release +fi + +ac_add_options --disable-bits-download +ac_add_options --disable-crashreporter +ac_add_options --disable-debug +ac_add_options --disable-dmd +ac_add_options --disable-geckodriver +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 +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-optimize="-O2 -Qvec -w -clang:-ftree-vectorize -clang:-march=core2 -clang:-mtune=haswell" +ac_add_options --enable-rust-simd +ac_add_options --enable-strip +ac_add_options --enable-updater + +ac_add_options --target=x86_64-pc-mingw32 + +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 +fi +MOZ_REQUIRE_SIGNING= \ No newline at end of file