mk_add_options AUTOCLOBBER=1
export BUILDING_RELEASE=1
export MC_OFFICIAL=1
export MOZILLA_OFFICIAL=1
export MC_PALEMOON=1
export MOZ_NOSPAM=1

# Official Pale Moon branding. Please see https://www.palemoon.org/redist.shtml
# for restrictions when using the official branding.
ac_add_options --enable-application=palemoon
ac_add_options --enable-official-branding
ac_add_options --enable-official-vendor

# Standard, approved Pale Moon build options.
# Enable stuff
ac_add_options --enable-av1
ac_add_options --enable-optimize="-O2 -w"
ac_add_options --enable-default-toolkit=cairo-gtk2
ac_add_options --enable-devtools
ac_add_options --enable-jemalloc
ac_add_options --enable-jxl
ac_add_options --with-pthreads
ac_add_options --enable-strip

# Disable stuff
ac_add_options --disable-debug
ac_add_options --disable-eme
ac_add_options --disable-gamepad
ac_add_options --disable-necko-wifi
ac_add_options --disable-tests
ac_add_options --disable-updater
ac_add_options --disable-webrtc

# some platform dependent things
# case `dpkg --print-architecture` in
#   arm64)
#     ac_add_options --enable-optimize=-O1
#     ;;
#   armhf)
#     ac_add_options --enable-optimize=-O1
# esac

# Options for creating a system package
ac_add_options --x-libraries=/usr/lib
ac_add_options --prefix=/usr

# Builds use all available cores by default--enable and tune this option to
# reduce CPU use and memory consumption during builds. RAM use seems to be about
# 0.75 GiB per thread. "-jX", where X=number of threads for the build. Example:
# mk_add_options MOZ_MAKE_FLAGS="-j4"

# Allow packager to specify number of build threads in the build command:
PARALLEL_BUILD=$(echo $DEB_BUILD_OPTIONS | sed -e '/parallel=/!s/.*/1/;s/.*parallel=\([0-9]\+\).*/\1/g')
mk_add_options MOZ_MAKE_FLAGS="-j$PARALLEL_BUILD"
