commit:     a16aff822830ef6bd7bb40b14b5ad5853f155437
Author:     Azamat H. Hackimov <azamat.hackimov <AT> gmail <DOT> com>
AuthorDate: Wed May  5 18:28:17 2021 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Thu Jun  3 09:12:48 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a16aff82

app-arch/snappy: update to 1.1.9

Taking maitainership, cleanup ebuild.

Package-Manager: Portage-3.0.18, Repoman-3.0.2
Signed-off-by: Azamat H. Hackimov <azamat.hackimov <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/20692
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 app-arch/snappy/Manifest                           |  1 +
 .../snappy/files/snappy-1.1.9_external_gtest.patch | 34 +++++++++++
 .../snappy/files/snappy-1.1.9_gcc_inline.patch     | 67 ++++++++++++++++++++++
 app-arch/snappy/metadata.xml                       | 17 ++++--
 app-arch/snappy/snappy-1.1.9.ebuild                | 45 +++++++++++++++
 5 files changed, 159 insertions(+), 5 deletions(-)

diff --git a/app-arch/snappy/Manifest b/app-arch/snappy/Manifest
index 0995e291b70..6ecc06c8336 100644
--- a/app-arch/snappy/Manifest
+++ b/app-arch/snappy/Manifest
@@ -1 +1,2 @@
 DIST snappy-1.1.8.tar.gz 1096137 BLAKE2B 
e21f2ea23727f118920b7f67981354194f12d1d61eaa18eb1cb2f4285fabafdd221b88cf1e3b3261634f65469a714d3efe6b218c0b1e9d41639cdeb21097d75e
 SHA512 
efe18ff1b3edda1b4b6cefcbc6da8119c05d63afdbf7a784f3490353c74dced76baed7b5f1aa34b99899729192b9d657c33c76de4b507a51553fa8001ae75c1c
+DIST snappy-1.1.9.tar.gz 1102382 BLAKE2B 
926d03156168e3d4800dc17144db3de2c182c6eb9970d87a00b94fb09b67e403479a64cbed75833b83fd03173c1bb8caaf248a55627e89fe2a34456f12ff3b42
 SHA512 
f1f8a90f5f7f23310423574b1d8c9acb84c66ea620f3999d1060395205e5760883476837aba02f0aa913af60819e34c625d8308c18a5d7a9c4e190f35968b024

