# Contributor: Marco Martinelli <marco+t2sz@13byte.com>
# Maintainer: Marco Martinelli <marco+t2sz@13byte.com>
pkgname=t2sz
pkgver=1.1.2
pkgrel=0
pkgdesc="t2sz compress a file into a seekable zstd with special handling for tar archives."
url="https://github.com/martinellimarco/t2sz"
arch="all"
license="GPL-3.0-or-later"
makedepends="cmake samurai zstd-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/martinellimarco/t2sz/archive/refs/tags/v$pkgver.tar.gz"
options="!check"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi

	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		$CMAKE_CROSSOPTS .

	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
8bc388042e4f41bc87499b69ee5cc7519701269e6c6bf22c0aab9e11472b65a71fc782582fc3060de3ce8e81bf87e5184051e915ae7d10bd604c68773cdb229e  t2sz-1.1.2.tar.gz
"
