upgrade snappy to 1.1.9

This commit is contained in:
hanxinke 2021-12-07 14:47:53 +08:00
parent d89ffb3518
commit d88b837b35
6 changed files with 103 additions and 15 deletions

View File

@ -0,0 +1,26 @@
From 581af0c0a819da2214466e4d30416616966e781d Mon Sep 17 00:00:00 2001
From: hanxinke <hanxinke@huawei.com>
Date: Tue, 7 Dec 2021 15:47:14 +0800
Subject: [PATCH] fix the AdvanceToNextTag fails to be compiled without inline
Signed-off-by: hanxinke <hanxinke@huawei.com>
---
snappy.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/snappy.cc b/snappy.cc
index 79dc0e8..51157be 100644
--- a/snappy.cc
+++ b/snappy.cc
@@ -1014,7 +1014,7 @@ void MemMove(ptrdiff_t dst, const void* src, size_t size) {
}
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.8.3.1

View File

@ -0,0 +1,70 @@
From 14ccda0d6c228999c8d982a84562432cd7465743 Mon Sep 17 00:00:00 2001
From: hanxinke <hanxinke@huawei.com>
Date: Tue, 7 Dec 2021 15:34:34 +0800
Subject: [PATCH] remove dependency on google benchmark and gmock
Signed-off-by: hanxinke <hanxinke@huawei.com>
---
CMakeLists.txt | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 672561e..3127d9b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -88,7 +88,7 @@ option(BUILD_SHARED_LIBS "Build shared libraries(DLLs)." OFF)
option(SNAPPY_BUILD_TESTS "Build Snappy's own tests." ON)
-option(SNAPPY_BUILD_BENCHMARKS "Build Snappy's benchmarks" ON)
+option(SNAPPY_BUILD_BENCHMARKS "Build Snappy's benchmarks" OFF)
option(SNAPPY_FUZZING_BUILD "Build Snappy for fuzzing." OFF)
@@ -288,25 +288,25 @@ if(SNAPPY_BUILD_TESTS)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
set(install_gtest OFF)
set(install_gmock OFF)
- set(build_gmock ON)
+ set(build_gmock OFF)
# This project is tested using GoogleTest.
- add_subdirectory("third_party/googletest")
+ # add_subdirectory("third_party/googletest")
# GoogleTest triggers a missing field initializers warning.
- if(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
- set_property(TARGET gtest
- APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
- set_property(TARGET gmock
- APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
- endif(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
+ # if(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
+ # set_property(TARGET gtest
+ # APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
+ # set_property(TARGET gmock
+ # APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
+ # endif(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
add_executable(snappy_unittest "")
target_sources(snappy_unittest
PRIVATE
"snappy_unittest.cc"
)
- target_link_libraries(snappy_unittest snappy_test_support gmock_main gtest)
+ target_link_libraries(snappy_unittest snappy_test_support gtest_main gtest)
add_test(
NAME snappy_unittest
@@ -332,7 +332,7 @@ if(SNAPPY_BUILD_BENCHMARKS)
# This project uses Google benchmark for benchmarking.
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
set(BENCHMARK_ENABLE_EXCEPTIONS OFF CACHE BOOL "" FORCE)
- add_subdirectory("third_party/benchmark")
+ # add_subdirectory("third_party/benchmark")
endif(SNAPPY_BUILD_BENCHMARKS)
if(SNAPPY_FUZZING_BUILD)
--
1.8.3.1

Binary file not shown.

BIN
snappy-1.1.9.tar.gz Normal file

Binary file not shown.

View File

@ -1,12 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -212,7 +212,7 @@
"snappy-test.cc"
)
target_compile_definitions(snappy_unittest PRIVATE -DHAVE_CONFIG_H)
- target_link_libraries(snappy_unittest snappy ${GFLAGS_LIBRARIES})
+ target_link_libraries(snappy_unittest snappy ${GTEST_LIBRARIES} ${GFLAGS_LIBRARIES})
if(HAVE_LIBZ)
target_link_libraries(snappy_unittest z)

View File

@ -1,5 +1,5 @@
Name: snappy
Version: 1.1.8
Version: 1.1.9
Release: 1
Summary: A fast compressor/decompressor
License: BSD
@ -7,9 +7,10 @@ URL: https://github.com/google/snappy
Source0: https://github.com/google/snappy/archive/%{version}/%{name}-%{version}.tar.gz
Source1: snappy.pc
Patch0: snappy-gtest.patch
Patch0: remove-dependency-on-google-benchmark-and-gmock.patch
Patch1: fix-the-AdvanceToNextTag-fails-to-be-compiled-without-inline.patch
BuildRequires: gcc-c++ automake autoconf gtest-devel cmake
BuildRequires: gcc-c++ make gtest-devel cmake
%description
Snappy is a compression/decompression library. It does not aim for maximum compression,
@ -68,6 +69,9 @@ make test
%doc NEWS README.md
%changelog
* Tue Dec 7 2021 hanxinke<hanxinke@huawei.com> - 1.1.9-1
- DESC: upgrade snappy to 1.1.9
* Fri Jul 17 2020 shixuantong <shixuantong> - 1.1.8-1
- Type:NA
- ID:NA