commit:     398e57296b87407d2587a5237d3b8fd2ed7b2565
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  3 23:08:50 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun  4 00:05:40 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=398e5729

app-arch/csnappy: new package, add 0_pre20220804

Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-arch/csnappy/Manifest                          |  1 +
 app-arch/csnappy/csnappy-0_pre20220804.ebuild      | 44 ++++++++++++++++++++++
 .../files/csnappy-0_pre20220804-fix-tests.patch    | 41 ++++++++++++++++++++
 app-arch/csnappy/metadata.xml                      | 11 ++++++
 4 files changed, 97 insertions(+)

diff --git a/app-arch/csnappy/Manifest b/app-arch/csnappy/Manifest
new file mode 100644
index 000000000000..c2e159458d59
--- /dev/null
+++ b/app-arch/csnappy/Manifest
@@ -0,0 +1 @@
+DIST csnappy-0_pre20220804.tar.gz 594988 BLAKE2B 
ce82ef7945ba3110d0d2878d4fcd3d48631f260dad94c1b40f7811de17e60568b2934d33e43966f559b0d840f5eed659bde84eab46954679754e9de5306508a1
 SHA512 
53f602c58a3a9932ac580412d90f3aa7f820cb9bbc9e2dec240dd28de55210fd17ac61a5f8e4a2cebffe2914837c7cabba1061536abd96e35da57c799e8ee7b7

diff --git a/app-arch/csnappy/csnappy-0_pre20220804.ebuild 
b/app-arch/csnappy/csnappy-0_pre20220804.ebuild
new file mode 100644
index 000000000000..447ace6deab0
--- /dev/null
+++ b/app-arch/csnappy/csnappy-0_pre20220804.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs
+
+MY_COMMIT="6c10c305e8dde193546e6b33cf8a785d5dc123e2"
+
+DESCRIPTION="Google snappy in C for Linux Kernel"
+HOMEPAGE="https://github.com/zeevt/csnappy";
+SRC_URI="https://github.com/zeevt/csnappy/archive/${MY_COMMIT}.tar.gz -> 
${P}.tar.gz"
+S="${WORKDIR}"/${PN}-${MY_COMMIT}
+
+# https://github.com/zeevt/csnappy/issues/21
+LICENSE="BSD"
+# 0/${PV} b/c of the SONAME situation (see below).
+SLOT="0/${PV}"
+KEYWORDS="~amd64"
+
+# https://github.com/zeevt/csnappy/issues/33
+# No SONAME yet.
+QA_SONAME="usr/lib.*/libcsnappy.so"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0_pre20220804-fix-tests.patch
+)
+
+src_compile() {
+       emake CC="$(tc-getCC)" OPT_FLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \
+               libcsnappy.so
+}
+
+src_test() {
+       # We don't want to run the Valgrind tests as it's fragile in sandbox
+       # and makes life harder for some arches.
+       emake CC="$(tc-getCC)" OPT_FLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \
+               check_unaligned_uint64 \
+               cl_test
+}
+
+src_install() {
+       emake DESTDIR="${ED}" LIBDIR="/usr/$(get_libdir)" install
+}

diff --git a/app-arch/csnappy/files/csnappy-0_pre20220804-fix-tests.patch 
b/app-arch/csnappy/files/csnappy-0_pre20220804-fix-tests.patch
new file mode 100644
index 000000000000..e4d11f7d9021
--- /dev/null
+++ b/app-arch/csnappy/files/csnappy-0_pre20220804-fix-tests.patch
@@ -0,0 +1,41 @@
+https://github.com/zeevt/csnappy/pull/40
+
+From 60ac30054eae4bbc50f90f8228ac53d014400619 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppi...@redhat.com>
+Date: Thu, 16 Dec 2021 14:24:26 +0100
+Subject: [PATCH] Fix parallel tests by only testing the current optimization
+ level
+
+https://github.com/zeevt/csnappy/issues/39
+--- a/Makefile
++++ b/Makefile
+@@ -34,25 +34,14 @@ check_leaks: cl_tester
+       LD_LIBRARY_PATH=. valgrind --leak-check=full --show-reachable=yes 
./cl_tester -c <testdata/urls.10K >/dev/null
+       LD_LIBRARY_PATH=. valgrind --leak-check=full --show-reachable=yes 
./cl_tester -S d
+ 
+-check_unaligned_uint64:
++check_unaligned_uint64: cl_tester
+       gzip -dc <testdata/unaligned_uint64_test.snappy.gz 
>testdata/unaligned_uint64_test.snappy
+       gzip -dc <testdata/unaligned_uint64_test.bin.gz 
>testdata/unaligned_uint64_test.bin
+-      EXTRA_TEST_CFLAGS="-O0" make check_unaligned_uint64_extra_cflags
+-      EXTRA_TEST_CFLAGS="-O1" make check_unaligned_uint64_extra_cflags
+-      EXTRA_TEST_CFLAGS="-O2" make check_unaligned_uint64_extra_cflags
+-      EXTRA_TEST_CFLAGS="-O3" make check_unaligned_uint64_extra_cflags
+-      EXTRA_TEST_CFLAGS="-O2 -march=native" make 
check_unaligned_uint64_extra_cflags
+-      EXTRA_TEST_CFLAGS="-O3 -march=native" make 
check_unaligned_uint64_extra_cflags
+-      rm -f testdata/unaligned_uint64_test.snappy 
testdata/unaligned_uint64_test.bin
+-
+-check_unaligned_uint64_extra_cflags:
+-      make clean
+-      make cl_tester
+       rm -f tmp
+       LD_LIBRARY_PATH=. ./cl_tester -d testdata/unaligned_uint64_test.snappy 
tmp
+-      diff testdata/unaligned_uint64_test.bin tmp >/dev/null && echo 
"${EXTRA_TEST_CFLAGS} ok"
+-      make clean
++      diff testdata/unaligned_uint64_test.bin tmp >/dev/null && echo 
"Unaligned test is ok"
+       rm -f tmp
++      rm -f testdata/unaligned_uint64_test.snappy 
testdata/unaligned_uint64_test.bin
+ 
+ libcsnappy.so: csnappy_compress.c csnappy_decompress.c csnappy_internal.h 
csnappy_internal_userspace.h
+       $(CC) $(CFLAGS) $(EXTRA_TEST_CFLAGS) -fPIC -DPIC -c -o 
csnappy_compress.o csnappy_compress.c
+

diff --git a/app-arch/csnappy/metadata.xml b/app-arch/csnappy/metadata.xml
new file mode 100644
index 000000000000..d377f25e89c3
--- /dev/null
+++ b/app-arch/csnappy/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>s...@gentoo.org</email>
+               <name>Sam James</name>
+       </maintainer>
+       <upstream>
+               <remote-id type="github">zeevt/csnappy</remote-id>
+       </upstream>
+</pkgmetadata>

Reply via email to