Files
haikuports/app-arch/zstd/zstd-1.5.6.recipe

161 lines
4.0 KiB
Bash

SUMMARY="Zstandard, a fast real-time compression algorithm"
SUMMARY_bin="Command line tools to compress/decompress .zst files"
DESCRIPTION="Zstd, short for Zstandard, is a fast lossless compression \
algorithm, targeting real-time compression scenarios at zlib-level and better \
compression ratios. The zstd compression library provides in-memory \
compression and decompression functions. It offers a very wide range of \
compression / speed trade-off, while being backed by a very fast decoder. It \
also offers a special mode for small data, called dictionary compression, and \
can create dictionaries from any sample set."
HOMEPAGE="https://facebook.github.io/zstd/"
COPYRIGHT="2016-2024 Facebook, Inc.
Meta Platforms, Inc. and affiliates"
LICENSE="BSD (2-clause)
GNU GPL v2"
REVISION="1"
SOURCE_URI="https://github.com/facebook/zstd/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="30f35f71c1203369dc979ecde0400ffea93c27391bfd2ac5a9715d2173d92ff7"
SOURCE_FILENAME="zstd-v$portVersion.tar.gz"
PATCHES="zstd-$portVersion.patchset"
if [ "$effectiveTargetArchitecture" = x86_gcc2 ]; then
PATCHES="$PATCHES
zstd-$portVersion-gcc2.patchset
"
fi
ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"
commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ -n "$secondaryArchSuffix" ]; then
# Comment out this block if you wish to co-install zstd_bin & e.g. zstd_x86_bin.
commandSuffix=
commandBinDir=$prefix/bin
fi
libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
PROVIDES="
zstd$secondaryArchSuffix = $portVersion
lib:libzstd$secondaryArchSuffix = $libVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
"
SUMMARY_bin="Command line tools to compress/decompress .zst files"
PROVIDES_bin="
zstd${secondaryArchSuffix}_bin = $portVersion
cmd:unzstd$commandSuffix = $portVersion
cmd:zstd$commandSuffix = $portVersion
cmd:zstdcat$commandSuffix = $portVersion
cmd:zstdgrep$commandSuffix = $portVersion
cmd:zstdless$commandSuffix = $portVersion
cmd:zstdmt$commandSuffix = $portVersion
"
if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then
PROVIDES_bin="$PROVIDES_bin
cmd:pzstd$commandSuffix = $portVersion
"
fi
REQUIRES_bin="
haiku$secondaryArchSuffix
zstd$secondaryArchSuffix == $portVersion base
cmd:grep
cmd:less
lib:liblz4$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then
REQUIRES_bin="$REQUIRES_bin
lib:liblzma$secondaryArchSuffix
"
fi
if [ -n "$secondaryArchSuffix" -a "$commandBinDir" = "$prefix"/bin ]; then
CONFLICTS_bin="
zstd_bin
"
fi
PROVIDES_devel="
zstd${secondaryArchSuffix}_devel = $portVersion
devel:libzstd$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
zstd$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:liblz4$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then
BUILD_REQUIRES="$BUILD_REQUIRES
devel:liblzma$secondaryArchSuffix
"
fi
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:cmake
cmd:make
cmd:sed
cmd:find
"
TEST_REQUIRES="
cmd:python3
"
PATCH()
{
# avoid error on tests without static libs, we use LD_LIBRARY_PATH
sed '/build static library to build tests/d' -i build/cmake/CMakeLists.txt
sed 's/libzstd_static/libzstd_shared/g' -i build/cmake/tests/CMakeLists.txt
}
BUILD()
{
cmake -B bld -S build/cmake -DCMAKE_BUILD_TYPE=Release \
$cmakeDirArgs \
-DCMAKE_INSTALL_BINDIR=$commandBinDir \
-DZSTD_BUILD_STATIC=OFF \
-DZSTD_BUILD_TESTS=ON \
-DZSTD_PROGRAMS_LINK_SHARED=ON
make -C bld $jobArgs
}
INSTALL()
{
make -C bld install
mkdir -p $docDir
cp doc/zstd_manual.html $docDir
prepareInstalledDevelLib libzstd
fixPkgconfig
fixCMake
sed "s|$libDir|$developLibDir|g" \
-i $developLibDir/cmake/zstd/zstdTargets-release.cmake
packageEntries bin \
$commandBinDir \
$manDir/man1
packageEntries devel \
$developDir \
$docDir/zstd_manual.html
rmdir $manDir
install -t $docDir -m 444 LICENSE
}
TEST()
{
make -C bld test
}