diff --git a/app-arch/zstd/patches/zstd-1.5.0-gcc2.patchset b/app-arch/zstd/patches/zstd-1.5.0-gcc2.patchset new file mode 100644 index 000000000..9ab50b166 --- /dev/null +++ b/app-arch/zstd/patches/zstd-1.5.0-gcc2.patchset @@ -0,0 +1,48 @@ +From f7a4d711282e01c88e2da068d7d64974359490e5 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Wed, 29 Sep 2021 17:14:40 -0400 +Subject: [PATCH] Various GCC2 fixes. + +--- + lib/common/compiler.h | 4 ++-- + lib/compress/zstd_lazy.c | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/lib/common/compiler.h b/lib/common/compiler.h +index a951d0a..a02ce59 100644 +--- a/lib/common/compiler.h ++++ b/lib/common/compiler.h +@@ -151,7 +151,7 @@ + + /* vectorization + * older GCC (pre gcc-4.3 picked as the cutoff) uses a different syntax */ +-#if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) ++#if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 3) + # if (__GNUC__ == 4 && __GNUC_MINOR__ > 3) || (__GNUC__ >= 5) + # define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize"))) + # else +@@ -166,7 +166,7 @@ + * If you can remove a LIKELY/UNLIKELY annotation without speed changes in gcc + * and clang, please do. + */ +-#if defined(__GNUC__) ++#if defined(__GNUC__) && (__GNUC__ >= 3) + #define LIKELY(x) (__builtin_expect((x), 1)) + #define UNLIKELY(x) (__builtin_expect((x), 0)) + #else +diff --git a/lib/compress/zstd_lazy.c b/lib/compress/zstd_lazy.c +index 3d523e8..9e13f37 100644 +--- a/lib/compress/zstd_lazy.c ++++ b/lib/compress/zstd_lazy.c +@@ -1081,7 +1081,7 @@ static U32 ZSTD_VecMask_next(ZSTD_VecMask val) { + 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, + 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 + }; +- return multiplyDeBruijnBitPosition[((U32)((v & -(int)v) * 0x077CB531U)) >> 27]; ++ return multiplyDeBruijnBitPosition[((U32)((val & -(int)val) * 0x077CB531U)) >> 27]; + # endif + } + +-- +2.28.0 + diff --git a/app-arch/zstd/zstd-1.5.0.recipe b/app-arch/zstd/zstd-1.5.0.recipe new file mode 100644 index 000000000..07157c681 --- /dev/null +++ b/app-arch/zstd/zstd-1.5.0.recipe @@ -0,0 +1,142 @@ +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-2018 Facebook, Inc." +LICENSE="BSD (2-clause) + GNU GPL v2" +REVISION="1" +SOURCE_URI="https://github.com/facebook/zstd/archive/v$portVersion.tar.gz" +SOURCE_FILENAME="zstd-$portVersion.tar.gz" +CHECKSUM_SHA256="0d9ade222c64e912d6957b11c923e214e2e010a18f39bec102f572e693ba2867" +if [ "$effectiveTargetArchitecture" = x86_gcc2 ]; then +PATCHES="$PATCHES + zstd-$portVersion-gcc2.patchset + " +fi + +ARCHITECTURES="all" +SECONDARY_ARCHITECTURES="x86_gcc2 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 + " + +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 + " + +BUILD() +{ + cd build/cmake + cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON $cmakeDirArgs + make +} + +INSTALL() +{ + cd build/cmake + make install + + prepareInstalledDevelLib libzstd + fixPkgconfig + fixCMake + + packageEntries bin \ + $commandBinDir \ + $manDir/man1 + + packageEntries devel \ + $developDir + + rmdir $manDir + + install -d $docDir + install -t $docDir -m 444 ../../LICENSE +} + +TEST() +{ + cd build/cmake + make test +}