commit:     660bb95850ed7f503233158decb3af497fa6518b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon May 26 00:32:58 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon May 26 00:32:58 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=660bb958

dev-libs/c-blosc: build fixes

* Fix C23 compat (bool)
* Fix CMake 4 compat

Closes: https://bugs.gentoo.org/946283
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/c-blosc/c-blosc-1.21.6-r1.ebuild          | 59 ++++++++++++++++++++++
 dev-libs/c-blosc/files/c-blosc-1.21.4-c23.patch    | 46 +++++++++++++++++
 .../c-blosc/files/c-blosc-1.21.4-cmake-4.patch     | 29 +++++++++++
 3 files changed, 134 insertions(+)

diff --git a/dev-libs/c-blosc/c-blosc-1.21.6-r1.ebuild 
b/dev-libs/c-blosc/c-blosc-1.21.6-r1.ebuild
new file mode 100644
index 000000000000..4ba969b64357
--- /dev/null
+++ b/dev-libs/c-blosc/c-blosc-1.21.6-r1.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2025 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 ~loong 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
+       "${FILESDIR}"/${PN}-1.21.4-c23.patch
+       "${FILESDIR}"/${P}-cmake-4.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-c23.patch 
b/dev-libs/c-blosc/files/c-blosc-1.21.4-c23.patch
new file mode 100644
index 000000000000..6316658b8f10
--- /dev/null
+++ b/dev-libs/c-blosc/files/c-blosc-1.21.4-c23.patch
@@ -0,0 +1,46 @@
+https://bugs.gentoo.org/946283
+https://github.com/Blosc/c-blosc/pull/392
+
+From 774f6a0ebaa0c617f7f13ccf6bc89d17eba04654 Mon Sep 17 00:00:00 2001
+From: Georg Semmler <[email protected]>
+Date: Thu, 17 Apr 2025 10:19:25 +0200
+Subject: [PATCH] Drop a slightly outdated type def for boolean type
+
+This cases compilation errors with gcc 15 with the following error
+message:
+
+c-blosc/blosc/shuffle.c:26:15: error: 'bool' cannot be defined via 'typedef'
+      | typedef _Bool bool;
+      |               ^~~~
+c-blosc/blosc/shuffle.c:26:15: note: 'bool' is a keyword with '-std=c23' 
onwards
+
+See https://gcc.gnu.org/gcc-15/porting_to.html for details
+
+I've choosen to remove the typedef as it seems to be unused in this
+file.
+---
+ blosc/shuffle.c | 10 ----------
+ 1 file changed, 10 deletions(-)
+
+diff --git a/blosc/shuffle.c b/blosc/shuffle.c
+index e680a173..9e3ee3e3 100644
+--- a/blosc/shuffle.c
++++ b/blosc/shuffle.c
+@@ -20,16 +20,6 @@
+ #include <pthread.h>
+ #endif
+ 
+-/* Visual Studio < 2013 does not have stdbool.h so here it is a replacement: 
*/
+-#if defined __STDC__ && defined __STDC_VERSION__ && __STDC_VERSION__ >= 
199901L
+-/* have a C99 compiler */
+-typedef _Bool bool;
+-#else
+-/* do not have a C99 compiler */
+-typedef unsigned char bool;
+-#endif
+-
+-
+ #if !defined(__clang__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && \
+     __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+ #define HAVE_CPU_FEAT_INTRIN
+

diff --git a/dev-libs/c-blosc/files/c-blosc-1.21.4-cmake-4.patch 
b/dev-libs/c-blosc/files/c-blosc-1.21.4-cmake-4.patch
new file mode 100644
index 000000000000..5139884a78c9
--- /dev/null
+++ b/dev-libs/c-blosc/files/c-blosc-1.21.4-cmake-4.patch
@@ -0,0 +1,29 @@
+https://github.com/Blosc/c-blosc/commit/051b9d2cb9437e375dead8574f66d80ebce47bee
+
+From 051b9d2cb9437e375dead8574f66d80ebce47bee Mon Sep 17 00:00:00 2001
+From: Francesc Alted <[email protected]>
+Date: Fri, 28 Mar 2025 07:57:15 +0100
+Subject: [PATCH] Update minimal cmake version
+
+---
+ CMakeLists.txt | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f726a0a2..fac75f5f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -72,10 +72,8 @@
+ #    DEV: static includes blosc.a and blosc.h
+ 
+ 
+-cmake_minimum_required(VERSION 2.8.12)
+-if(NOT CMAKE_VERSION VERSION_LESS 3.3)
+-    cmake_policy(SET CMP0063 NEW)
+-endif()
++# Recent versions of cmake dropped compatibility with < 3.5
++cmake_minimum_required(VERSION 3.5)
+ 
+ # parse the full version numbers from blosc.h
+ file(READ ${CMAKE_CURRENT_SOURCE_DIR}/blosc/blosc.h _blosc_h_contents)
+

Reply via email to