diff --git a/app-arch/snappy/files/snappy-1.1.9_external_gtest.patch 
b/app-arch/snappy/files/snappy-1.1.9_external_gtest.patch
new file mode 100644
index 00000000000..8aa4c1eabd2
--- /dev/null
+++ b/app-arch/snappy/files/snappy-1.1.9_external_gtest.patch
@@ -0,0 +1,34 @@
+From 9c1283f6022647a6ea39c1388321d6029fcdf80c Mon Sep 17 00:00:00 2001
+From: "Azamat H. Hackimov" <[email protected]>
+Date: Wed, 5 May 2021 21:19:22 +0300
+Subject: [PATCH] Use external GTest framework
+
+---
+ CMakeLists.txt | 11 ++---------
+ 1 file changed, 2 insertions(+), 9 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 672561e..fc830fe 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -291,15 +291,8 @@ if(SNAPPY_BUILD_TESTS)
+   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)
++  find_package(GTest REQUIRED)
++  include(GoogleTest)
+ 
+   add_executable(snappy_unittest "")
+   target_sources(snappy_unittest
+-- 
+2.26.3
+

diff --git a/app-arch/snappy/files/snappy-1.1.9_gcc_inline.patch 
b/app-arch/snappy/files/snappy-1.1.9_gcc_inline.patch
new file mode 100644
index 00000000000..04d35f56ee9
--- /dev/null
+++ b/app-arch/snappy/files/snappy-1.1.9_gcc_inline.patch
@@ -0,0 +1,67 @@
+From 0c716d435abe65250100c2caea0e5126ac4e14bd Mon Sep 17 00:00:00 2001
+From: "Georgi D. Sotirov" <[email protected]>
+Date: Wed, 5 May 2021 14:16:46 +0300
+Subject: [PATCH] Add inline with SNAPPY_ATTRIBUTE_ALWAYS_INLINE
+
+Add inline with SNAPPY_ATTRIBUTE_ALWAYS_INLINE on AdvanceToNextTag to
+fix the following compilation errors and a warning with GCC:
+
+[  2%] Building CXX object CMakeFiles/snappy.dir/snappy.cc.o
+/usr/bin/c++   -DHAVE_CONFIG_H -Dsnappy_EXPORTS
+-I/tmp/snappy-1.1.9/build -I/tmp/snappy-1.1.9  -O3
+-march=i586 -mtune=i686 -Wall -Wextra -fno-exceptions -fno-rtti -O3
+-DNDEBUG -fPIC   -std=c++11 -o CMakeFiles/snappy.dir/snappy.cc.o -c
+/tmp/snappy-1.1.9/snappy.cc
+/tmp/snappy-1.1.9/snappy.cc:1017:8: warning: always_inline
+function might not be inlinable [-Wattributes]
+ size_t AdvanceToNextTag(const uint8_t** ip_p, size_t* tag) {
+        ^
+/tmp/snappy-1.1.9/snappy.cc: In function 'std::pair<const
+unsigned char*, int> snappy::DecompressBranchless(const uint8_t*, const
+uint8_t*, ptrdiff_t, T, ptrdiff_t) [with T = char*; uint8_t = unsigned
+char; ptrdiff_t = int]':
+/tmp/snappy-1.1.9/snappy.cc:1017:8: error: inlining failed in
+call to always_inline 'size_t snappy::AdvanceToNextTag(const uint8_t**,
+size_t*)': function body can be overwritten at link time
+/tmp/snappy-1.1.9/snappy.cc:1097:53: error: called from here
+         size_t tag_type = AdvanceToNextTag(&ip, &tag);
+                                                     ^
+/tmp/snappy-1.1.9/snappy.cc:1017:8: error: inlining failed in
+call to always_inline 'size_t snappy::AdvanceToNextTag(const uint8_t**,
+size_t*)': function body can be overwritten at link time
+ size_t AdvanceToNextTag(const uint8_t** ip_p, size_t* tag) {
+        ^
+/tmp/snappy-1.1.9/snappy.cc:1097:53: error: called from here
+         size_t tag_type = AdvanceToNextTag(&ip, &tag);
+                                                     ^
+/tmp/snappy-1.1.9/snappy.cc:1017:8: error: inlining failed in
+call to always_inline 'size_t snappy::AdvanceToNextTag(const uint8_t**,
+size_t*)': function body can be overwritten at link time
+ size_t AdvanceToNextTag(const uint8_t** ip_p, size_t* tag) {
+        ^
+/tmp/snappy-1.1.9/snappy.cc:1097:53: error: called from here
+         size_t tag_type = AdvanceToNextTag(&ip, &tag);
+                                                     ^
+CMakeFiles/snappy.dir/build.make:137: recipe for target
+'CMakeFiles/snappy.dir/snappy.cc.o' failed
+
+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 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

diff --git a/app-arch/snappy/metadata.xml b/app-arch/snappy/metadata.xml
index c149214b310..9fbbf8bb934 100644
--- a/app-arch/snappy/metadata.xml
+++ b/app-arch/snappy/metadata.xml
@@ -1,11 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
 <pkgmetadata>
-       <!-- maintainer-needed -->
-       <longdescription lang="en">Snappy is a compression/decompression 
library. It does not aim for
-               maximum compression, or compatibility with any other compression
-               library; instead, it aims for very high speeds and reasonable
-               compression.</longdescription>
+       <maintainer type="person" proxied="yes">
+               <email>[email protected]</email>
+               <name>Azamat H. Hackimov</name>
+       </maintainer>
+       <maintainer type="project" proxied="proxy">
+               <email>[email protected]</email>
+               <name>Proxy Maintainers</name>
+       </maintainer>
+       <longdescription lang="en">Snappy is a compression/decompression 
library.
+               It does not aim for maximum compression, or compatibility with 
any
+               other compression library; instead, it aims for very high 
speeds and
+               reasonable compression.</longdescription>
        <upstream>
                <remote-id type="github">google/snappy</remote-id>
        </upstream>

diff --git a/app-arch/snappy/snappy-1.1.9.ebuild 
b/app-arch/snappy/snappy-1.1.9.ebuild
new file mode 100644
index 00000000000..afb71c795da
--- /dev/null
+++ b/app-arch/snappy/snappy-1.1.9.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+CMAKE_ECLASS=cmake
+inherit cmake-multilib
+
+DESCRIPTION="A high-speed compression/decompression library by Google"
+HOMEPAGE="https://github.com/google/snappy";
+SRC_URI="https://github.com/google/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0/${PV%%.*}"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc 
~x86 ~amd64-linux ~x86-linux ~x64-macos"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+DEPEND="test? ( dev-cpp/gtest )"
+
+DOCS=( format_description.txt framing_format.txt NEWS README.md )
+
+PATCHES=(
+       "${FILESDIR}/${P}_gcc_inline.patch"
+       "${FILESDIR}/${P}_external_gtest.patch"
+)
+
+multilib_src_configure() {
+       local mycmakeargs=(
+               -DSNAPPY_BUILD_TESTS=$(usex test)
+               -DSNAPPY_BUILD_BENCHMARKS=OFF
+               # we do not want to run benchmarks, and those are only used
+               # for benchmarks
+               -DHAVE_LIBZ=NO
+               -DHAVE_LIBLZO2=NO
+               -DHAVE_LIBLZ4=NO
+       )
+       cmake_src_configure
+}
+
+multilib_src_test() {
+       # run tests directly to get verbose output
+       cd "${S}" || die
+       "${BUILD_DIR}"/snappy_unittest || die
+}

Reply via email to