diff options
Diffstat (limited to 'dev-python')
| -rw-r--r-- | dev-python/pycxx/Manifest | 1 | ||||
| -rw-r--r-- | dev-python/pycxx/pycxx-7.1.10.ebuild | 112 |
2 files changed, 113 insertions, 0 deletions
diff --git a/dev-python/pycxx/Manifest b/dev-python/pycxx/Manifest index 1f467aae12e4..eb42c0ed2124 100644 --- a/dev-python/pycxx/Manifest +++ b/dev-python/pycxx/Manifest @@ -1 +1,2 @@ +DIST pycxx-7.1.10.zip 242530 BLAKE2B 6d3ea6da0640ad338068b82798b1e89ba168da7cb5bbe50db987a36153e4c22fffa6e4a99ea843b12fd54e3f966c436345063c7272f19be697c1189c3c32a019 SHA512 0531144dc4ac1ecde8d1b5fae5c385f33e944ff4a3fd96cf0c307b9cb295f2c595c7593ce1a57ce5f5ded1d7491a2cc1bf1eb49f80102fb11d7861aee8341998 DIST pycxx-7.1.8.tar.gz 154789 BLAKE2B e4b635d4b53ae3fd0790d6eddcd465acfc5272213e9752e7c2a1840edddb66f09bc9617373246964859125a27dc82110de6b4f4ffa44c41c94c338c846490e47 SHA512 3c9c3a23dfa9777c6a48b8600e7336cbadb60080a1051071583d534ead6c691dd9d304613073d6fb0c632eb1703b043b4214826c0ae7bd4b2ca72203ec03c0a2 diff --git a/dev-python/pycxx/pycxx-7.1.10.ebuild b/dev-python/pycxx/pycxx-7.1.10.ebuild new file mode 100644 index 000000000000..64092632e1d3 --- /dev/null +++ b/dev-python/pycxx/pycxx-7.1.10.ebuild @@ -0,0 +1,112 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="8" + +PYTHON_COMPAT=( python3_{10..14} ) +DISTUTILS_USE_PEP517=setuptools + +inherit distutils-r1 toolchain-funcs + +DESCRIPTION="Set of facilities to extend Python with C++" +HOMEPAGE="https://cxx.sourceforge.net" +SRC_URI="https://sourceforge.net/code-snapshots/svn/c/cx/cxx/code/cxx-code-r464-trunk.zip -> ${P}.zip" + +S="${WORKDIR}"/cxx-code-r464-trunk/CXX + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos" +IUSE="doc examples test" +RESTRICT="!test? ( test )" + +BDEPEND=" + $(python_gen_cond_dep ' + dev-python/setuptools[${PYTHON_USEDEP}] + ' 3.12) + app-arch/unzip +" + +python_prepare_all() { + rm -R Src/Python2/ || die + + # Without this, pysvn fails. + # Src/Python3/cxxextensions.c: No such file or directory + sed -e "/^#include/s:Src/::" -i Src/*.{c,cxx} || die "sed failed" + + distutils-r1_python_prepare_all +} + +python_compile() { + distutils-r1_python_compile + if use test; then + pushd Src || die + local S_SRCS="cxx_exceptions.cxx cxxextensions.c cxx_extensions.cxx cxxsupport.cxx IndirectPythonInterface.cxx" + local S_OBJS="" + for i in ${S_SRCS}; do + local c_cmd=( + $(tc-getCXX) \ + ${CPPFLAGS} ${CFLAGS} ${ASFLAGS} \ + -I"${S}" -I"${EPREFIX}/usr/include/${EPYTHON}" \ + -fPIC -c ${i} + ) + printf '%s\n' "${c_cmd[*]}" + "${c_cmd[@]}" || die "compile test ${i} failed" + S_OBJS+="../../Src/${i%%.c*}.o " + done + popd || die + pushd Demo/Python3 || die + local D_SRCS="example.cxx range.cxx rangetest.cxx" + local D_OBJS="" + for i in ${D_SRCS}; do + local c_cmd=( + $(tc-getCXX) \ + ${CPPFLAGS} ${CFLAGS} ${ASFLAGS} \ + -I"${S}" -I"${S}"/Demo/Python3 -I"${EPREFIX}/usr/include/${EPYTHON}" \ + -fPIC -c ${i} + ) + printf '%s\n' "${c_cmd[*]}" + "${c_cmd[@]}" || die "compile test ${i} failed" + D_OBJS+="${i%%.c*}.o " + done + local l_example_cmd=( + $(tc-getCXX) \ + ${CPPFLAGS} ${CFLAGS} ${ASFLAGS} \ + -I$"{S}" -I"${S}"/Demo/Python3 -I$"{EPREFIX}/usr/include/${EPYTHON}" \ + -shared -fPIC -o example.so ${S_OBJS} ${D_OBJS} -l${EPYTHON} -ldl + ) + printf '%s\n' "${l_example_cmd[*]}" + "${l_example_cmd[@]}" || die "link test example.so failed" + popd || die + fi +} + +python_test() { + pushd Demo/Python3 || die + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${PWD}" + local cmd=( + "${EPYTHON}" test_example.py + ) + printf '%s\n' "${cmd[*]}" + "${cmd[@]}" || die "test_example failed" + popd || die +} + +python_install() { + distutils-r1_python_install + + # Move misplaced files into place + dodir "/usr/share/${EPYTHON}" + mv "${D}/usr/CXX" "${D}/usr/share/${EPYTHON}/CXX" || die + mv "${D}/usr/include/${EPYTHON}"/{cxx,CXX} || die +} + +python_install_all() { + use doc && local HTML_DOCS=( Doc/. ) + if use examples ; then + docinto examples + dodoc -r Demo/Python3/. + docompress -x /usr/share/doc/${PF}/examples + fi + distutils-r1_python_install_all +} |
