# FIXME: MAKE_AFTER must be set if reusing the routines from autobuild4
export MAKE_AFTER=""

abinfo "Configuring libxcrypt (new API) ..."
build_autotools_configure

abinfo "Building libxcrypt (new API) ..."
build_autotools_build

abinfo "Installing libxcrypt (new API) ..."
build_autotools_install

abinfo "Resetting source tree ..."
rm -rv "$BLDDIR"

abinfo "Configuring libxcrypt (old API) ..."
export AUTOTOOLS_AFTER=(${AUTOTOOLS_AFTER__COMPAT[@]})
build_autotools_configure

abinfo "Building libxcrypt (old API) ..."
build_autotools_build

abinfo "Installing libxcrypt (old API) ..."
# Save PKGDIR first
export SAVED_PKGDIR="$PKGDIR"
export PKGDIR="$SRCDIR"/compat
build_autotools_install

export PKGDIR="$SAVED_PKGDIR"
install -Dvm755 "$SRCDIR"/compat/usr/lib/libcrypt.so.1.1.0 \
    -t "$PKGDIR"/usr/lib/

abinfo "Creating a symlink libxcrypt.so.1 => libxcrypt.so.1 ..."
ln -sv libcrypt.so.1.1.0 \
    "$PKGDIR"/usr/lib/libcrypt.so.1
