SUMMARY="A stateless, zlib-compatible, and very fast compression library"
DESCRIPTION="SLZ is a fast and memory-less stream compressor which produces an \
output that can be decompressed with zlib or gzip. It does not implement \
decompression at all, zlib is perfectly fine for this.

The purpose is to use SLZ in situations where a zlib-compatible stream is \
needed and zlib's resource usage would be too high while the compression ratio \
is not critical. The typical use case is in HTTP servers and gateways which \
have to compress many streams in parallel with little CPU resources to assign \
to this task, and without having to thottle the compression ratio due to the \
memory usage. In such an environment, the server's memory usage can easily be \
divided by 10 and the CPU usage by 3. In addition its high performance made it \
fill a gap in network backup applications."
HOMEPAGE="http://www.libslz.org/"
COPYRIGHT="2013-2015 Willy Tarreau"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="http://git.1wt.eu/web?p=libslz.git;a=snapshot;h=v$portVersion;sf=tbz2"
CHECKSUM_SHA256="cf6b2c00066890d3c7f40ef00e6620784b9dc4662e9a3b35f2059997037be728"
SOURCE_FILENAME="libslz-$portVersion.tar.bz2"
SOURCE_DIR="libslz"
PATCHES="libslz-$portVersion.patchset"

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

libVersion="${portVersion%%.*}"

PROVIDES="
	libslz$secondaryArchSuffix = $portVersion
	cmd:zdec$secondaryArchSuffix = $portVersion
	cmd:zenc$secondaryArchSuffix = $portVersion
	lib:libslz$secondaryArchSuffix = $libVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	libslz${secondaryArchSuffix}_devel = $portVersion
	devel:libslz$secondaryArchSuffix = $libVersion
	"
REQUIRES_devel="
	libslz$secondaryArchSuffix == $portVersion base
	"

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

defineDebugInfoPackage libslz$secondaryArchSuffix \
	"$binDir"/z{dec,enc} \
	"$libDir/libslz.so.$libVersion"

BUILD()
{
	make $jobArgs
}

INSTALL()
{
	install -d -m 755 "$binDir" "$libDir" "$includeDir"

	# header
	install -t "$includeDir" -m 644 src/slz.h
	# lib
	install -t "$libDir" -m 755 libslz.so.$libVersion
	ln -s libslz.so.$libVersion "$libDir/libslz.so"
	install -t "$libDir" -m 644 libslz.a
	# bins
	install -t "$binDir" -m 755 zdec zenc

	prepareInstalledDevelLib libslz
	packageEntries devel "$developDir"
}
