# FIXME:
# Applying LoongArch support patch causes:
# error: Source/GmmLib/CMakeLists.txt: does not match index
# error: Source/GmmLib/Linux.cmake: does not match index
# error: Source/GmmLib/Utility/CpuSwizzleBlt/CpuSwizzleBlt.c: does not match index
#
# Apply patches manully 
abinfo "Applying patches ..."
git config --local user.name "AOSC Maintainers"
git config --local user.email "maintainers@aosc.io"
git am "$SRCDIR"/autobuild/patches/*.am

if ab_match_arch loongarch64; then
    abinfo "Applying LoongArch support patch ..."
    git am "$SRCDIR"/autobuild/patches/*.am.loongarch64
    git submodule update --init --recursive

elif ab_match_arch arm64; then
    # FIXME: 
    # cc1plus: error：‘-Wformat-security’ ignored without ‘-Wformat’
    export CFLAGS="${CFLAGS} -Wformat"
    export CXXFLAGS="${CXXFLAGS} -Wformat"
fi
