aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice <me@tobias.gr>2021-05-12 22:06:12 +0200
committerTobias Geerinckx-Rice <me@tobias.gr>2021-05-13 00:32:21 +0200
commitbd1c5fe46bf86363be7278a06490d95709423ad7 (patch)
treecfcb440f4e40d7c3f3045b3cffc2454bcf17231e
parentc9c274172b781c51e67868c53c8b2ea394bf7a94 (diff)
downloadguix-bd1c5fe46bf86363be7278a06490d95709423ad7.tar.gz
guix-bd1c5fe46bf86363be7278a06490d95709423ad7.zip
gnu: snappy: Update to 1.1.9.
* gnu/packages/compression.scm (snappy): Update to 1.1.9. [source]: Add another patch. [arguments]: Add new #:configure-flags and an 'unpack-third_party-subprojects phase. [native-inputs]: Add the sources for benchmark and googletests. * gnu/packages/patches/snappy-add-inline-for-GCC.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/compression.scm33
-rw-r--r--gnu/packages/patches/snappy-add-inline-for-GCC.patch67
3 files changed, 97 insertions, 4 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 01d495d41d..2bf3aaf2a6 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1694,6 +1694,7 @@ dist_patch_DATA = \
%D%/packages/patches/slim-login.patch \
%D%/packages/patches/slim-display.patch \
%D%/packages/patches/snappy-add-O2-flag-in-CmakeLists.txt.patch \
+ %D%/packages/patches/snappy-add-inline-for-GCC.patch \
%D%/packages/patches/sphinxbase-fix-doxygen.patch \
%D%/packages/patches/sssd-fix-samba.patch \
%D%/packages/patches/sssd-system-directories.patch \
diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm
index 02d2d0a3e6..3dbe517f93 100644
--- a/gnu/packages/compression.scm
+++ b/gnu/packages/compression.scm
@@ -66,6 +66,7 @@
#:use-module (gnu packages autotools)
#:use-module (gnu packages backup)
#:use-module (gnu packages base)
+ #:use-module (gnu packages benchmark)
#:use-module (gnu packages boost)
#:use-module (gnu packages check)
#:use-module (gnu packages curl)
@@ -1108,7 +1109,7 @@ well as bzip2.")
(define-public snappy
(package
(name "snappy")
- (version "1.1.8")
+ (version "1.1.9")
(source
(origin
(method git-fetch)
@@ -1117,11 +1118,35 @@ well as bzip2.")
(commit version)))
(file-name (git-file-name name version))
(sha256
- (base32 "1j0kslq2dvxgkcxl1gakhvsa731yrcvcaipcp5k8k7ayicvkv9jv"))
- (patches (search-patches "snappy-add-O2-flag-in-CmakeLists.txt.patch"))))
+ (base32 "03zz56h79z0sgvi5sangjqn9dahhzvf645v26n1y0gwmfbmsax95"))
+ (patches
+ (search-patches "snappy-add-O2-flag-in-CmakeLists.txt.patch"
+ "snappy-add-inline-for-GCC.patch"))))
(build-system cmake-build-system)
(arguments
- `(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
+ `(#:configure-flags
+ (list "-DBUILD_SHARED_LIBS=ON"
+ ;; These would be installed alongside Snappy otherwise.
+ "-DBENCHMARK_ENABLE_INSTALL=OFF"
+ "-DINSTALL_GTEST=OFF")
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'unpack-third_party-subprojects
+ (lambda* (#:key inputs #:allow-other-keys)
+ (with-directory-excursion "third_party"
+ (for-each (lambda (subproject)
+ (let* ((input (string-append subproject "-source"))
+ (source (assoc-ref inputs input)))
+ (with-directory-excursion subproject
+ ;; Take advantage of the coincidence that both
+ ;; use GIT-FETCH, which creates a directory.
+ (copy-recursively source "."))))
+ (list "benchmark"
+ "googletest"))
+ #;punt))))))
+ (native-inputs
+ `(("benchmark-source" ,(package-source benchmark))
+ ("googletest-source" ,(package-source googletest))))
(home-page "https://github.com/google/snappy")
(synopsis "Fast compressor/decompressor")
(description "Snappy is a compression/decompression library. It does not
diff --git a/gnu/packages/patches/snappy-add-inline-for-GCC.patch b/gnu/packages/patches/snappy-add-inline-for-GCC.patch
new file mode 100644
index 0000000000..04d35f56ee
--- /dev/null
+++ b/gnu/packages/patches/snappy-add-inline-for-GCC.patch
@@ -0,0 +1,67 @@
+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
+
+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