commit: 40e75b9d4fd3935ea0a0e9824fea10b3aa46a0b4
Author: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 16 18:29:21 2025 +0000
Commit: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Sat Aug 16 18:29:39 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=40e75b9d
sci-ml/pytorch: add 2.8.0
Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>
sci-ml/pytorch/Manifest | 1 +
sci-ml/pytorch/pytorch-2.8.0.ebuild | 74 +++++++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+)
diff --git a/sci-ml/pytorch/Manifest b/sci-ml/pytorch/Manifest
index c9a5bc44aa54..0e43c5a2918f 100644
--- a/sci-ml/pytorch/Manifest
+++ b/sci-ml/pytorch/Manifest
@@ -2,3 +2,4 @@ DIST pytorch-2.5.1.tar.gz 116091366 BLAKE2B
7838b17562b94ffc7d798031348689db607d
DIST pytorch-2.6.0.tar.gz 119594438 BLAKE2B
3152eb341cf42295e147e59625beb9c06608aa4b78f9618c1c0024b10c1c767715d07fe8c4be52d029ac47f808cd0d5e65c9530ec90d951a64b993083b4067ad
SHA512
a70da80ff09d226085e18228132cf6bb236ad8cc47eed52375d0d2a615f09dd33849da947270b5670c184eab60cb8e2adf11d801babfbda7aa621400501d07b0
DIST pytorch-2.7.0.tar.gz 50197290 BLAKE2B
2a317d1e9b0d8876f1593382246cd9f786eff3c1b8602353c5e0010dc8414720c5de61886361843a0c33268830c784963a89b410b361e1b67636e652f6a6a2eb
SHA512
63eb0363ea68d23567f5524ee8b51756d9302bbe1cbefa367335ab5ebe652523dba75fa417ea3e7eedfc67aa4bef1434c8b7e3dfde2152061b91b6e489763a55
DIST pytorch-2.7.1.tar.gz 50203605 BLAKE2B
3f4b2643d86fe9ff30b2f335353dfe6a8e222bcc12143bc5d09268fb37bfd42f9451620e6e0db225c3c3e7930c999115fdd2ed62b7eae93b0d5e233270c7c760
SHA512
a9fc2252af9031c2cd46dde558c491aea8bc322fb80157a7760f300a44b759d4bfe866f030fbb974b80493057cfff4dd512498f99a100ed6d05bf620258ed37e
+DIST pytorch-2.8.0.tar.gz 56565754 BLAKE2B
a8f07513b92f9293f8322508f9fc73a462f89fe51cb1f280af371cee19cbe7e2bf900ba2b3c43fd08ea415566db441a6d6310d77f18477e957641be311a361a5
SHA512
448e9dad4aa10f1793d35e6ffe9f0f69b7719d41e6eccceb687a8d0c148e22d03e4f76170a05308ef9323a7aea41aa74605077ae1d68c6d949f13b3340ebf310
diff --git a/sci-ml/pytorch/pytorch-2.8.0.ebuild
b/sci-ml/pytorch/pytorch-2.8.0.ebuild
new file mode 100644
index 000000000000..0988d3784ce9
--- /dev/null
+++ b/sci-ml/pytorch/pytorch-2.8.0.ebuild
@@ -0,0 +1,74 @@
+# Copyright 2022-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{11..13} )
+DISTUTILS_SINGLE_IMPL=1
+DISTUTILS_EXT=1
+inherit distutils-r1 prefix
+
+DESCRIPTION="Tensors and Dynamic neural networks in Python"
+HOMEPAGE="https://pytorch.org/"
+SRC_URI="https://github.com/pytorch/${PN}/archive/refs/tags/v${PV}.tar.gz
+ -> ${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64"
+RESTRICT="test"
+
+REQUIRED_USE=${PYTHON_REQUIRED_USE}
+RDEPEND="
+ ${PYTHON_DEPS}
+ ~sci-ml/caffe2-${PV}[${PYTHON_SINGLE_USEDEP}]
+ $(python_gen_cond_dep '
+ dev-python/sympy[${PYTHON_USEDEP}]
+ dev-python/typing-extensions[${PYTHON_USEDEP}]
+ ')
+"
+DEPEND="${RDEPEND}
+ $(python_gen_cond_dep '
+ dev-python/pyyaml[${PYTHON_USEDEP}]
+ ')
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.6.0-dontbuildagain.patch
+ "${FILESDIR}"/${PN}-2.7.1-cpp-extension-libcxx.patch
+ "${FILESDIR}"/${PN}-2.7.1-cpp-extension-multilib.patch
+)
+
+src_prepare() {
+ # Replace placeholders added by cpp-extension.patch
+ sed -e "s|%LIB_DIR%|$(get_libdir)|g" \
+ -i torch/utils/cpp_extension.py || die
+
+ # Set build dir for pytorch's setup
+ sed -e "/BUILD_DIR/s|build|/var/lib/caffe2/|" \
+ -i tools/setup_helpers/env.py || die
+
+ # Drop legacy from pyproject.toml
+ sed -e "/build-backend/s|:__legacy__||" \
+ -i pyproject.toml || die
+
+ distutils-r1_src_prepare
+
+ # Get object file from caffe2
+ cp "${ESYSROOT}"/var/lib/caffe2/functorch.so functorch/functorch.so ||
die
+
+ hprefixify tools/setup_helpers/env.py
+}
+
+python_compile() {
+ PYTORCH_BUILD_VERSION=${PV} \
+ PYTORCH_BUILD_NUMBER=0 \
+ USE_SYSTEM_LIBS=ON \
+ CMAKE_BUILD_DIR="${BUILD_DIR}" \
+ distutils-r1_python_compile develop sdist
+}
+
+python_install() {
+ USE_SYSTEM_LIBS=ON distutils-r1_python_install
+}