From 905bd316441ce801e8edeec7b88171ba1cd0c91ff0d799b666db3ee2330a9e96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Sat, 4 May 2024 00:42:50 +0200 Subject: [PATCH] Sync from SUSE:SLFO:Main snappy revision a759aa6fba405cd40025e3f0ab89941d --- .gitattributes | 23 ++++++ 1.1.9.tar.gz | 3 + baselibs.conf | 1 + fix-always-inline.patch | 29 +++++++ reenable-rtti.patch | 25 ++++++ snappy.changes | 153 +++++++++++++++++++++++++++++++++++++ snappy.pc | 10 +++ snappy.spec | 103 +++++++++++++++++++++++++ use-system-test-libs.patch | 120 +++++++++++++++++++++++++++++ 9 files changed, 467 insertions(+) create mode 100644 .gitattributes create mode 100644 1.1.9.tar.gz create mode 100644 baselibs.conf create mode 100644 fix-always-inline.patch create mode 100644 reenable-rtti.patch create mode 100644 snappy.changes create mode 100644 snappy.pc create mode 100644 snappy.spec create mode 100644 use-system-test-libs.patch diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/1.1.9.tar.gz b/1.1.9.tar.gz new file mode 100644 index 0000000..1105036 --- /dev/null +++ b/1.1.9.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75c1fbb3d618dd3a0483bff0e26d0a92b495bbe5059c8b4f1c962b478b6e06e7 +size 1102382 diff --git a/baselibs.conf b/baselibs.conf new file mode 100644 index 0000000..0d63167 --- /dev/null +++ b/baselibs.conf @@ -0,0 +1 @@ +libsnappy1 diff --git a/fix-always-inline.patch b/fix-always-inline.patch new file mode 100644 index 0000000..43c3606 --- /dev/null +++ b/fix-always-inline.patch @@ -0,0 +1,29 @@ +From 0c716d435abe65250100c2caea0e5126ac4e14bd Mon Sep 17 00:00:00 2001 +From: "Georgi D. Sotirov" +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 diff --git a/reenable-rtti.patch b/reenable-rtti.patch new file mode 100644 index 0000000..63d023f --- /dev/null +++ b/reenable-rtti.patch @@ -0,0 +1,25 @@ +Index: snappy-1.1.9/CMakeLists.txt +=================================================================== +--- snappy-1.1.9.orig/CMakeLists.txt ++++ snappy-1.1.9/CMakeLists.txt +@@ -51,10 +51,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" + string(REGEX REPLACE "/EH[a-z]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHs-c-") + add_definitions(-D_HAS_EXCEPTIONS=0) +- +- # Disable RTTI. +- string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-") + else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + # Use -Wall for clang and gcc. + if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall") +@@ -77,9 +73,6 @@ else(CMAKE_CXX_COMPILER_ID STREQUAL "MSV + string(REGEX REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") + +- # Disable RTTI. +- string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") + endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + + # BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make diff --git a/snappy.changes b/snappy.changes new file mode 100644 index 0000000..69132d5 --- /dev/null +++ b/snappy.changes @@ -0,0 +1,153 @@ +------------------------------------------------------------------- +Wed Oct 27 06:25:52 UTC 2021 - Tim Serong + +- Re-enable RTTI, without which other applications can't subclass + snappy::Source (this breaks Ceph, as one example) +- Add reenable-rtti.patch + +------------------------------------------------------------------- +Tue Jul 13 16:38:54 UTC 2021 - Danilo Spinella + +- 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 + +- update to 1.1.8: + * Small performance improvements. + * Removed snappy::string alias for std::string. + * Improved CMake configuration. +- remove snappy-pcfile.patch (never went upstream) + +------------------------------------------------------------------- +Thu Feb 8 15:00:05 UTC 2018 - jengelh@inai.de + +- Better neutrality of from description. Quantify "Core i7". + Trim description of SRPM and -devel as the user already has an + idea what to look for. +- Fix RPM groups. + +------------------------------------------------------------------- +Thu Feb 8 11:23:03 UTC 2018 - tchvatal@suse.com + +- Version update to 1.1.7: + * Aarch64 fixes + * ppc speedups + * PIE improvements + * Switch to cmake build system +- Add patch snappy-pcfile.patch: + * Pull 55 on upstream github, was dropped when moving to cmake + of course we still need it +- Fix license install wrt bsc#1080040 + +------------------------------------------------------------------- +Sat Apr 15 23:55:17 UTC 2017 - toddrme2178@gmail.com + +- Version bump to 1.1.4 + * Fix a 1% performance regression when snappy is used in PIE executables. + * Improve compression performance by 5%. + * Improve decompression performance by 20%. +- Use better download url. + +------------------------------------------------------------------- +Wed Jul 29 10:42:56 UTC 2015 - tchvatal@suse.com + +- Version bump to 1.1.3: + * See the NEWS file for full details +- Switch to distribution from github +- Remove upstreamed patch: + * snappy-1.1.1-random-return.patch + +------------------------------------------------------------------- +Wed Jul 29 09:58:16 UTC 2015 - dimstar@opensuse.org + +- Add baselibs.conf: build snappy1-32bit, as needed by + libqt5-qtwebengine-32bit. + +------------------------------------------------------------------- +Thu Sep 11 09:34:36 UTC 2014 - toddrme2178@gmail.com + +- Update to version 1.1.2 + - This is a maintenance release with no changes to the actual + library source code. + * Stop distributing benchmark data files that have unclear + or unsuitable licensing. + * Add support for padding chunks in the framing format. + +------------------------------------------------------------------- +Wed Nov 13 12:44:42 UTC 2013 - p.drouand@gmail.com + +- Update to version 1.1.1 + * Add support for uncompressing to iovecs (scatter I/O). + * Speed up decompression by ~2%; much more so (~13-20%) on + a few benchmarks on given compilers and CPUs. + * Fix a few issues with MSVC compilation. + * Support truncated test data in the benchmark. +- Adapt patch to upstream changes + * snappy-random-return.patch > snappy-1.1.1-random-return.patch + +------------------------------------------------------------------- +Thu Aug 22 12:56:27 UTC 2013 - cdenicolo@suse.com + +- license update: BSD-3-Clause + correct license is BSD-3-Clause. + +------------------------------------------------------------------- +Thu Aug 15 11:41:25 UTC 2013 - mvyskocil@suse.com + +- Update to 1.1.0 (FATE#315420) + * Snappy now uses 64 kB block size instead of 32 kB. On average, + this means it compresses about 3% denser (more so for some + inputs), at the same or better speeds. + * libsnappy no longer depends on iostream. + * Some small performance improvements in compression on x86 + (0.5–1%). + * Various portability fixes for ARM-based platforms, for MSVC, + and for GNU/Hurd. +- refresh and rename random-return.patch + * snappy-random-return.patch +- reformat spec file +- build with NDEBUG to speedup a library +- install COPYING alongside so file + +------------------------------------------------------------------- +Fri Nov 23 02:19:58 UTC 2012 - mrueckert@suse.de + +- update to 1.0.5 + * More speed improvements. Exactly how big will depend on + the architecture: + + - 3–10% faster decompression for the base case (x86-64). + + - ARMv7 and higher can now use unaligned accesses, + and will see about 30% faster decompression and + 20–40% faster compression. + + - 32-bit platforms (ARM and 32-bit x86) will see 2–5% + faster compression. + + These are all cumulative (e.g., ARM gets all three speedups). + + * Fixed an issue where the unit test would crash on system + with less than 256 MB address space available, + e.g. some embedded platforms. + + * Added a framing format description, for use over e.g. HTTP, + or for a command-line compressor. We do not have any + implementations of this at the current point, but there seems + to be enough of a general interest in the topic. + Also make the format description slightly clearer. + + * Remove some compile-time warnings in -Wall + (mostly signed/unsigned comparisons), for easier embedding + into projects that use -Wall -Werror. + +------------------------------------------------------------------- +Wed Feb 8 16:36:29 UTC 2012 - mrueckert@suse.de + +- initial package (v1.0.4) + diff --git a/snappy.pc b/snappy.pc new file mode 100644 index 0000000..38564e1 --- /dev/null +++ b/snappy.pc @@ -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} diff --git a/snappy.spec b/snappy.spec new file mode 100644 index 0000000..da82b39 --- /dev/null +++ b/snappy.spec @@ -0,0 +1,103 @@ +# +# spec file for package snappy +# +# 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 +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define libname libsnappy1 +Name: snappy +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 +Patch2: reenable-rtti.patch +BuildRequires: cmake +BuildRequires: gcc-c++ +BuildRequires: lzo-devel +BuildRequires: pkgconfig +BuildRequires: pkgconfig(benchmark) +BuildRequires: pkgconfig(gtest) +BuildRequires: pkgconfig(zlib) + +%description +Snappy is a compression/decompression library. It does not aim for maximum +compression, or compatibility with any other compression library; instead, it +aims for high speeds and reasonable compression. + +%package -n %{libname} +Summary: Shared library from snappy +Group: System/Libraries + +%description -n %{libname} +Snappy is a compression/decompression library. It does not aim for maximum +compression, or compatibility with any other compression library; instead, it +aims for high speeds and reasonable compression. For instance, compared to +the fastest mode of zlib, Snappy is an order of magnitude faster for most +inputs, but the resulting compressed files are anywhere from 20%% to 100%% +bigger. On a single core of a 1st-generation Core i7 processor in 64-bit +mode, Snappy compresses at about 250 MB/sec or more and decompresses at about +500 MB/sec or more. + +This package holds the shared library of snappy. + +%package devel +Summary: Development files for snappy +Group: Development/Libraries/C and C++ +Requires: %{libname} = %{version} + +%description devel +Snappy is a compression/decompression library. It does not aim for maximum +compression, or compatibility with any other compression library; instead, it +aims for high speeds and reasonable compression. + +This package holds the development files for snappy. + +%prep +%autosetup + +%build +%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 +%ctest + +%post -n %{libname} -p /sbin/ldconfig +%postun -n %{libname} -p /sbin/ldconfig + +%files -n %{libname} +%license COPYING +%{_libdir}/libsnappy.so.* + +%files devel +%{_includedir}/snappy*.h +%{_libdir}/libsnappy.so +%dir %{_libdir}/cmake/Snappy/ +%{_libdir}/cmake/Snappy/* +%{_libdir}/pkgconfig/%{name}.pc + +%changelog diff --git a/use-system-test-libs.patch b/use-system-test-libs.patch new file mode 100644 index 0000000..9e3399c --- /dev/null +++ b/use-system-test-libs.patch @@ -0,0 +1,120 @@ +From 114df35e84ad95b6d5afbcf69aa85a14ff029000 Mon Sep 17 00:00:00 2001 +From: Danilo Spinella +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)