mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-05-05 12:26:52 +02:00
main/snappy: upgrade to 1.1.9
- using patch for inlining https://github.com/google/snappy/pull/128 - tests and benchmark are third-party, using additional sources and unittests
This commit is contained in:
parent
2845669c54
commit
a5cf1519d8
@ -1,8 +1,9 @@
|
||||
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
|
||||
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
|
||||
pkgname=snappy
|
||||
pkgver=1.1.8
|
||||
pkgrel=2
|
||||
pkgver=1.1.9
|
||||
pkgrel=0
|
||||
_googletest_commit=18f8200e3079b0e54fa00cb7ac55d4c39dcf6da6
|
||||
pkgdesc="Fast compression and decompression library"
|
||||
url="https://google.github.io/snappy/"
|
||||
arch="all"
|
||||
@ -10,15 +11,22 @@ license="BSD-3-Clause"
|
||||
makedepends="cmake"
|
||||
subpackages="$pkgname-dbg $pkgname-static $pkgname-dev $pkgname-doc"
|
||||
source="$pkgname-$pkgver.tar.gz::https://github.com/google/snappy/archive/$pkgver.tar.gz
|
||||
optimize-mips-s390x.patch
|
||||
googletest-$_googletest_commit.tar.gz::https://github.com/google/googletest/archive/$_googletest_commit.tar.gz
|
||||
cmakelists.patch
|
||||
fix-inline.patch
|
||||
"
|
||||
|
||||
prepare() {
|
||||
rmdir third_party/googletest
|
||||
ln -s "$srcdir"/googletest-$_googletest_commit third_party/googletest
|
||||
default_prepare
|
||||
}
|
||||
|
||||
build() {
|
||||
if [ "$CBUILD" != "$CHOST" ]; then
|
||||
CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
|
||||
fi
|
||||
cmake \
|
||||
cmake -B build \
|
||||
-DCMAKE_BUILD_TYPE=None \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DCMAKE_INSTALL_LIBDIR=/usr/lib \
|
||||
@ -26,16 +34,27 @@ build() {
|
||||
-DBUILD_STATIC_LIBS=ON \
|
||||
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
|
||||
-DCMAKE_C_FLAGS="$CFLAGS" \
|
||||
${CMAKE_CROSSOPTS} .
|
||||
cmake --build .
|
||||
-DSNAPPY_BUILD_BENCHMARKS=OFF \
|
||||
-DSNAPPY_BUILD_TESTS=ON \
|
||||
$CMAKE_CROSSOPTS
|
||||
cmake --build build
|
||||
}
|
||||
|
||||
check() {
|
||||
ctest --verbose
|
||||
cd build && ctest --verbose
|
||||
}
|
||||
|
||||
package() {
|
||||
make DESTDIR="$pkgdir" install
|
||||
DESTDIR="$pkgdir" cmake --install build
|
||||
|
||||
# clean-up
|
||||
rm -r \
|
||||
"$pkgdir"/usr/include/gmock \
|
||||
"$pkgdir"/usr/include/gtest \
|
||||
"$pkgdir"/usr/lib/libgmock* \
|
||||
"$pkgdir"/usr/lib/libgtest* \
|
||||
"$pkgdir"/usr/lib/cmake/GTest \
|
||||
"$pkgdir"/usr/lib/pkgconfig
|
||||
|
||||
local file; for file in AUTHORS CONTRIBUTING.md COPYING NEWS README.md \
|
||||
format_description.txt framing_format.txt; do
|
||||
@ -43,6 +62,9 @@ package() {
|
||||
done
|
||||
}
|
||||
|
||||
sha512sums="efe18ff1b3edda1b4b6cefcbc6da8119c05d63afdbf7a784f3490353c74dced76baed7b5f1aa34b99899729192b9d657c33c76de4b507a51553fa8001ae75c1c snappy-1.1.8.tar.gz
|
||||
a14b0159631beac628cf99cf9ad970631dfdbf607ca2c3911a64124d1133694689dc76a70f25d4f780ce7093584249905aec2926ef7a3d9350952f7648938392 optimize-mips-s390x.patch
|
||||
6a379a1bd026282d98d5f2ffd316e126d5383b7c32852f81102c7a2aa0754e0c5567f82766dbd72b62552ef8a9569795c5f667387d3f1b2c9ef2bfffc578de18 cmakelists.patch"
|
||||
sha512sums="
|
||||
f1f8a90f5f7f23310423574b1d8c9acb84c66ea620f3999d1060395205e5760883476837aba02f0aa913af60819e34c625d8308c18a5d7a9c4e190f35968b024 snappy-1.1.9.tar.gz
|
||||
f77c747218dc5ae4858b2b4c58a401eb895493adf470a331d6bac32cd20542533ff3a77081db653bbc18b9f55f6864be04e1739ef4afaed7db39d7c698abf880 googletest-18f8200e3079b0e54fa00cb7ac55d4c39dcf6da6.tar.gz
|
||||
8a891edf2f0b267b05c67d54945f11d723b058ddab5ac3f27b4f00678759d4a52b617d0c5724c7170a285eb068ffa4ffbbc5a9efa250964979b3969fc8730eb3 cmakelists.patch
|
||||
47aca85575dc53ed9cee127285e0545200d22c789a2bd8f03bb9a8cd93168b1b9b990c092d0b340122f800d2e4eafd0b718f04d09bc16ff4fe08cebb98daf741 fix-inline.patch
|
||||
"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -41,6 +41,8 @@
|
||||
@@ -86,6 +86,8 @@
|
||||
# it prominent in the GUI.
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries(DLLs)." OFF)
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
+
|
||||
option(SNAPPY_BUILD_TESTS "Build Snappy's own tests." ON)
|
||||
|
||||
option(SNAPPY_FUZZING_BUILD "Build Snappy for fuzzing." OFF)
|
||||
@@ -51,6 +53,10 @@
|
||||
option(SNAPPY_BUILD_BENCHMARKS "Build Snappy's benchmarks" ON)
|
||||
@@ -98,6 +100,10 @@
|
||||
|
||||
option(SNAPPY_INSTALL "Install Snappy's header and library" ON)
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
include(TestBigEndian)
|
||||
test_big_endian(SNAPPY_IS_BIG_ENDIAN)
|
||||
|
||||
@@ -166,19 +172,28 @@
|
||||
@@ -213,19 +219,28 @@
|
||||
"snappy-stubs-public.h.in"
|
||||
"${PROJECT_BINARY_DIR}/snappy-stubs-public.h")
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy-c.h>
|
||||
$<INSTALL_INTERFACE:include/snappy-c.h>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy-sinksource.h>
|
||||
@@ -186,18 +201,32 @@
|
||||
@@ -233,18 +248,32 @@
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy.h>
|
||||
$<INSTALL_INTERFACE:include/snappy.h>
|
||||
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/snappy-stubs-public.h>
|
||||
|
||||
13
main/snappy/fix-inline.patch
Normal file
13
main/snappy/fix-inline.patch
Normal file
@ -0,0 +1,13 @@
|
||||
Patch-Source: https://github.com/google/snappy/pull/128
|
||||
|
||||
--- a/snappy.cc
|
||||
+++ b/snappy.cc
|
||||
@@ -1014,7 +1014,7 @@
|
||||
}
|
||||
|
||||
SNAPPY_ATTRIBUTE_ALWAYS_INLINE
|
||||
-size_t AdvanceToNextTag(const uint8_t** ip_p, size_t* tag) {
|
||||
+inline size_t AdvanceToNextTag(const uint8_t** ip_p, size_t* tag) {
|
||||
const uint8_t*& ip = *ip_p;
|
||||
// This section is crucial for the throughput of the decompression loop.
|
||||
// The latency of an iteration is fundamentally constrained by the
|
||||
@ -1,80 +0,0 @@
|
||||
diff --git a/snappy-stubs-internal.h b/snappy-stubs-internal.h
|
||||
index f834bdb..22407ef 100644
|
||||
--- a/snappy-stubs-internal.h
|
||||
+++ b/snappy-stubs-internal.h
|
||||
@@ -123,7 +123,7 @@ static const int64 kint64max = static_cast<int64>(0x7FFFFFFFFFFFFFFFLL);
|
||||
// x86, PowerPC, and ARM64 can simply do these loads and stores native.
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || \
|
||||
- defined(__aarch64__)
|
||||
+ defined(__aarch64__) || defined(__s390x__)
|
||||
|
||||
#define UNALIGNED_LOAD16(_p) (*reinterpret_cast<const uint16 *>(_p))
|
||||
#define UNALIGNED_LOAD32(_p) (*reinterpret_cast<const uint32 *>(_p))
|
||||
@@ -150,6 +150,8 @@ static const int64 kint64max = static_cast<int64>(0x7FFFFFFFFFFFFFFFLL);
|
||||
// (it ignores __attribute__((packed)) on individual variables). However,
|
||||
// we can tell it that a _struct_ is unaligned, which has the same effect,
|
||||
// so we do that.
|
||||
+//
|
||||
+// On pre-R6 MIPS just let the compiler use LWL/LWR, SWL/SWR etc.
|
||||
|
||||
#elif defined(__arm__) && \
|
||||
!defined(__ARM_ARCH_4__) && \
|
||||
@@ -163,7 +165,8 @@ static const int64 kint64max = static_cast<int64>(0x7FFFFFFFFFFFFFFFLL);
|
||||
!defined(__ARM_ARCH_6K__) && \
|
||||
!defined(__ARM_ARCH_6Z__) && \
|
||||
!defined(__ARM_ARCH_6ZK__) && \
|
||||
- !defined(__ARM_ARCH_6T2__)
|
||||
+ !defined(__ARM_ARCH_6T2__) || \
|
||||
+ (defined(__mips__) && (!defined(__mips_isa_rev) || __mips_isa_rev < 6))
|
||||
|
||||
#if __GNUC__
|
||||
#define ATTRIBUTE_PACKED __attribute__((__packed__))
|
||||
@@ -184,6 +187,11 @@ struct Unaligned32Struct {
|
||||
uint8 dummy; // To make the size non-power-of-two.
|
||||
} ATTRIBUTE_PACKED;
|
||||
|
||||
+struct Unaligned64Struct {
|
||||
+ uint64 value;
|
||||
+ uint8 dummy; // To make the size non-power-of-two.
|
||||
+} ATTRIBUTE_PACKED;
|
||||
+
|
||||
} // namespace internal
|
||||
} // namespace base
|
||||
|
||||
@@ -203,6 +211,7 @@ struct Unaligned32Struct {
|
||||
// See if that would be more efficient on platforms supporting it,
|
||||
// at least for copies.
|
||||
|
||||
+#ifndef __mips__
|
||||
inline uint64 UNALIGNED_LOAD64(const void *p) {
|
||||
uint64 t;
|
||||
memcpy(&t, p, sizeof t);
|
||||
@@ -212,6 +221,13 @@ inline uint64 UNALIGNED_LOAD64(const void *p) {
|
||||
inline void UNALIGNED_STORE64(void *p, uint64 v) {
|
||||
memcpy(p, &v, sizeof v);
|
||||
}
|
||||
+#else
|
||||
+#define UNALIGNED_LOAD64(_p) \
|
||||
+ ((reinterpret_cast<const ::snappy::base::internal::Unaligned64Struct *>(_p))->value)
|
||||
+#define UNALIGNED_STORE64(_p, _val) \
|
||||
+ ((reinterpret_cast< ::snappy::base::internal::Unaligned64Struct *>(_p))->value = \
|
||||
+ (_val))
|
||||
+#endif
|
||||
|
||||
#else
|
||||
|
||||
@@ -274,6 +290,13 @@ inline void UNALIGNED_STORE64(void *p, uint64 v) {
|
||||
#define bswap_32(x) OSSwapInt32(x)
|
||||
#define bswap_64(x) OSSwapInt64(x)
|
||||
|
||||
+#elif defined(__GNUC__)
|
||||
+/* musl provides suboptimal (generic) bswap_xx implementations in <byteswap.h> */
|
||||
+
|
||||
+#define bswap_16 __builtin_bswap16
|
||||
+#define bswap_32 __builtin_bswap32
|
||||
+#define bswap_64 __builtin_bswap64
|
||||
+
|
||||
#elif defined(HAVE_BYTESWAP_H)
|
||||
#include <byteswap.h>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user