From 3d2a6361adcb915aa421e2846654b3f28df3d1df Mon Sep 17 00:00:00 2001 From: Pavel Sobolev Date: Sat, 15 Aug 2026 15:56:14 +0300 Subject: [PATCH] sci-libs/onnxruntime: add 1.29.0 Signed-off-by: Pavel Sobolev --- sci-libs/onnxruntime/Manifest | 1 + .../onnxruntime/onnxruntime-1.29.0.ebuild | 188 ++++++++++++++++++ 2 files changed, 189 insertions(+) create mode 100644 sci-libs/onnxruntime/onnxruntime-1.29.0.ebuild diff --git a/sci-libs/onnxruntime/Manifest b/sci-libs/onnxruntime/Manifest index 002f4cf7e8..a7a116549b 100644 --- a/sci-libs/onnxruntime/Manifest +++ b/sci-libs/onnxruntime/Manifest @@ -1,3 +1,4 @@ DIST eigen-3.4.0_p20250216.tar.bz2 2272941 BLAKE2B c86764a5c31b978d09f9f8f458a982fb16c2cdfd053e0c7a371fbe5b9c64bead42c25fb7d4cb795eb5ee7ff1800bb51fac6783ad0881dd69dee5d463ccd213e3 SHA512 3c9fab41bde1ee4b8f5ba21c991a75cc73e104cdb48f3377b5fc51afae8cbb5e891c39e4fd998c5263178a8962b09d9d907b9d125dfddc50bc2ec5171917d6b8 DIST onnxruntime-1.27.1.tar.gz 285765941 BLAKE2B 5e8afa1f389e89a24611241ad6fae3b855b52c8ec6996903ded0e3a4029defc23779b6d182d94beb7f467fb760b8bfc1f9c9e687fa97857b5316117ec935a130 SHA512 2b21f00fdfe2cc971801b85c7ff4a939a58250d849ef276dff77eecf973e3cde505ceb68b00f0f8a30ab3c53070b5e648ff61c1d04669ac61f62e1db83b6aaca DIST onnxruntime-1.28.0.tar.gz 278663126 BLAKE2B 833d30d0a47fa7a5c08012e1417c4e093882b4795a4e471711d4fec12f575b82b548d0afc877e4e981c7c37cc9144418047890f5214c84a618693620c8ec7ddd SHA512 31ee13a8b89f2bfd0c58086258c15b11218a675e577d287d94acc20723b0ca0110458bfaf268d3e9140fe86e9a0fe3f89abbc2d6d347f8ea65624fc0716f14c1 +DIST onnxruntime-1.29.0.tar.gz 277662433 BLAKE2B 194dbcd84eaf4468fe2a7de02943b843023ff81a28d139f283a1822f4491f6fe41360e3545aa04b33bb9db2dac33e1ede35331eebb2f20e9db38a291113ff42c SHA512 9ea05f5279fc93fd243a967f3664aaabe9216f6e3ce9358ead662653984476e9cb0cb950947f31f8602541224c946a3ceac91d7c1990ffe2b8314d61361c300f diff --git a/sci-libs/onnxruntime/onnxruntime-1.29.0.ebuild b/sci-libs/onnxruntime/onnxruntime-1.29.0.ebuild new file mode 100644 index 0000000000..5a2da1f489 --- /dev/null +++ b/sci-libs/onnxruntime/onnxruntime-1.29.0.ebuild @@ -0,0 +1,188 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{12..15} ) + +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}] + sci-ml/onnx[${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_gen_any_dep 'sci-ml/onnx[${PYTHON_USEDEP}]') + + python? ( dev-python/pytest[${PYTHON_USEDEP}] ) + ) +" + +PATCHES=( + "${FILESDIR}/${PN}-1.22.2-relax-the-dependency-on-flatbuffers.patch" + "${FILESDIR}/${PN}-1.24.4-no-werror.patch" + "${FILESDIR}/${PN}-1.26.0-r1-prevent-generation-of-PIE.patch" + "${FILESDIR}/${PN}-1.28.0-use-system-libraries.patch" +) + +CMAKE_USE_DIR="${S}/cmake" + +# The `$(python_get_sitedir)/onnx/onnx-ml.proto` file is used during tests +python_check_deps() { + ! use test && return 0 + python_has_version "sci-ml/onnx[${PYTHON_USEDEP}]" +} + +src_configure() { + # Python is used at build time unconditionally + python_setup + + local mycmakeargs=( + -Donnxruntime_BUILD_SHARED_LIB=on + -Donnxruntime_USE_TELEMETRY=OFF + + -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 + + if use python; then + python_foreach_impl cmake_src_configure + else + cmake_src_configure + fi +} + +src_compile() { + if use python; then + python_foreach_impl cmake_src_compile + else + cmake_src_compile + fi +} + +# Adapted from `run_onnxruntime_tests` in `tools/ci_build/build.py` +python_test() { + cd "${BUILD_DIR}" || 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() { + # https://bugs.gentoo.org/975584 + local GTEST_SKIP_TESTS=( + "ActivationOpNoInfTest.Softsign" + "ConvTransposeTest.ConvTranspose_InvalidKernelShape" + "GraphTransformationTests.GatherToSliceFusion" + "LabelEncoder.RejectsInMemoryExternalDataInKeysTensorOpset4" + "MLOpTest.TreeEnsembleRegressorRejectsInMemoryExternalDataInTensorAttribute" + "MLOpTest.TreeEnsembleRejectsInMemoryExternalDataInTensorAttribute" + "NhwcTransformerTests.ConvFloat_UsesNhwcOnlyWithKleidi" + "Random.MultinomialDefaultDType" + "Random.MultinomialGoodCase" + "SamplingTest.Gpt2Sampling_CPU" + "SignalOpsTest.DFT17_2D_complex_onesided_inverse" + "SignalOpsTest.DFT17_IRFFT_naive" + "SignalOpsTest.DFT17_IRFFT_radix2" + "SignalOpsTest.DFT17_RFFT_IRFFT_roundtrip" + "SignalOpsTest.DFT20_2D_complex_onesided_inverse" + "SignalOpsTest.DFT20_IRFFT_naive" + "SignalOpsTest.DFT20_IRFFT_radix2" + "SignalOpsTest.DFT20_IRFFT_underprovided_spectrum_prime" + "SignalOpsTest.DFT20_RFFT_IRFFT_roundtrip" + ) + local -x GTEST_FILTER="*:-$(IFS=':'; echo "${GTEST_SKIP_TESTS[*]}")" + + if use python; then + python_foreach_impl cmake_src_test + python_foreach_impl python_test + else + cmake_src_test + fi +} + +# There is some custom logic in `setup.py` +python_install() { + cd "${BUILD_DIR}" || die + edo "${EPYTHON}" ../setup.py install \ + --prefix="${EPREFIX}/usr" \ + --root="${D}" + + rm -rf "${D}/$(python_get_sitedir)"/*.egg-info || die + python_optimize +} + +src_install() { + if use python; then + python_foreach_impl cmake_src_install + python_foreach_impl python_install + else + cmake_src_install + fi + + einstalldocs +}