commit: aad83ecda38ba17d8bd1b68d3ae42ceb57b57acd
Author: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 12 09:08:37 2023 +0000
Commit: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Sun Feb 12 09:08:57 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aad83ecd
sci-libs/pytorch: add 1.12.1
Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>
sci-libs/pytorch/Manifest | 1 +
sci-libs/pytorch/pytorch-1.12.1.ebuild | 62 ++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+)
diff --git a/sci-libs/pytorch/Manifest b/sci-libs/pytorch/Manifest
index 013309cd70ce..adfe026eaff0 100644
--- a/sci-libs/pytorch/Manifest
+++ b/sci-libs/pytorch/Manifest
@@ -1 +1,2 @@
DIST pytorch-1.12.0.tar.gz 106286765 BLAKE2B
ff9bafedb35f859f7dccb9b606299cf9c345bdaa0deb87ecfe0c0c30c3c828414d989e1d9a243d9b7cd3f376d56a2f81c241ca2e3c9a8a2b30cddcdeddd3a5c7
SHA512
c9c748a2e0047daaaf199a1ba3198d2d1aee47f664170a9b34ccacd3deeb95f2070e4035eeb900012ef48dc62cf6fb6806f1a1dfe22de8c94892963076e593b7
+DIST pytorch-1.12.1.tar.gz 106311625 BLAKE2B
e8ca19d0e1987449c33ad4c36722a3a467f7f8a9f90be2a7f2de643cbd665038f6802b5ff1f1d3da09b6253d8f29e11549a24295de013d97f73affe538c84c99
SHA512
afeb551904ebd9b5901ae623a98eadbb3045115247cedf8006a940742cfad04e5ce24cfaf363336a9ed88d7ce6a4ac53dbb6a5c690aef6efdf20477c3a22c7ca
diff --git a/sci-libs/pytorch/pytorch-1.12.1.ebuild
b/sci-libs/pytorch/pytorch-1.12.1.ebuild
new file mode 100644
index 000000000000..0948de848ca1
--- /dev/null
+++ b/sci-libs/pytorch/pytorch-1.12.1.ebuild
@@ -0,0 +1,62 @@
+# Copyright 2022-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{9,10} )
+DISTUTILS_SINGLE_IMPL=1
+inherit distutils-r1
+
+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"
+RESTRICT="test"
+
+REQUIRED_USE=${PYTHON_REQUIRED_USE}
+RDEPEND="
+ ${PYTHON_DEPS}
+ ~sci-libs/caffe2-${PV}[${PYTHON_SINGLE_USEDEP}]
+ $(python_gen_cond_dep '
+ dev-python/typing-extensions[${PYTHON_USEDEP}]
+ ')
+"
+DEPEND="${RDEPEND}
+ $(python_gen_cond_dep '
+ dev-python/pyyaml[${PYTHON_USEDEP}]
+ ')
+"
+
+src_prepare() {
+ eapply \
+
"${FILESDIR}"/0002-Don-t-build-libtorch-again-for-PyTorch-1.7.1.patch \
+
"${FILESDIR}"/pytorch-1.9.0-Change-library-directory-according-to-CMake-build.patch
\
+ "${FILESDIR}"/${PN}-1.6.0-global-dlopen.patch \
+ "${FILESDIR}"/pytorch-1.7.1-torch_shm_manager.patch \
+ "${FILESDIR}"/pytorch-1.12.0-CVE-2022-45907.patch
+
+ # Set build dir for pytorch's setup
+ sed -i \
+ -e "/BUILD_DIR/s|build|/var/lib/caffe2/|" \
+ tools/setup_helpers/env.py \
+ || die
+ distutils-r1_src_prepare
+}
+
+src_compile() {
+ PYTORCH_BUILD_VERSION=${PV} \
+ PYTORCH_BUILD_NUMBER=0 \
+ USE_SYSTEM_LIBS=ON \
+ CMAKE_BUILD_DIR="${BUILD_DIR}" \
+ BUILD_DIR= \
+ distutils-r1_src_compile
+}
+
+src_install() {
+ USE_SYSTEM_LIBS=ON distutils-r1_src_install
+}