SUMMARY="An efficient compressor with very fast decompression"
DESCRIPTION="Lizard is a lossless compression algorithm which contains 4 \
compression methods:
fastLZ4 : compression levels -10...-19 are designed to give better \
decompression speed than LZ4 i.e. over 2000 MB/s
LIZv1 : compression levels -20...-29 are designed to give better ratio than \
LZ4 keeping 75% decompression speed
fastLZ4 + Huffman : compression levels -30...-39 add Huffman coding to fastLZ4
LIZv1 + Huffman : compression levels -40...-49 give the best ratio (comparable\
 to zlib and low levels of zstd/brotli) at decompression speed of 1000 MB/s."
HOMEPAGE="https://github.com/inikep/lizard/"
COPYRIGHT="2011-2017, Yann Collet
	2015-2017, Przemyslaw Skibinski"
LICENSE="BSD (2-clause)"
REVISION="3"
SOURCE_URI="$HOMEPAGE/archive/v$portVersion.tar.gz"
SOURCE_FILENAME="lizard-$portVersion.tar.gz"
CHECKSUM_SHA256="6f666ed699fc15dc7fdaabfaa55787b40ac251681b50c0d8df017c671a9457e6"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	lizard${secondaryArchSuffix} = $portVersion
	lib:liblizard${secondaryArchSuffix} = 1.0.0 compat >= 1
	"
if [ -z "$secondaryArchSuffix" ]; then
PROVIDES="$PROVIDES
	cmd:lizard = $portVersion
	cmd:lizardcat = $portVersion
	cmd:unlizard = $portVersion
	"
fi

REQUIRES="
	haiku$secondaryArchSuffix
	"
REPLACES="
	lz5$secondaryArchSuffix
	"

PROVIDES_devel="
	lizard${secondaryArchSuffix}_devel = $portVersion
	devel:liblizard$secondaryArchSuffix = 1.0.0 compat >= 1
	"
REQUIRES_devel="
	lizard$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:diff
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	make $jobArgs all PREFIX=$prefix
}

INSTALL()
{
	mkdir -p $includeDir $binDir $manDir/man1

	make install PREFIX=$prefix

	mv $prefix/include/* $includeDir
	rm -rf $prefix/include

	mv $prefix/share/man/man1/* $manDir/man1
	rm -rf $prefix/share

	mv $prefix/lib $prefix/lib2
	mkdir $(dirname $libDir)
	mv $prefix/lib2 $libDir

	[ -n "$secondaryArchSuffix" ] && rm -rf $prefix/bin $manDir

	prepareInstalledDevelLib liblizard
	fixPkgconfig

	packageEntries devel \
		$developDir
}

TEST()
{
	make test
}
