abinfo "Setting environment variables for plugins ..."
export LIBNTFS_3G_CFLAGS="-I${PKGDIR}/usr/include"
export LIBNTFS_3G_LIBS="-pthread -L${PKGDIR}/usr/lib -lntfs-3g"

abinfo "Configuring, building, and installing the system compression plugin ..."
cd "$SRCDIR"/../ntfs-3g-system-compression-1.0
autoreconf -fvi
./configure --prefix=/usr
make
make install DESTDIR="$PKGDIR"

for i in dedup onedrive; do
    abinfo "Configuring, building, and installing the $i plugin ..."
    cd "$SRCDIR"/../$i
    ab_apply_patches "$SRCDIR"/autobuild/patches/*.$i
    autoreconf -fvi
    ./configure --prefix=/usr
    make
    make install DESTDIR="$PKGDIR"
done

abinfo "Creating mount.ntfs symlink to ease mounting ..."
ln -sv ntfs-3g "$PKGDIR"/usr/bin/mount.ntfs
ln -sv ntfs-3g "$PKGDIR"/usr/bin/mount.ntfs-fuse

abinfo "Creating symlink for fsck..."
ln -sv ntfsck "$PKGDIR"/usr/bin/fsck.ntfs

abinfo "Fixing absolute symlinks ..."
rm -rv "$PKGDIR"/sbin
ln -sfv lowntfs-3g "$PKGDIR"/usr/bin/mount.lowntfs-3g
ln -sfv mkntfs "$PKGDIR"/usr/bin/mkfs.ntfs
ln -sfv ntfs-3g "$PKGDIR"/usr/bin/mount.ntfs-3g
