dev-python/pyroaring: new package, add 1.1.0

- Unbundle croaring and add -Iinclude/roaring.h to `${CPPFLAGS}` from
the patched croaring pkgconfig.pc file otherwise:
``
  pyroaring/pyroaring.cpp:1171:10: fatal error: roaring.h: No such file or directory
  1171 | #include "roaring.h"
       |          ^~~~~~~~~~~
  compilation terminated.
```

Part-off: https://codeberg.org/gentoo/guru/pulls/17
Signed-off-by: zyxhere💭 <zyx@envs.net>
This commit is contained in:
zyxhere💭 committed 2026-07-25 13:19:24 +05:00
1 parent b56a1a3255
commit b48979b61f
4 files changed
+151

No files matched your search

+1
View File
@@ -0,0 +1 @@
DIST pyroaring-1.1.0.tar.gz 217093 BLAKE2B 1e26acb0b464e17e7ee4e77558045233d63429b2fb2f0f1878f2e6e9eb9b1697589e7318c034347c2d07e9fe58c0e87c27885e440ab3bd89377edea04cda6466 SHA512 b125a48e124b57c1be7cec55cdf84afde8333712b3b96d64f4a0e6b86d909b275a1a9be7f5ca269d062b5774e43c301e2542fd2444ecb2496eea94b5801158f9
@@ -0,0 +1,71 @@
https://salsa.debian.org/tti0/python3-pyroaring/-/blob/debian/latest/debian/patches/0001-Link-against-system-CRoaring-rather-than-vendor-copy.patch
From 1092a1ea9bc5ae6d185a00a9949dbf1cb8b84499 Mon Sep 17 00:00:00 2001
From: Theodore Tucker <theodore@tti0.net>
Date: Tue, 17 Mar 2026 16:55:38 +0000
Subject: [PATCH] Link against system CRoaring rather than vendor copy
Forwarded: not-needed
--- a/setup.py
+++ b/setup.py
@@ -33,54 +33,19 @@ except (IOError, ImportError, RuntimeError):
print('Could not generate long description.')
long_description = ''
-
-if PLATFORM_WINDOWS:
- # MSVC defaults to C++14, so no explicit C++ standard flag is needed.
- # roaring.c requires C11 for features like alignof and _Static_assert.
- ext_compile_args = []
- c_compile_args = ['/std:c11']
-else:
- c_compile_args = ['-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', '-D _GLIBCXX_ASSERTIONS']
- if PLATFORM_MACOSX:
- c_compile_args.append('-mmacosx-version-min=10.14')
- if 'DEBUG' in os.environ:
- c_compile_args.extend(['-O0', '-g'])
- else:
- c_compile_args.append('-O3')
- if 'ARCHI' in os.environ:
- if os.environ['ARCHI'] != "generic":
- c_compile_args.append('-march=%s' % os.environ['ARCHI'])
- # The '-march=native' flag is not universally allowed. In particular, it
- # will systematically fail on aarch64 systems (like the new Apple M1 systems). It
- # also creates troubles under macOS with pip installs and requires ugly workarounds.
- # The best way to handle people who want to use -march=native is to ask them
- # to pass ARCHI=native to their build process.
- # else:
- # c_compile_args.append('-march=native')
- ext_compile_args = c_compile_args + ['-std=c++11']
- c_compile_args = c_compile_args + ['-std=c11']
+compile_args = ['-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', '-D _GLIBCXX_ASSERTIONS']
pyroaring_module = Extension(
'pyroaring',
sources=[os.path.join(PKG_DIR, 'pyroaring.pyx')],
- extra_compile_args=ext_compile_args,
+ extra_compile_args=compile_args + ["-std=c++11"],
language='c++',
+ libraries=['roaring'],
)
-# roaring.c is compiled as a separate static library because it must be compiled
-# as C (not C++), with a C11 standard flag.
-libraries = [(
- 'croaring',
- {
- 'sources': [os.path.join(PKG_DIR, 'roaring.c')],
- 'cflags': c_compile_args,
- },
-)]
-
setup(
name='pyroaring',
ext_modules=[pyroaring_module],
- libraries=libraries,
package_data={'pyroaring': ['py.typed', '__init__.pyi']},
packages=['pyroaring'],
version=VERSION,
--
2.47.3
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>zyx@envs.net</email>
<name>zyxhere💭</name>
</maintainer>
<longdescription>
An efficient and light-weight ordered set of integers. This is a Python
wrapper for the C library CRoaring.
</longdescription>
<upstream>
<remote-id type="github">Ezibenroc/PyRoaringBitMap</remote-id>
</upstream>
</pkgmetadata>
@@ -0,0 +1,64 @@
# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{12..15} )
inherit distutils-r1 flag-o-matic
DESCRIPTION="Python wrapper for the C library CRoaring."
HOMEPAGE="https://github.com/Ezibenroc/PyRoaringBitMap"
# tests not included in pypi tarballs
SRC_URI="
https://github.com/Ezibenroc/PyRoaringBitMap/archive/refs/tags/${PV}.tar.gz
-> ${P}.tar.gz
"
S="${WORKDIR}/PyRoaringBitMap-${PV}"
LICENSE="MIT"
SLOT=0
KEYWORDS="~amd64"
DEPEND="
dev-libs/croaring
"
RDEPEND="${DEPEND}
"
BDEPEND="
dev-python/cython[${PYTHON_USEDEP}]
virtual/pkgconfig
test? ( dev-python/hypothesis[${PYTHON_USEDEP}] )
"
PATCHES=(
"${FILESDIR}"/${P}-Link-against-system-CRoaring-rather-than-vendor-copy.patch
)
EPYTEST_PLUGINS=(
)
distutils_enable_tests pytest
src_prepare() {
# make sure we are not bundling croaring
rm ${PN}/roaring.{c,h} || die
distutils-r1_src_prepare
}
src_configure() {
# fatal error: roaring.h: No such file or directory
append-cppflags $(pkg-config --cflags roaring)
distutils-r1_src_configure
}
python_test() {
epytest test.py
}