Accepting request 906176 from home:dspinella:branches:devel:libraries:c_c++
- Update to 1.1.9: * Performance improvements - Add fix-always-inline.patch - Add use-system-test-libs.patch - Add a hardcoded snappy.pc file OBS-URL: https://build.opensuse.org/request/show/906176 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/snappy?expand=0&rev=18
This commit is contained in:
parent
407c983dec
commit
3bbb4b46cb
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:16b677f07832a612b0836178db7f374e414f94657c138e6993cbfc5dcc58651f
|
||||
size 1096137
|
BIN
1.1.9.tar.gz
(Stored with Git LFS)
Normal file
BIN
1.1.9.tar.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
29
fix-always-inline.patch
Normal file
29
fix-always-inline.patch
Normal file
@ -0,0 +1,29 @@
|
||||
From 0c716d435abe65250100c2caea0e5126ac4e14bd Mon Sep 17 00:00:00 2001
|
||||
From: "Georgi D. Sotirov" <gdsotirov@gmail.com>
|
||||
Date: Wed, 5 May 2021 14:16:46 +0300
|
||||
Subject: [PATCH] Add inline with SNAPPY_ATTRIBUTE_ALWAYS_INLINE
|
||||
Upstream: https://github.com/google/snappy/pull/128
|
||||
|
||||
Add inline with SNAPPY_ATTRIBUTE_ALWAYS_INLINE on AdvanceToNextTag to
|
||||
fix compilation errors and a warning with GCC.
|
||||
|
||||
Just like with other functions using SNAPPY_ATTRIBUTE_ALWAYS_INLINE
|
||||
macro (i.e. __attribute__((always_inline)) ) it is necessary to use C++
|
||||
inline specifier.
|
||||
---
|
||||
snappy.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/snappy.cc b/snappy.cc
|
||||
index 79dc0e8d..51157be2 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,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 13 16:38:54 UTC 2021 - Danilo Spinella <danilo.spinella@suse.com>
|
||||
|
||||
- Update to 1.1.9:
|
||||
* Performance improvements
|
||||
- Add fix-always-inline.patch
|
||||
- Add use-system-test-libs.patch
|
||||
- Add a hardcoded snappy.pc file
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Aug 25 13:06:16 UTC 2020 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
|
10
snappy.pc
Normal file
10
snappy.pc
Normal file
@ -0,0 +1,10 @@
|
||||
prefix=/usr
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib64
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: snappy
|
||||
Description: A compressor/decompressor library favoring time
|
||||
Version: 1.1.9
|
||||
Libs: -L${libdir} -lsnappy
|
||||
Cflags: -I${includedir}
|
19
snappy.spec
19
snappy.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package snappy
|
||||
#
|
||||
# Copyright (c) 2020 SUSE LLC
|
||||
# Copyright (c) 2021 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -18,18 +18,23 @@
|
||||
|
||||
%define libname libsnappy1
|
||||
Name: snappy
|
||||
Version: 1.1.8
|
||||
Version: 1.1.9
|
||||
Release: 0
|
||||
Summary: A compressor/decompressor library favoring time
|
||||
License: BSD-3-Clause
|
||||
Group: Development/Libraries/C and C++
|
||||
URL: https://github.com/google/snappy/
|
||||
Source0: https://github.com/google/snappy/archive/%{version}.tar.gz
|
||||
Source1: snappy.pc
|
||||
Source99: baselibs.conf
|
||||
Patch0: use-system-test-libs.patch
|
||||
Patch1: fix-always-inline.patch
|
||||
BuildRequires: cmake
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: lzo-devel
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: pkgconfig(benchmark)
|
||||
BuildRequires: pkgconfig(gtest)
|
||||
BuildRequires: pkgconfig(zlib)
|
||||
|
||||
%description
|
||||
@ -66,17 +71,18 @@ aims for high speeds and reasonable compression.
|
||||
This package holds the development files for snappy.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%autosetup
|
||||
|
||||
%build
|
||||
%cmake
|
||||
make %{?_smp_mflags}
|
||||
%cmake -DSNAPPY_USE_BUNDLED_GTEST=OFF -DSNAPPY_USE_BUNDLED_BENCHMARK_LIB=OFF
|
||||
%make_build
|
||||
|
||||
%install
|
||||
%cmake_install
|
||||
install -d -m 755 %{buildroot}%{_libdir}/pkgconfig
|
||||
install -m 644 %{SOURCE1} %{buildroot}%{_libdir}/pkgconfig/%{name}.pc
|
||||
|
||||
%check
|
||||
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
|
||||
%ctest
|
||||
|
||||
%post -n %{libname} -p /sbin/ldconfig
|
||||
@ -91,5 +97,6 @@ export LD_LIBRARY_PATH=%{buildroot}%{_libdir}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PA
|
||||
%{_libdir}/libsnappy.so
|
||||
%dir %{_libdir}/cmake/Snappy/
|
||||
%{_libdir}/cmake/Snappy/*
|
||||
%{_libdir}/pkgconfig/%{name}.pc
|
||||
|
||||
%changelog
|
||||
|
120
use-system-test-libs.patch
Normal file
120
use-system-test-libs.patch
Normal file
@ -0,0 +1,120 @@
|
||||
From 114df35e84ad95b6d5afbcf69aa85a14ff029000 Mon Sep 17 00:00:00 2001
|
||||
From: Danilo Spinella <danilo.spinella@suse.com>
|
||||
Date: Fri, 9 Jul 2021 16:57:35 +0200
|
||||
Subject: [PATCH] Add a switch to use system gtest and benchmark
|
||||
Upstream: https://github.com/google/snappy/pull/132
|
||||
|
||||
Allow to use the gtest and benchmark libraries from the system.
|
||||
Use pkg-config to check that the libraries are installed and to
|
||||
add the correct cflags/link flags.
|
||||
---
|
||||
CMakeLists.txt | 66 ++++++++++++++++++++++++++++++++++++--------------
|
||||
1 file changed, 48 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 672561e..eb2a743 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -90,6 +90,14 @@ option(SNAPPY_BUILD_TESTS "Build Snappy's own tests." ON)
|
||||
|
||||
option(SNAPPY_BUILD_BENCHMARKS "Build Snappy's benchmarks" ON)
|
||||
|
||||
+if(UNIX)
|
||||
+ option(SNAPPY_USE_BUNDLED_GTEST "Build test using bundled googletest library" ON)
|
||||
+ option(SNAPPY_USE_BUNDLED_BENCHMARK_LIB "Build benchmarks using bundled benchmark library" ON)
|
||||
+else(UNIX)
|
||||
+ set(SNAPPY_USE_BUNDLED_GTEST ON)
|
||||
+ set(SNAPPY_USE_BUNDLED_BENCHMARK_LIB ON)
|
||||
+endif(UNIX)
|
||||
+
|
||||
option(SNAPPY_FUZZING_BUILD "Build Snappy for fuzzing." OFF)
|
||||
|
||||
option(SNAPPY_REQUIRE_AVX "Target processors with AVX support." OFF)
|
||||
@@ -284,29 +292,40 @@ endif(SNAPPY_BUILD_TESTS OR SNAPPY_BUILD_BENCHMARKS)
|
||||
if(SNAPPY_BUILD_TESTS)
|
||||
enable_testing()
|
||||
|
||||
- # Prevent overriding the parent project's compiler/linker settings on Windows.
|
||||
- set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
- set(install_gtest OFF)
|
||||
- set(install_gmock OFF)
|
||||
- set(build_gmock ON)
|
||||
-
|
||||
- # This project is tested using 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_USE_BUNDLED_GTEST)
|
||||
+ # Prevent overriding the parent project's compiler/linker settings on Windows.
|
||||
+ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
+ set(install_gtest OFF)
|
||||
+ set(install_gmock OFF)
|
||||
+ set(build_gmock ON)
|
||||
+
|
||||
+ # This project is tested using 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)
|
||||
+ else(SNAPPY_USE_BUNDLED_GTEST)
|
||||
+ find_package(PkgConfig)
|
||||
+ pkg_search_module(GTEST REQUIRED gtest_main)
|
||||
+ endif(SNAPPY_USE_BUNDLED_GTEST)
|
||||
|
||||
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)
|
||||
+ if(SNAPPY_USE_BUNDLED_GTEST)
|
||||
+ target_link_libraries(snappy_unittest gmock_main gtest)
|
||||
+ else(SNAPPY_USE_BUNDLED_BENCHMARK_LIB)
|
||||
+ target_link_libraries(snappy_unittest ${GTEST_LDFLAGS})
|
||||
+ target_compile_options(snappy_unittest PUBLIC ${GTEST_CFLAGS})
|
||||
+ endif(SNAPPY_USE_BUNDLED_GTEST)
|
||||
|
||||
add_test(
|
||||
NAME snappy_unittest
|
||||
@@ -322,17 +341,28 @@ if(SNAPPY_BUILD_TESTS)
|
||||
endif(SNAPPY_BUILD_TESTS)
|
||||
|
||||
if(SNAPPY_BUILD_BENCHMARKS)
|
||||
+ if(NOT SNAPPY_USE_BUNDLED_BENCHMARK_LIB)
|
||||
+ find_package(PkgConfig)
|
||||
+ pkg_search_module(BENCHMARK REQUIRED benchmark)
|
||||
+ endif(NOT SNAPPY_USE_BUNDLED_BENCHMARK_LIB)
|
||||
+
|
||||
add_executable(snappy_benchmark "")
|
||||
target_sources(snappy_benchmark
|
||||
PRIVATE
|
||||
"snappy_benchmark.cc"
|
||||
)
|
||||
target_link_libraries(snappy_benchmark snappy_test_support benchmark_main)
|
||||
+ if(NOT SNAPPY_USE_BUNDLED_BENCHMARK_LIB)
|
||||
+ target_link_libraries(snappy_benchmark ${BENCHMARK_LDFLAGS})
|
||||
+ target_compile_options(snappy_benchmark PUBLIC ${BENCHMARK_CFLAGS})
|
||||
+ endif(NOT SNAPPY_USE_BUNDLED_BENCHMARK_LIB)
|
||||
|
||||
# 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")
|
||||
+ if(SNAPPY_USE_BUNDLED_BENCHMARK_LIB)
|
||||
+ add_subdirectory("third_party/benchmark")
|
||||
+ endif(SNAPPY_USE_BUNDLED_BENCHMARK_LIB)
|
||||
endif(SNAPPY_BUILD_BENCHMARKS)
|
||||
|
||||
if(SNAPPY_FUZZING_BUILD)
|
Loading…
x
Reference in New Issue
Block a user