abinfo "Gentoo: Fix word order detection when LTO is enabled..."
export CFLAGS_NODIST="${CFLAGS} -ffat-lto-objects"
export CXXFLAGS_NODIST="${CXXFLAGS} -ffat-lto-objects"
export LDFLAGS_NODIST="${LDFLAGS} -ffat-lto-objects"

abinfo "Setting a set of flags to be used for future PyPI builds ..."
# Note: According to Python 3 documentation...
#
# "[*_NODIST] is used for building the interpreter and stdlib C extensions.
# Use it when a compiler flag should not be part of CFLAGS once Python is
# installed (gh-65320).
#
# In particular, CFLAGS should not contain:
#
# - the compiler flag -I (for setting the search path for include files).
#   The -I flags are processed from left to right, and any flags in CFLAGS
#   would take precedence over user- and package-supplied -I flags.
# - hardening flags such as -Werror because distributions cannot control
#   whether packages installed by users conform to such heightened standards.
#
# Ref: https://docs.python.org/3/using/configure.html#envvar-CFLAGS_NODIST
export CFLAGS="${CFLAGS_COMMON[@]} ${CFLAGS_COMMON_OPTI[@]} ${CFLAGS_COMMON_ARCH[@]}"
export CXXFLAGS="${CXXFLAGS_COMMON[@]} ${CXXFLAGS_COMMON_OPTI[@]} ${CXXFLAGS_COMMON_ARCH[@]}"
export LDFLAGS="${LDFLAGS_COMMON[@]} ${LDFLAGS_COMMON_OPTI[@]} ${LDFLAGS_COMMON_ARCH[@]}"

abinfo "Arch Linux: Ensure that we are using system libraries..."
rm -rv "$SRCDIR"/Modules/expat
rm -rv "$SRCDIR"/Modules/_decimal/libmpdec

if ab_match_arch ppc64el; then
    abinfo "Disabling x86 intrinsics to fix build on ppc64el ..."
    export CPPFLAGS="${CPPFLAGS/-DNO_WARN_X86_INTRINSICS/}"
fi
