summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-08-21 07:32:48 +0100
committerSam James <sam@gentoo.org>2023-08-21 07:32:59 +0100
commit2c8c6679b1a55b9912410bb2ff76b8291c23544d (patch)
treef3e5c6a612eb07365b74e6df5f7e6e5f8ab0a16c /dev-libs/c-blosc
parentmedia-plugins/gst-plugins-libpng: Stabilize 1.20.6 arm, #908277 (diff)
downloadgentoo-2c8c6679b1a55b9912410bb2ff76b8291c23544d.tar.gz
gentoo-2c8c6679b1a55b9912410bb2ff76b8291c23544d.tar.bz2
gentoo-2c8c6679b1a55b9912410bb2ff76b8291c23544d.zip
dev-libs/c-blosc: disable unaligned access
Causes SIGBUS on armv7 (at least in jiji's arm32-on-arm64 chroot) in Pandas test suite. Unaligned access is UB anyway. Bug: https://bugs.gentoo.org/911660 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-libs/c-blosc')
-rw-r--r--dev-libs/c-blosc/c-blosc-1.21.4-r1.ebuild57
-rw-r--r--dev-libs/c-blosc/files/c-blosc-1.21.4-no-unaligned.patch33
2 files changed, 90 insertions, 0 deletions
diff --git a/dev-libs/c-blosc/c-blosc-1.21.4-r1.ebuild b/dev-libs/c-blosc/c-blosc-1.21.4-r1.ebuild
new file mode 100644
index 000000000000..bfeb84b2d188
--- /dev/null
+++ b/dev-libs/c-blosc/c-blosc-1.21.4-r1.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake
+
+DESCRIPTION="Blocking, shuffling and lossless compression library"
+HOMEPAGE="
+ https://www.blosc.org/
+ https://github.com/Blosc/c-blosc/
+"
+SRC_URI="
+ https://github.com/Blosc/c-blosc/archive/v${PV}.tar.gz
+ -> ${P}.gh.tar.gz
+"
+
+LICENSE="BSD"
+SLOT="0/1"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="+lz4 +snappy test zlib zstd"
+RESTRICT="!test? ( test )"
+
+DEPEND="
+ lz4? ( >=app-arch/lz4-1.7.5:= )
+ snappy? ( app-arch/snappy:= )
+ zlib? ( sys-libs/zlib:= )
+ zstd? ( app-arch/zstd:= )
+"
+RDEPEND="
+ ${DEPEND}
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.21.4-no-unaligned.patch
+)
+
+src_configure() {
+ # remove bundled libs (just in case)
+ rm -rf internal-complibs || die
+
+ local mycmakeargs=(
+ -DBUILD_STATIC=OFF
+ -DBUILD_TESTS=$(usex test)
+ -DBUILD_BENCHMARKS=OFF
+ -DBUILD_FUZZERS=OFF
+ -DDEACTIVATE_LZ4=$(usex !lz4)
+ -DDEACTIVATE_SNAPPY=$(usex !snappy)
+ -DDEACTIVATE_ZLIB=$(usex !zlib)
+ -DDEACTIVATE_ZSTD=$(usex !zstd)
+ -DPREFER_EXTERNAL_LZ4=ON
+ # snappy is always external
+ -DPREFER_EXTERNAL_ZLIB=ON
+ -DPREFER_EXTERNAL_ZSTD=ON
+ )
+ cmake_src_configure
+}
diff --git a/dev-libs/c-blosc/files/c-blosc-1.21.4-no-unaligned.patch b/dev-libs/c-blosc/files/c-blosc-1.21.4-no-unaligned.patch
new file mode 100644
index 000000000000..932df9355a99
--- /dev/null
+++ b/dev-libs/c-blosc/files/c-blosc-1.21.4-no-unaligned.patch
@@ -0,0 +1,33 @@
+Causes SIGBUS on armv7 (at least in jiji's arm32-on-arm64 chroot) in Pandas test
+suite. Unaligned access is UB anyway.
+--- a/blosc/blosc-common.h
++++ b/blosc/blosc-common.h
+@@ -43,28 +43,6 @@
+ */
+ #if !defined(BLOSC_STRICT_ALIGN)
+ #define BLOSC_STRICT_ALIGN
+-#if defined(__i386__) || defined(__386) || defined (__amd64) /* GNU C, Sun Studio */
+-#undef BLOSC_STRICT_ALIGN
+-#elif defined(__i486__) || defined(__i586__) || defined(__i686__) /* GNU C */
+-#undef BLOSC_STRICT_ALIGN
+-#elif defined(_M_IX86) || defined(_M_X64) /* Intel, MSVC */
+-#undef BLOSC_STRICT_ALIGN
+-#elif defined(__386)
+-#undef BLOSC_STRICT_ALIGN
+-#elif defined(_X86_) /* MinGW */
+-#undef BLOSC_STRICT_ALIGN
+-#elif defined(__I86__) /* Digital Mars */
+-#undef BLOSC_STRICT_ALIGN
+-/* Seems like unaligned access in ARM (at least ARMv6) is pretty
+- expensive, so we are going to always enforce strict alignment in ARM.
+- If anybody suggest that newer ARMs are better, we can revisit this. */
+-/* #elif defined(__ARM_FEATURE_UNALIGNED) */ /* ARM, GNU C */
+-/* #undef BLOSC_STRICT_ALIGN */
+-#elif defined(_ARCH_PPC) || defined(__PPC__)
+-/* Modern PowerPC systems (like POWER8) should support unaligned access
+- quite efficiently. */
+-#undef BLOSC_STRICT_ALIGN
+-#endif
+ #endif
+
+ #if defined(__SSE2__)