PORTNAME=	c-blosc2
PORTVERSION=	2.23.0
DISTVERSIONPREFIX=	v
CATEGORIES=	archivers

MAINTAINER=	sunpoet@FreeBSD.org
COMMENT=	High performance compressor optimized for binary data
WWW=		https://www.blosc.org/ \
		https://github.com/Blosc/c-blosc2

LICENSE=	BSD3CLAUSE
LICENSE_FILE=	${WRKSRC}/LICENSE.txt

LIB_DEPENDS=	liblz4.so:archivers/liblz4 \
		libzstd.so:archivers/zstd

USES=		cmake:testing

CMAKE_OFF=	BUILD_LITE \
		DEACTIVATE_AVX2 \
		DEACTIVATE_ZLIB \
		DEACTIVATE_ZSTD \
		TEST_INCLUDE_BENCH_BITSHUFFLE_1 \
		TEST_INCLUDE_BENCH_BITSHUFFLE_N \
		TEST_INCLUDE_BENCH_DEBUGSUITE \
		TEST_INCLUDE_BENCH_DELTA \
		TEST_INCLUDE_BENCH_SHUFFLE_1 \
		TEST_INCLUDE_BENCH_SHUFFLE_N \
		TEST_INCLUDE_BENCH_SUITE \
		TEST_INCLUDE_BENCH_SUM_OPENMP \
		TEST_INCLUDE_BENCH_TRUNC_PREC \
		TEST_INCLUDE_BENCH_ZERO_RUNLEN \
		TEST_INCLUDE_COMPAT \
		TEST_INCLUDE_EXAMPLES
CMAKE_ON=	BUILD_BENCHMARKS \
		BUILD_EXAMPLES \
		BUILD_FUZZERS \
		BUILD_PLUGINS \
		BUILD_SHARED \
		BUILD_STATIC \
		BUILD_TESTS \
		DEACTIVATE_IPP \
		PREFER_EXTERNAL_LZ4 \
		PREFER_EXTERNAL_ZLIB \
		PREFER_EXTERNAL_ZSTD
# Skip TEST_INCLUDE_BENCH_DEBUGSUITE because it hangs during test
CMAKE_TESTING_ON=	\
		TEST_INCLUDE_BENCH_BITSHUFFLE_1 \
		TEST_INCLUDE_BENCH_BITSHUFFLE_N \
		TEST_INCLUDE_BENCH_DELTA \
		TEST_INCLUDE_BENCH_SHUFFLE_1 \
		TEST_INCLUDE_BENCH_SHUFFLE_N \
		TEST_INCLUDE_BENCH_SUITE \
		TEST_INCLUDE_BENCH_SUM_OPENMP \
		TEST_INCLUDE_BENCH_TRUNC_PREC \
		TEST_INCLUDE_BENCH_ZERO_RUNLEN \
		TEST_INCLUDE_COMPAT \
		TEST_INCLUDE_EXAMPLES
USE_LDCONFIG=	yes

PLIST_SUB=	PORTVERSION=${PORTVERSION}

GH_ACCOUNT=	Blosc
USE_GITHUB=	yes

post-patch:
# Clean up bundled libraries
	@${RM} -r ${WRKSRC}/internal-complibs/

.include <bsd.port.mk>
