diff --git a/sci-libs/onnxruntime/Manifest b/sci-libs/onnxruntime/Manifest index 9570730864..4941c0a95a 100644 --- a/sci-libs/onnxruntime/Manifest +++ b/sci-libs/onnxruntime/Manifest @@ -1,2 +1,3 @@ DIST eigen-3.4.0_p20250216.tar.bz2 2272941 BLAKE2B c86764a5c31b978d09f9f8f458a982fb16c2cdfd053e0c7a371fbe5b9c64bead42c25fb7d4cb795eb5ee7ff1800bb51fac6783ad0881dd69dee5d463ccd213e3 SHA512 3c9fab41bde1ee4b8f5ba21c991a75cc73e104cdb48f3377b5fc51afae8cbb5e891c39e4fd998c5263178a8962b09d9d907b9d125dfddc50bc2ec5171917d6b8 DIST onnxruntime-1.24.3.tar.gz 283631211 BLAKE2B 14de894e0d69fb51679186756bf2d0cbb8e5429f7553866d8aedebdc0fabae76fd7ea5f95c9da8b449a7411dc6d91a5974717a98f67cf445ef893285f7614c95 SHA512 1c4108d0a2cbcbbc24186914f954751afdac347c36a3a97b95b3daf0c9cf4b98d07d1fde4dfbc37a107acbdd658f88eff310c22fe8dd73266c6a9a7817af3c49 +DIST onnxruntime-1.24.4.tar.gz 283642312 BLAKE2B f6d964c73fb1e5ad92643473b8e5ebede824cf558714600d3a99a105d282e2374f8b22f13ed506f13dad553c55ed099e8dca7899301c8a1737a21e55e4fcb890 SHA512 53b3aed02e085c83aa3c7e1faffeae7f70675d6770bc44d148085ded47940f29471eef76e0c4565bbb471f0f814610e0d1892ce9305c63d011fe851a22b1f7ab diff --git a/sci-libs/onnxruntime/onnxruntime-1.24.4.ebuild b/sci-libs/onnxruntime/onnxruntime-1.24.4.ebuild new file mode 100644 index 0000000000..48979af06d --- /dev/null +++ b/sci-libs/onnxruntime/onnxruntime-1.24.4.ebuild @@ -0,0 +1,147 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{12..13} ) + +inherit cmake edo flag-o-matic python-r1 + +EIGEN_COMMIT="1d8b82b0740839c0de7f1242a3585e3390ff5f33" + +DESCRIPTION="Cross-platform, high performance ML inferencing and training accelerator" +HOMEPAGE=" + https://onnxruntime.ai + https://github.com/microsoft/onnxruntime +" +SRC_URI=" + https://github.com/microsoft/onnxruntime/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz + https://gitlab.com/libeigen/eigen/-/archive/${EIGEN_COMMIT}/eigen-${EIGEN_COMMIT}.tar.bz2 -> + eigen-3.4.0_p20250216.tar.bz2 +" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64" +IUSE="python test" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" +RESTRICT="!test? ( test )" + +RDEPEND=" + dev-cpp/abseil-cpp:= + dev-libs/cpuinfo + dev-libs/protobuf:= + dev-libs/re2:= + sci-ml/onnx[disableStaticReg] + + python? ( + ${PYTHON_DEPS} + dev-python/coloredlogs[${PYTHON_USEDEP}] + dev-python/flatbuffers[${PYTHON_USEDEP}] + >=dev-python/numpy-2[${PYTHON_USEDEP}] + dev-python/packaging[${PYTHON_USEDEP}] + dev-python/protobuf[${PYTHON_USEDEP}] + dev-python/sympy[${PYTHON_USEDEP}] + ) +" +DEPEND=" + ${RDEPEND} + dev-cpp/ms-gsl + dev-cpp/nlohmann_json + dev-cpp/safeint + dev-libs/boost + dev-libs/date + dev-libs/flatbuffers + + python? ( + dev-python/pybind11[${PYTHON_USEDEP}] + sci-libs/dlpack + ) +" +BDEPEND=" + ${PYTHON_DEPS} + + test? ( + dev-cpp/gtest + + python? ( dev-python/pytest[${PYTHON_USEDEP}] ) + ) +" + +PATCHES=( + "${FILESDIR}/${PN}-1.22.2-relax-the-dependency-on-flatbuffers.patch" + "${FILESDIR}/${PN}-1.24.3-use-system-libraries.patch" +) + +CMAKE_USE_DIR="${S}/cmake" + +src_configure() { + # Python is used at build time unconditionally + python_setup + + local mycmakeargs=( + -Donnxruntime_BUILD_SHARED_LIB=on + + -Donnxruntime_BUILD_UNIT_TESTS=$(usex test) + -Donnxruntime_ENABLE_PYTHON=$(usex python) + + # This is required until a newer version of Eigen3 comes out + -DFETCHCONTENT_SOURCE_DIR_EIGEN3="${WORKDIR}/eigen-${EIGEN_COMMIT}" + + # This makes it possible for `find_path` to find the `onnx-ml.proto` file + -DCMAKE_INCLUDE_PATH="$(python_get_sitedir)" + + -Wno-dev + ) + + append-ldflags -Wl,-z,noexecstack + cmake_src_configure +} + +# Adapted from `run_onnxruntime_tests` in `tools/ci_build/build.py` +python_test() { + cd "${S}/cmake_build" || die + epytest --pyargs \ + onnxruntime_test_python.py \ + onnxruntime_test_python_backend.py \ + onnxruntime_test_python_mlops.py \ + onnxruntime_test_python_sparse_matmul.py +} + +src_test() { + local -x GTEST_FILTER="*:-ActivationOpNoInfTest.Softsign:LayoutTransformationPotentiallyAddedOpsTests.OpsHaveLatestVersions" + cmake_src_test + + if use python ; then + python_test + fi +} + +# There is some custom logic in `setup.py` +python_install() { + cd "${S}/cmake_build" || die + edo "${EPYTHON}" ../setup.py install \ + --prefix="${EPREFIX}/usr" \ + --root="${D}" + + local libs=( + "libonnxruntime.so.${PV}" + "libonnxruntime_providers_shared.so" + ) + for lib in "${libs[@]}"; do + ln -fsr "${ED}/usr/$(get_libdir)/${lib}" "${D}/$(python_get_sitedir)/onnxruntime/capi/${lib}" || die + done + + rm -rf "${D}/$(python_get_sitedir)"/*.egg-info || die + python_optimize +} + +src_install() { + cmake_src_install + + if use python ; then + python_foreach_impl python_install + fi + + dodoc "${S}/"{README.md,LICENSE} +}