Refactor macOS and Windows mozconfig for improved cross-compilation settings and optimization options

This commit is contained in:
mr. M
2024-11-24 14:25:17 +01:00
parent f24adec51f
commit 50c95b4291
2 changed files with 80 additions and 84 deletions

View File

@@ -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

View File

@@ -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"