# f2fs-tools - F2FS filesystem tools
# Generated from manifest.tsv by gen-ports.py. Edit the manifest, not this file,
# unless the package needs something the template cannot express - in which case
# drop a `recipe.local` beside it and it will be preserved.
name=f2fs-tools
version=1.16.0
release=1
desc="F2FS filesystem tools"
url="https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git"
license="GPL-2.0-only"
depend="glibc util-linux-libs"
makedepend=""
source="https://kernel.org/pub/linux/kernel/people/jaegeuk/f2fs-tools/f2fs-tools-1.16.0.tar.gz"
sha256="SKIP"

build() {
	cd "f2fs-tools-1.16.0"
	# Some release tarballs are raw git-tag archives with no generated
	# ./configure at all (only configure.ac/Makefile.am) - a proper "make
	# dist" tarball ships one, a GitHub/GitLab auto-generated source
	# archive does not. Bootstrap it ourselves when that happens.
	[ -x ./configure ] || autoreconf -fi
	# Not every configure script accepts the same options - sqlite rejects
	# --disable-nls outright, for instance - so only pass the ones this one
	# actually advertises. Guessing wrong fails the whole build.
	_opts="--prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib"
	_help=$(./configure --help 2>/dev/null)
	case "$_help" in *--disable-static*)  _opts="$_opts --disable-static" ;; esac
	case "$_help" in *--disable-nls*)     _opts="$_opts --disable-nls" ;; esac
	# bmake is not GNU make - automake's dependency-tracking .deps
	# fragments need nested variable expansion bmake doesn't have.
	case "$_help" in *--disable-dependency-tracking*) _opts="$_opts --disable-dependency-tracking" ;; esac
	# shellcheck disable=SC2086
	./configure $_opts
	gmake -j"$JOBS"
}

package() {
	cd "f2fs-tools-1.16.0"
	gmake DESTDIR="$pkgdir" install
}
