# Sets:
#    MOZ_AUTOMATION flags
#    SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE - shouldn't be used?
#    TOOLTOOL_DIR
#    MAKECAB - shouldn't be used?
. "$topsrcdir/build/mozconfig.win-common"

# MinGW does not have (or need) makecab
unset MAKECAB

# Sets:
#  build/mozconfig.common
#    AUTOCLOBBER=1
#    --enable-crashreporter
#    --enable-release
#    LLVM_CONFIG
#    MOZ_ADDON_SIGNING
#    MOZ_REQUIRE_SIGNING
#    --enable-js-shell
#  build/mozconfig.automation
#    MOZ_AUTOMATION_ flags
#  build/mozconfig.rust
#    TOOLTOOL_DIR
#    RUSTC
#    CARGO
. "$topsrcdir/browser/config/mozconfigs/common"

# MinGW Stuff
ac_add_options --target=x86_64-w64-mingw32
ac_add_options --with-toolchain-prefix=x86_64-w64-mingw32-

# GCC compiling for Windows exposes a lot of warnings. We are tracking them in Bug 1394433
ac_add_options --disable-warnings-as-errors

# Temporary config settings until we get these working on mingw
ac_add_options --disable-accessibility # https://sourceforge.net/p/mingw-w64/bugs/648/

# Long story
ac_add_options --disable-stylo # Bug 1390583
ac_add_options --disable-jemalloc # Bug 1466192

# These aren't supported on mingw at this time
ac_add_options --disable-webrtc # Bug 1393901
ac_add_options --disable-maintenance-service

# Find our toolchain
CC="$TOOLTOOL_DIR/mingw32/bin/x86_64-w64-mingw32-gcc"
CXX="$TOOLTOOL_DIR/mingw32/bin/x86_64-w64-mingw32-g++"

# We want to make sure we use binutils and other binaries in the tooltool
# package.
mk_add_options "export PATH=$TOOLTOOL_DIR/mingw32/bin:$TOOLTOOL_DIR/wine/bin:$TOOLTOOL_DIR/upx/bin:$TOOLTOOL_DIR/fxc2/bin:$PATH"

LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$TOOLTOOL_DIR/mingw32/lib64
mk_add_options "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH"

# Do not include the visual studio related mozconfigs of course

ac_add_options --with-branding=browser/branding/nightly

. "$topsrcdir/build/mozconfig.common.override"
. "$topsrcdir/build/mozconfig.cache"
