diff --git a/configs/linux/mozconfig b/configs/linux/mozconfig index 153eff6a2..97f55ef9a 100644 --- a/configs/linux/mozconfig +++ b/configs/linux/mozconfig @@ -1,55 +1,57 @@ # Setting the compiler based on the existence of clang bin directory -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 "$ZEN_RELEASE"; then + 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 "$SURFER_COMPAT" = "x86_64"; then - ac_add_options --target=x86_64-pc-linux - ac_add_options --enable-eme=widevine + if test "$SURFER_COMPAT" = "x86_64"; then + ac_add_options --target=x86_64-pc-linux + ac_add_options --enable-eme=widevine - # Enable Profile Guided Optimization - export MOZ_PGO=1 - ac_add_options MOZ_PGO=1 + # Enable Profile Guided Optimization + export MOZ_PGO=1 + ac_add_options MOZ_PGO=1 - # Optimization flags for SURFER_COMPAT - ac_add_options --enable-optimize="-O3 -march=x86-64" + # Optimization flags for SURFER_COMPAT + ac_add_options --enable-optimize="-O3 -march=x86-64" - export CFLAGS="$CFLAGS -O3 -ffp-contract=fast -march=x86-64" - export CPPFLAGS="$CPPFLAGS -O3 -ffp-contract=fast -march=x86-64" - export CXXFLAGS="$CXXFLAGS -O3 -flto=thin -ffp-contract=fast -march=x86-64" - export LDFLAGS="$LDFLAGS -Wl,-O3 -Wl,-mllvm,-fp-contract=fast -march=x86-64" - export RUSTFLAGS="$RUSTFLAGS -C target-cpu=x86-64 -C codegen-units=1 -Clink-args=--icf=safe" -elif test "$SURFER_COMPAT" = "aarch64"; then - ac_add_options --target=aarch64-linux-gnu + export CFLAGS="$CFLAGS -O3 -ffp-contract=fast -march=x86-64" + export CPPFLAGS="$CPPFLAGS -O3 -ffp-contract=fast -march=x86-64" + export CXXFLAGS="$CXXFLAGS -O3 -flto=thin -ffp-contract=fast -march=x86-64" + export LDFLAGS="$LDFLAGS -Wl,-O3 -Wl,-mllvm,-fp-contract=fast -march=x86-64" + export RUSTFLAGS="$RUSTFLAGS -C target-cpu=x86-64 -C codegen-units=1 -Clink-args=--icf=safe" + elif test "$SURFER_COMPAT" = "aarch64"; then + ac_add_options --target=aarch64-linux-gnu - ac_add_options --enable-optimize="-O3" + ac_add_options --enable-optimize="-O3" - export CFLAGS="$CFLAGS -O3" - export CPPFLAGS="$CPPFLAGS -O3" - export CXXFLAGS="$CXXFLAGS -O3" - export LDFLAGS="$LDFLAGS -Wl,-O3" - export RUSTFLAGS="$RUSTFLAGS -C codegen-units=1 -Clink-args=--icf=safe" -else - ac_add_options --target=x86_64-pc-linux - ac_add_options --enable-eme=widevine + export CFLAGS="$CFLAGS -O3" + export CPPFLAGS="$CPPFLAGS -O3" + export CXXFLAGS="$CXXFLAGS -O3" + export LDFLAGS="$LDFLAGS -Wl,-O3" + export RUSTFLAGS="$RUSTFLAGS -C codegen-units=1 -Clink-args=--icf=safe" + else + ac_add_options --target=x86_64-pc-linux + ac_add_options --enable-eme=widevine - # Enable Profile Guided Optimization - export MOZ_PGO=1 - ac_add_options MOZ_PGO=1 + # Enable Profile Guided Optimization + export MOZ_PGO=1 + ac_add_options MOZ_PGO=1 - # Optimization flags for general release - ac_add_options --enable-wasm-avx - ac_add_options --enable-optimize="-O3 -march=x86-64-v3 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -maes -mpopcnt -mpclmul" - - export CFLAGS="$CFLAGS -O3 -ffp-contract=fast -march=x86-64-v3 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -maes -mpopcnt -mpclmul" - export CPPFLAGS="$CPPFLAGS -O3 -ffp-contract=fast -march=x86-64-v3 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -maes -mpopcnt -mpclmul" - export CXXFLAGS="$CXXFLAGS -O3 -flto=thin -ffp-contract=fast -march=x86-64-v3 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -maes -mpopcnt -mpclmul" - export LDFLAGS="$LDFLAGS -Wl,-O3 -Wl,-mllvm,-fp-contract=fast -march=x86-64-v3" - export RUSTFLAGS="$RUSTFLAGS -C target-cpu=x86-64-v3 -C target-feature=+sse4.1 -C target-feature=+avx2 -C codegen-units=1 -Clink-args=--icf=safe" + # Optimization flags for general release + ac_add_options --enable-wasm-avx + ac_add_options --enable-optimize="-O3 -march=x86-64-v3 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -maes -mpopcnt -mpclmul" + + export CFLAGS="$CFLAGS -O3 -ffp-contract=fast -march=x86-64-v3 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -maes -mpopcnt -mpclmul" + export CPPFLAGS="$CPPFLAGS -O3 -ffp-contract=fast -march=x86-64-v3 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -maes -mpopcnt -mpclmul" + export CXXFLAGS="$CXXFLAGS -O3 -flto=thin -ffp-contract=fast -march=x86-64-v3 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -maes -mpopcnt -mpclmul" + export LDFLAGS="$LDFLAGS -Wl,-O3 -Wl,-mllvm,-fp-contract=fast -march=x86-64-v3" + export RUSTFLAGS="$RUSTFLAGS -C target-cpu=x86-64-v3 -C target-feature=+sse4.1 -C target-feature=+avx2 -C codegen-units=1 -Clink-args=--icf=safe" + fi fi export VERBOSE=1 diff --git a/configs/macos/mozconfig b/configs/macos/mozconfig index d71f88078..f2ecc3c83 100644 --- a/configs/macos/mozconfig +++ b/configs/macos/mozconfig @@ -1,38 +1,42 @@ -unset MOZ_STDCXX_COMPAT +if test "$ZEN_RELEASE"; then -ac_add_options --disable-dmd -ac_add_options --enable-eme=widevine + unset MOZ_STDCXX_COMPAT -export MOZ_MACBUNDLE_ID=${appId} -export MOZ_MACBUNDLE_NAME="Zen Browser.app" + ac_add_options --disable-dmd + ac_add_options --enable-eme=widevine -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 + export MOZ_MACBUNDLE_ID=${appId} + export MOZ_MACBUNDLE_NAME="Zen Browser.app" - ac_add_options --enable-wasm-avx - ac_add_options --enable-optimize="-march=nehalem -mtune=haswell -O3 -w" + 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 - 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-wasm-avx + ac_add_options --enable-optimize="-march=nehalem -mtune=haswell -O3 -w" - ac_add_options --enable-optimize="-O3 -mcpu=apple-m1 -march=armv8.3-a+simd" + 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 - # 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" + 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 fi + export VERBOSE=1 # Enable polly for macos, since they have a more stable set of GPU drivers, diff --git a/configs/windows/mozconfig b/configs/windows/mozconfig index b64a893ea..3d49997d8 100644 --- a/configs/windows/mozconfig +++ b/configs/windows/mozconfig @@ -1,64 +1,67 @@ -if test "$ZEN_CROSS_COMPILING"; then +if test "$ZEN_RELEASE"; then + if test "$ZEN_CROSS_COMPILING"; then - export WINSYSROOT="$(echo ~)/win-cross/vs2022" + export WINSYSROOT="$(echo ~)/win-cross/vs2022" - export WINE="$(echo ~)/win-cross/wine/bin/wine64" - export WINEDEBUG=-all + export WINE="$(echo ~)/win-cross/wine/bin/wine64" + export WINEDEBUG=-all - export MOZ_STUB_INSTALLER=1 - export MOZ_PKG_FORMAT=TAR + export MOZ_STUB_INSTALLER=1 + export MOZ_PKG_FORMAT=TAR - export CROSS_BUILD=1 - CROSS_COMPILE=1 + export CROSS_BUILD=1 + CROSS_COMPILE=1 + + 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 - 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 + #? 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 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" export VERBOSE=1