# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=ntfs-3g
_pkgreal=ntfs-3g_ntfsprogs
pkgver=2017.3.23
pkgrel=1
pkgdesc="Stable, full-featured, read-write NTFS"
url="http://www.tuxera.com/community/ntfs-3g-download/"
arch="all"
license="GPL"
makedepends="attr-dev util-linux-dev linux-headers"
subpackages="$pkgname-doc $pkgname-dev $pkgname-libs $pkgname-progs"
source="http://tuxera.com/opensource/$_pkgreal-$pkgver.tgz"
builddir="$srcdir/$_pkgreal-$pkgver"

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info
	make
}

package() {
	pkgdesc="$pkgdesc (driver)"

	cd "$builddir"
	mkdir -p "$pkgdir"/lib
	make -j1 DESTDIR="$pkgdir" LDCONFIG=: install
	ln -s /bin/ntfs-3g "$pkgdir"/sbin/mount.ntfs
}

progs() {
	pkgdesc="$pkgdesc (utilities)"

	mkdir -p "$subpkgdir"/sbin
	mv "$pkgdir"/usr "$pkgdir"/lib "$subpkgdir"/
	mv "$pkgdir"/sbin/mkfs.ntfs "$subpkgdir"/sbin
	rm -fr "$subpkgdir"/lib "$subpkgdir"/usr/lib
}

sha512sums="3a607f0d7be35204c992d8931de0404fbc52032c13b4240d2c5e6f285c318a28eb2a385d7cf5ac4cd445876aee5baa5753bb636ada0d870d84a9d3fdbce794ef  ntfs-3g_ntfsprogs-2017.3.23.tgz"
