if ab_match_archgroup retro ; then
    # NOTE:
    # Afterglow probably does not need Python bindings.
    # We can enable them back later.
    # Linux From Scratch: Keep minimal set of static libraries.
    _INSTALLARGS=(
        "variant=release"
        "debug-symbols=on"
        "threading=multi"
        "runtime-link=static"
        "link=static"
        "toolset=gcc"
        "cflags=${CPPFLAGS} ${CFLAGS}"
        "cxxflags=${CPPFLAGS} ${CXXFLAGS}"
        "linkflags=${LDFLAGS}"
    )
    _BOOTSTRAPARGS=(
        '--with-toolset=gcc'
        '--with-icu'
        '--with-libraries=all'
        '--without-libraries=python'
    )
else
    _INSTALLARGS=(
        "variant=release"
        "debug-symbols=on"
        "threading=multi"
        "runtime-link=shared"
        "link=shared,static"
        "toolset=gcc"
        "python=$ABPY3VER"
        "cflags=${CPPFLAGS} ${CFLAGS}"
        "cxxflags=${CPPFLAGS} ${CXXFLAGS}"
        "linkflags=${LDFLAGS}"
    )
    _BOOTSTRAPARGS=(
        '--with-toolset=gcc'
        '--with-icu'
        '--with-python=/usr/bin/python3'
        '--with-libraries=all'
    )
fi

abinfo 'Arch Linux: Setting $_stagedir as $SRCDIR/stagedir ...'
export _stagedir="$SRCDIR/stagedir"

abinfo 'Setting thread count for build-time parallelism from $JOBS ...'
export JOBS="-j $ABTHREADS"

abinfo "Bootstrapping build configurations (headers, runtime libraries, Python 3 bindings) ..."
"$SRCDIR"/bootstrap.sh \
    "${_BOOTSTRAPARGS[@]}"

abinfo "Setting build targets for each supported architecture ..."
case "${CROSS:-$ARCH}" in
	amd64|x86_64)
		export _bindir="bin.linuxx86_64" ;;
	armv4|armv6hfp|armv7hf|arm64)
		export _bindir="bin.linuxarm" ;;
	mips64el|mipsel|mipsn32el|loongson3)
		export _bindir="bin.linuxmips" ;;
        powerpc|ppc64|ppc64el)
		export _bindir="bin.linuxppc" ;;
esac

abinfo "Copying documentation generators to staging directory ..."
install -dvm755 "${_stagedir}"/share/boostbook
cp -av "$SRCDIR"/tools/boostbook/{xsl,dtd} \
    "${_stagedir}"/share/boostbook/

abinfo "Building full-featured B2 ..."
pushd "$SRCDIR"/tools/build/
rm -v src/engine/b2
"$SRCDIR"/b2 \
    variant=release \
    debug-symbols=on \
    cflags="${CPPFLAGS} ${CFLAGS}" \
    cxxflags="${CPPFLAGS} ${CXXFLAGS}" \
    linkflags="${LDFLAGS}" \
    --layout=system \
    --prefix="${_stagedir}" \
    ${JOBS} -d+2 \
    b2
find .build/ -type f -executable -exec 'install' '-Dvm755' '{}' 'src/engine/' ';'
"$SRCDIR"/b2 -d+2 --prefix="${_stagedir}" install
popd

abinfo "Building Boost (Python 3 bindings) ..."
"${SRCDIR}"/tools/build/src/engine/b2 \
    "${_INSTALLFLAGS[@]}" \
    --layout=system \
    --prefix="${_stagedir}" \
    --user-config="$SRCDIR"/autobuild/user-config.jam \
    ${JOBS} -d+2 \
    install

abinfo "Installing Boost ..."
install -Dvm755 "$SRCDIR"/tools/build/src/engine/b2 \
    "$PKGDIR"/usr/bin/b2
install -dvm755 "$PKGDIR"/usr/lib
cp -av "${_stagedir}"/{include,lib,share} \
    "$PKGDIR"/usr

abinfo "Creating a symlink for bjam => b2 ..."
ln -sv b2 \
    "$PKGDIR"/usr/bin/bjam
