From 50c95b4291de5b70116dbe9cb47a252c3891587f Mon Sep 17 00:00:00 2001 From: "mr. M" Date: Sun, 24 Nov 2024 14:25:17 +0100 Subject: [PATCH] Refactor macOS and Windows mozconfig for improved cross-compilation settings and optimization options --- configs/macos/mozconfig | 57 ++++++++++---------- configs/windows/mozconfig | 107 +++++++++++++++++++------------------- 2 files changed, 80 insertions(+), 84 deletions(-) diff --git a/configs/macos/mozconfig b/configs/macos/mozconfig index f2ecc3c83..0a1fa65f2 100644 --- a/configs/macos/mozconfig +++ b/configs/macos/mozconfig @@ -1,40 +1,37 @@ -if test "$ZEN_RELEASE"; then +unset MOZ_STDCXX_COMPAT - unset MOZ_STDCXX_COMPAT +ac_add_options --disable-dmd +ac_add_options --enable-eme=widevine - ac_add_options --disable-dmd - ac_add_options --enable-eme=widevine +export MOZ_MACBUNDLE_ID=${appId} +export MOZ_MACBUNDLE_NAME="Zen Browser.app" - export MOZ_MACBUNDLE_ID=${appId} - export MOZ_MACBUNDLE_NAME="Zen Browser.app" +if test "$SURFER_COMPAT" = "x86_64"; then + export MOZ_PGO=1 + ac_add_options MOZ_PGO=1 + ac_add_options --target=x86_64-apple-darwin - if test "$SURFER_COMPAT" = "x86_64"; then - export MOZ_PGO=1 - ac_add_options MOZ_PGO=1 - ac_add_options --target=x86_64-apple-darwin + ac_add_options --enable-wasm-avx + ac_add_options --enable-optimize="-march=nehalem -mtune=haswell -O3 -w" - ac_add_options --enable-wasm-avx - ac_add_options --enable-optimize="-march=nehalem -mtune=haswell -O3 -w" + export CFLAGS="-O3 -march=nehalem" + export CPPFLAGS="-O3 -march=nehalem" + export CXXFLAGS="-O3 -march=nehalem" + export LDFLAGS="-Wl,-O3 -march=nehalem" + export RUSTFLAGS="-Ctarget-cpu=nehalem -C codegen-units=1" +else + ac_add_options --target=aarch64-apple-darwin - export CFLAGS="-O3 -march=nehalem" - export CPPFLAGS="-O3 -march=nehalem" - export CXXFLAGS="-O3 -march=nehalem" - export LDFLAGS="-Wl,-O3 -march=nehalem" - export RUSTFLAGS="-Ctarget-cpu=nehalem -C codegen-units=1" - else - ac_add_options --target=aarch64-apple-darwin + ac_add_options --enable-optimize="-O3 -mcpu=apple-m1 -march=armv8.3-a+simd" - ac_add_options --enable-optimize="-O3 -mcpu=apple-m1 -march=armv8.3-a+simd" - - # As of Clang 13, the default is -mcpu=apple-m1 when using a aarch64-apple-macos target, - # but we're using apple64-apple-darwin, which defaults to -mcpu=apple-a7, which disables - # a bunch of # performance-enabling CPU features. - export CFLAGS="-O3 -march=armv8.3-a+simd -mcpu=apple-m1" - export CPPFLAGS="-O3 -march=armv8.3-a+simd -mcpu=apple-m1" - export CXXFLAGS="-O3 -march=armv8.3-a+simd -mcpu=apple-m1" - export LDFLAGS="-Wl,-O3 -march=armv8.3-a+simd -mcpu=apple-m1" - export RUSTFLAGS="-C target-feature=+v8.3a -C codegen-units=1 -Ctarget-cpu=apple-m1" - fi + # As of Clang 13, the default is -mcpu=apple-m1 when using a aarch64-apple-macos target, + # but we're using apple64-apple-darwin, which defaults to -mcpu=apple-a7, which disables + # a bunch of # performance-enabling CPU features. + export CFLAGS="-O3 -march=armv8.3-a+simd -mcpu=apple-m1" + export CPPFLAGS="-O3 -march=armv8.3-a+simd -mcpu=apple-m1" + export CXXFLAGS="-O3 -march=armv8.3-a+simd -mcpu=apple-m1" + export LDFLAGS="-Wl,-O3 -march=armv8.3-a+simd -mcpu=apple-m1" + export RUSTFLAGS="-C target-feature=+v8.3a -C codegen-units=1 -Ctarget-cpu=apple-m1" fi export VERBOSE=1 diff --git a/configs/windows/mozconfig b/configs/windows/mozconfig index 3d49997d8..4f50ed13e 100644 --- a/configs/windows/mozconfig +++ b/configs/windows/mozconfig @@ -1,65 +1,64 @@ -if test "$ZEN_RELEASE"; then - if test "$ZEN_CROSS_COMPILING"; then - export WINSYSROOT="$(echo ~)/win-cross/vs2022" +if test "$ZEN_CROSS_COMPILING"; then - export WINE="$(echo ~)/win-cross/wine/bin/wine64" - export WINEDEBUG=-all + export WINSYSROOT="$(echo ~)/win-cross/vs2022" - export MOZ_STUB_INSTALLER=1 - export MOZ_PKG_FORMAT=TAR + export WINE="$(echo ~)/win-cross/wine/bin/wine64" + export WINEDEBUG=-all - export CROSS_BUILD=1 - CROSS_COMPILE=1 + export MOZ_STUB_INSTALLER=1 + export MOZ_PKG_FORMAT=TAR - if test "$SURFER_COMPAT" = "aarch64"; then - export WIN32_REDIST_DIR="$(echo ~)/win-cross/vs2022/VC/Redist/MSVC/14.38.33135/arm64/Microsoft.VC143.CRT" - else - export WIN32_REDIST_DIR="$(echo ~)/win-cross/vs2022/VC/Redist/MSVC/14.38.33135/x64/Microsoft.VC143.CRT" - fi + export CROSS_BUILD=1 + CROSS_COMPILE=1 - fi - - #? https://bugzilla.mozilla.org/show_bug.cgi?id=1617793 - #? https://phabricator.services.mozilla.com/D170170 - ac_add_options --disable-maintenance-service - ac_add_options --disable-bits-download - - if test "$SURFER_COMPAT" = "x86_64"; then - ac_add_options --target=x86_64-pc-windows-msvc - ac_add_options --enable-eme=widevine - - ac_add_options --enable-optimize="-O3 -w -ftree-vectorize" - - export CFLAGS="-mtune=haswell -march=x86-64 -O2 -Qvec -w" - export CPPFLAGS="-mtune=haswell -march=x86-64 -O2 -Qvec -w" - export CXXFLAGS="-flto=thin -mtune=haswell -march=x86-64 -O2 -Qvec -w" - export LDFLAGS="-Wl,-O2" - export RUSTFLAGS="-Clink-args=--icf=safe -C codegen-units=1 -Ctarget-cpu=x86-64" - elif test "$SURFER_COMPAT" = "aarch64"; then - ac_add_options --target=aarch64-pc-windows-msvc - ac_add_options --enable-eme=widevine - - ac_add_options --enable-optimize="-O2 -mtune=cortex-a55 -march=armv8.2-a+simd" - - export CFLAGS="-O2 -march=armv8.2-a+simd -mtune=cortex-a55" - export CPPFLAGS="-O2 -march=armv8.2-a+simd -mtune=cortex-a55" - export CXXFLAGS="-O2 -march=armv8.2-a+simd -mtune=cortex-a55" - export LDFLAGS="-Wl,-O2 -march=armv8.2-a+simd -mtune=cortex-a55" - export RUSTFLAGS="-C target-feature=+v8.2a -C codegen-units=1 -Ctarget-cpu=cortex-a55" + if test "$SURFER_COMPAT" = "aarch64"; then + export WIN32_REDIST_DIR="$(echo ~)/win-cross/vs2022/VC/Redist/MSVC/14.38.33135/arm64/Microsoft.VC143.CRT" else - ac_add_options --target=x86_64-pc-windows-msvc - ac_add_options --enable-eme=widevine - - ac_add_options --enable-optimize="-O2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -maes -ftree-vectorize -Xclang -w" - ac_add_options --enable-wasm-avx - - export CFLAGS="-O2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -maes -march=x86-64-v3" - export CPPFLAGS="-O2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -maes -march=x86-64-v3" - export CXXFLAGS="-O2 -flto=thin -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -maes -march=x86-64-v3" - export LDFLAGS="-Wl,-O3 -march=x86-64-v3" - export RUSTFLAGS="-Clink-args=--icf=safe -C target-feature=+avx2 -C codegen-units=1 -Ctarget-cpu=x86-64-v3" + export WIN32_REDIST_DIR="$(echo ~)/win-cross/vs2022/VC/Redist/MSVC/14.38.33135/x64/Microsoft.VC143.CRT" fi + +fi + +#? https://bugzilla.mozilla.org/show_bug.cgi?id=1617793 +#? https://phabricator.services.mozilla.com/D170170 +ac_add_options --disable-maintenance-service +ac_add_options --disable-bits-download + +if test "$SURFER_COMPAT" = "x86_64"; then + ac_add_options --target=x86_64-pc-windows-msvc + ac_add_options --enable-eme=widevine + + ac_add_options --enable-optimize="-O3 -w -ftree-vectorize" + + export CFLAGS="-mtune=haswell -march=x86-64 -O2 -Qvec -w" + export CPPFLAGS="-mtune=haswell -march=x86-64 -O2 -Qvec -w" + export CXXFLAGS="-flto=thin -mtune=haswell -march=x86-64 -O2 -Qvec -w" + export LDFLAGS="-Wl,-O2" + export RUSTFLAGS="-Clink-args=--icf=safe -C codegen-units=1 -Ctarget-cpu=x86-64" +elif test "$SURFER_COMPAT" = "aarch64"; then + ac_add_options --target=aarch64-pc-windows-msvc + ac_add_options --enable-eme=widevine + + ac_add_options --enable-optimize="-O2 -mtune=cortex-a55 -march=armv8.2-a+simd" + + export CFLAGS="-O2 -march=armv8.2-a+simd -mtune=cortex-a55" + export CPPFLAGS="-O2 -march=armv8.2-a+simd -mtune=cortex-a55" + export CXXFLAGS="-O2 -march=armv8.2-a+simd -mtune=cortex-a55" + export LDFLAGS="-Wl,-O2 -march=armv8.2-a+simd -mtune=cortex-a55" + export RUSTFLAGS="-C target-feature=+v8.2a -C codegen-units=1 -Ctarget-cpu=cortex-a55" +else + ac_add_options --target=x86_64-pc-windows-msvc + ac_add_options --enable-eme=widevine + + ac_add_options --enable-optimize="-O2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -maes -ftree-vectorize -Xclang -w" + ac_add_options --enable-wasm-avx + + export CFLAGS="-O2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -maes -march=x86-64-v3" + export CPPFLAGS="-O2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -maes -march=x86-64-v3" + export CXXFLAGS="-O2 -flto=thin -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -maes -march=x86-64-v3" + export LDFLAGS="-Wl,-O3 -march=x86-64-v3" + export RUSTFLAGS="-Clink-args=--icf=safe -C target-feature=+avx2 -C codegen-units=1 -Ctarget-cpu=x86-64-v3" fi #export POLLY="-mllvm -polly -mllvm -polly-2nd-level-tiling -mllvm -polly-loopfusion-greedy -mllvm -polly-pattern-matching-based-opts -mllvm -polly-position=before-vectorizer -mllvm -polly-vectorizer=stripmine"