### this file is sourced not run
PKGVER=2022.10.3
PKGBUILD=1
PKGARCH=x86_64

# BLFS 7.5 updated to latest
TARBALL=ntfs-3g_ntfsprogs-$PKGVER.tgz
MD5SUM=a038af61be7584b79f8922ff11244090
SRC_URL=https://tuxera.com/opensource/$TARBALL
#SRC_URL=https://jp-andre.pagesperso-orange.fr/$TARBALL # dead
BUNDLE=

SLACKREQ= # musl-gcc and upx - build-time only
SLACKDESC="ntfs-3g-static: ntfs-3g-static $PKGVER (NTFS filesystem driver)
ntfs-3g-static: 
ntfs-3g-static: This is NTFS-3G compiled statically using musl. It is meant for use 
ntfs-3g-static: in initrd. Binaries are upx-ed. Note: no crypto support.
ntfs-3g-static: 
ntfs-3g-static: https://www.tuxera.com/company/open-source/
ntfs-3g-static: 
ntfs-3g-static: 
ntfs-3g-static: 
ntfs-3g-static: 
ntfs-3g-static:
"
SLACKCON="ntfs-3g"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&

	# these are patches up to 2024.05
	cd tmp/ntfs-3g* &&
	for p in ../pkg/upstream/*; do
		patch -Np1 -i $p || return 1
	done
}

### default pkg_package
### build
pkg_build() {
	CONFFLAGS="$CONFFLAGS --disable-library --disable-mtab \
		--enable-xattr-mappings --enable-posix-acls \
		--enable-extras"

	export CC="musl-gcc -I/usr/musl/kernel/include"
	
	cd /tmp/ntfs-3g* &&
	./autogen.sh &&	
	pkg_build_autoconf &&
	pkg_build_slackdesc &&

	# now compress them
	upx -9 /bin/*ntfs-3g /usr/bin/ntfs* /usr/sbin/{ntfs*,mkntfs} &&

	rm -rf /etc/ld.so.cache /var/cache/ldconfig/aux-cache
}
