commit:     14d6583917451b5dfdad632d9d8956c56c8a7a18
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 17 00:05:13 2023 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Mon Jul 17 01:17:36 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=14d65839

dev-python/pybind11: keyword ~x64-macos and ~arm64-macos.

A patch is need to undo the assumption of LLVM toolchain on macOS.  It
does not affect other architectures, incorporating without a revision
bump.

Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 .../pybind11/files/pybind11-2.10.4_macOS-GCC.patch | 23 ++++++++++++++++++++++
 dev-python/pybind11/pybind11-2.10.4.ebuild         |  3 ++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/dev-python/pybind11/files/pybind11-2.10.4_macOS-GCC.patch 
b/dev-python/pybind11/files/pybind11-2.10.4_macOS-GCC.patch
new file mode 100644
index 000000000000..5bfa88348110
--- /dev/null
+++ b/dev-python/pybind11/files/pybind11-2.10.4_macOS-GCC.patch
@@ -0,0 +1,23 @@
+Break the toolchain assumption of LLVM on Prefix/macOS.
+
+At Prefix/macOS, the system compiler is GCC with libstdc++.
+
+This patch is only useful to Gentoo Prefix.  We don't have plans to
+forward it upstream.
+
+Signed-off-by: Benda Xu <hero...@gentoo.org>
+
+Index: pybind11-2.10.4/pybind11/setup_helpers.py
+===================================================================
+--- pybind11-2.10.4.orig/pybind11/setup_helpers.py
++++ pybind11-2.10.4/pybind11/setup_helpers.py
+@@ -154,9 +154,6 @@ class Pybind11Extension(_Extension):  #
+             c_cpp_flags = shlex.split(env_cflags) + shlex.split(env_cppflags)
+             if not any(opt.startswith("-g") for opt in c_cpp_flags):
+                 cflags += ["-g0"]
+-            if MACOS:
+-                cflags += ["-stdlib=libc++"]
+-                ldflags += ["-stdlib=libc++"]
+         self._add_cflags(cflags)
+         self._add_ldflags(ldflags)
+ 

diff --git a/dev-python/pybind11/pybind11-2.10.4.ebuild 
b/dev-python/pybind11/pybind11-2.10.4.ebuild
index ade4adbcd5e1..cea97d04299f 100644
--- a/dev-python/pybind11/pybind11-2.10.4.ebuild
+++ b/dev-python/pybind11/pybind11-2.10.4.ebuild
@@ -21,7 +21,7 @@ SRC_URI="
 
 LICENSE="BSD"
 SLOT="0"
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ppc ppc64 ~riscv ~s390 
sparc x86"
+KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ppc ppc64 ~riscv ~s390 
sparc x86 ~arm64-macos ~x64-macos"
 
 RDEPEND="
        dev-cpp/eigen:3
@@ -38,6 +38,7 @@ distutils_enable_tests pytest
 python_prepare_all() {
        export PYBIND11_USE_CMAKE=1
        cmake_src_prepare
+       PATCHES=( "${FILESDIR}"/pybind11-2.10.4_macOS-GCC.patch )
        distutils-r1_python_prepare_all
 }
 

Reply via email to