From 3c7d0c1fc96b5b4dd4ad858e4a27a0d06c823478 Mon Sep 17 00:00:00 2001 From: Arthur Zamarin Date: Sun, 5 Sep 2021 19:36:30 +0300 Subject: dev-libs/crc32c: fix for big endian systems Closes: https://bugs.gentoo.org/810688 Signed-off-by: Arthur Zamarin --- dev-libs/crc32c/crc32c-1.0.6-r1.ebuild | 35 ++++++++++++++++++++++ dev-libs/crc32c/crc32c-1.0.6.ebuild | 31 ------------------- .../crc32c/files/crc32c-1.0.6-fix-big-endian.patch | 29 ++++++++++++++++++ 3 files changed, 64 insertions(+), 31 deletions(-) create mode 100644 dev-libs/crc32c/crc32c-1.0.6-r1.ebuild delete mode 100644 dev-libs/crc32c/crc32c-1.0.6.ebuild create mode 100644 dev-libs/crc32c/files/crc32c-1.0.6-fix-big-endian.patch (limited to 'dev-libs/crc32c') diff --git a/dev-libs/crc32c/crc32c-1.0.6-r1.ebuild b/dev-libs/crc32c/crc32c-1.0.6-r1.ebuild new file mode 100644 index 000000000000..53b6e710e340 --- /dev/null +++ b/dev-libs/crc32c/crc32c-1.0.6-r1.ebuild @@ -0,0 +1,35 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit cmake + +DESCRIPTION="CRC32C implementation with support for CPU-specific acceleration instructions" +HOMEPAGE="https://github.com/google/crc32c" +SRC_URI="https://github.com/google/crc32c/archive/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="amd64 ~riscv x86" + +PATCHES=( + "${FILESDIR}/${P}-fix-big-endian.patch" +) + +DOCS=( README.md ) + +src_prepare() { + sed -e '/-Werror/d' -i CMakeLists.txt || die + cmake_src_prepare +} + +src_configure() { + local mycmakeargs=( + -DCRC32C_BUILD_TESTS=OFF + -DCRC32C_BUILD_BENCHMARKS=OFF + -DCRC32C_USE_GLOG=OFF + ) + + cmake_src_configure +} diff --git a/dev-libs/crc32c/crc32c-1.0.6.ebuild b/dev-libs/crc32c/crc32c-1.0.6.ebuild deleted file mode 100644 index baf1e8683e97..000000000000 --- a/dev-libs/crc32c/crc32c-1.0.6.ebuild +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -inherit cmake - -DESCRIPTION="CRC32C implementation with support for CPU-specific acceleration instructions" -HOMEPAGE="https://github.com/google/crc32c" -SRC_URI="https://github.com/google/crc32c/archive/${PV}.tar.gz -> ${P}.tar.gz" - -LICENSE="BSD" -SLOT="0" -KEYWORDS="amd64 ~riscv x86" - -DOCS=( README.md ) - -src_prepare() { - sed -e '/-Werror/d' -i CMakeLists.txt || die - cmake_src_prepare -} - -src_configure() { - local mycmakeargs=( - -DCRC32C_BUILD_TESTS=OFF - -DCRC32C_BUILD_BENCHMARKS=OFF - -DCRC32C_USE_GLOG=OFF - ) - - cmake_src_configure -} diff --git a/dev-libs/crc32c/files/crc32c-1.0.6-fix-big-endian.patch b/dev-libs/crc32c/files/crc32c-1.0.6-fix-big-endian.patch new file mode 100644 index 000000000000..3bd09930946a --- /dev/null +++ b/dev-libs/crc32c/files/crc32c-1.0.6-fix-big-endian.patch @@ -0,0 +1,29 @@ +From: Pieter Wuille +Date: Thu, 18 Jun 2020 21:05:38 -0700 +Subject: [PATCH] Fix (unused) ReadUint64LE for BE machines (#41) + +--- a/src/crc32c_read_le.h ++++ b/src/crc32c_read_le.h +@@ -30,14 +30,14 @@ inline uint32_t ReadUint32LE(const uint8_t* buffer) { + // Reads a little-endian 64-bit integer from a 64-bit-aligned buffer. + inline uint64_t ReadUint64LE(const uint8_t* buffer) { + #if BYTE_ORDER_BIG_ENDIAN +- return ((static_cast(static_cast(buffer[0]))) | +- (static_cast(static_cast(buffer[1])) << 8) | +- (static_cast(static_cast(buffer[2])) << 16) | +- (static_cast(static_cast(buffer[3])) << 24) | +- (static_cast(static_cast(buffer[4])) << 32) | +- (static_cast(static_cast(buffer[5])) << 40) | +- (static_cast(static_cast(buffer[6])) << 48) | +- (static_cast(static_cast(buffer[7])) << 56)); ++ return ((static_cast(static_cast(buffer[0]))) | ++ (static_cast(static_cast(buffer[1])) << 8) | ++ (static_cast(static_cast(buffer[2])) << 16) | ++ (static_cast(static_cast(buffer[3])) << 24) | ++ (static_cast(static_cast(buffer[4])) << 32) | ++ (static_cast(static_cast(buffer[5])) << 40) | ++ (static_cast(static_cast(buffer[6])) << 48) | ++ (static_cast(static_cast(buffer[7])) << 56)); + #else // !BYTE_ORDER_BIG_ENDIAN + uint64_t result; + // This should be optimized to a single instruction. -- cgit v1.2.3-65-gdbad