commit:     6df9172f08ac3a6ede289333dc024b8d987b3fda
Author:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  2 21:07:00 2025 +0000
Commit:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Sat Aug  2 21:07:19 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6df9172f

sci-ml/onnx: add 1.18.0

Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>

 sci-ml/onnx/Manifest                      |  1 +
 sci-ml/onnx/files/onnx-1.18.0-cmake.patch | 36 +++++++++++++++
 sci-ml/onnx/onnx-1.18.0.ebuild            | 73 +++++++++++++++++++++++++++++++
 3 files changed, 110 insertions(+)

diff --git a/sci-ml/onnx/Manifest b/sci-ml/onnx/Manifest
index fa2e1368a5ce..9be6c0a2cbbc 100644
--- a/sci-ml/onnx/Manifest
+++ b/sci-ml/onnx/Manifest
@@ -1,2 +1,3 @@
 DIST onnx-1.16.2.tar.gz 12429500 BLAKE2B 
1541fd9e80e305bc0764d1f5d236a89a2f0d0d8819bd6f235c88d35985daf02f575854a537af193befbeab861b2fe6a9d5b8803975b8ae6a47d5d5a6dc28b661
 SHA512 
7a9a8493b9c007429629484156487395044506f34e72253640e626351cb623b390750b36af78a290786131e3dcac35f4eb269e8693b594b7ce7cb105bcf9318d
 DIST onnx-1.17.0.tar.gz 12475304 BLAKE2B 
17e3cdd4bf101749ba841599d1b4e89ad80cfa3de6adabc10491f84ec928c385b1fe517e32657b24ca57d14780d51cc9a641860c06194cec082d9a9950004c8c
 SHA512 
5a18e2b19ec9c18c8b115fb7e12ed98eddaa581c95f15c4dd420cd6c86e7caa04f9a393da589e76b89cf9b3544abd3749a8c77c2446782f37502eb74e9b1f661
+DIST onnx-1.18.0.tar.gz 12826788 BLAKE2B 
7b48cf4017816c4ba926cc4bfcaf3b95d4630421e71e70f3f5ce47f2a9e152e1fa26ca1b407a198216fe777daf014546e35ce7ab06f47ddcebb5d71ee79e834c
 SHA512 
2f38664947c8d1efc40620a7c1b1953d2aa4b0a37b67c4886b86e77c1d697363c26413413ddda8eabc545892fb1bcb43afc7e93e62f0901527524a2727e1ea8d

diff --git a/sci-ml/onnx/files/onnx-1.18.0-cmake.patch 
b/sci-ml/onnx/files/onnx-1.18.0-cmake.patch
new file mode 100644
index 000000000000..e79a10b56121
--- /dev/null
+++ b/sci-ml/onnx/files/onnx-1.18.0-cmake.patch
@@ -0,0 +1,36 @@
+--- a/CMakeLists.txt   2025-08-02 22:16:37.819326103 +0200
++++ b/CMakeLists.txt   2025-08-02 22:23:45.495251935 +0200
+@@ -531,10 +531,11 @@
+ add_onnx_global_defines(onnx)
+ 
+ if(ONNX_BUILD_PYTHON)
+-  Python3_add_library(onnx_cpp2py_export MODULE WITH_SOABI 
"${ONNX_ROOT}/onnx/cpp2py_export.cc")
++  add_library(onnx_cpp2py_export MODULE "${ONNX_ROOT}/onnx/cpp2py_export.cc")
+   set_target_properties(onnx_cpp2py_export PROPERTIES PREFIX "")
+   set_target_properties(onnx_cpp2py_export PROPERTIES CXX_VISIBILITY_PRESET 
hidden)
+   set_target_properties(onnx_cpp2py_export PROPERTIES 
VISIBILITY_INLINES_HIDDEN ON)
++  set_target_properties(onnx_cpp2py_export PROPERTIES SUFFIX ${PY_EXT_SUFFIX})
+   set_target_properties(onnx_cpp2py_export
+                         PROPERTIES LIBRARY_OUTPUT_DIRECTORY 
${CMAKE_BINARY_DIR})
+   target_include_directories(onnx_cpp2py_export PRIVATE
+--- a/setup.py 2025-08-02 22:16:43.509352511 +0200
++++ b/setup.py 2025-08-02 22:23:50.189272010 +0200
+@@ -93,6 +93,10 @@
+         os.chdir(orig_path)
+ 
+ 
++def get_ext_suffix():
++    return sysconfig.get_config_var("EXT_SUFFIX")
++
++
+ def get_python_execute():
+     if WINDOWS:
+         return sys.executable
+@@ -173,6 +177,7 @@
+                 f"-DPython3_EXECUTABLE={get_python_execute()}",
+                 "-DONNX_BUILD_PYTHON=ON",
+                 f"-DONNX_NAMESPACE={ONNX_NAMESPACE}",
++                f"-DPY_EXT_SUFFIX={get_ext_suffix() or ''}",
+             ]
+             if COVERAGE:
+                 cmake_args.append("-DONNX_COVERAGE=ON")

diff --git a/sci-ml/onnx/onnx-1.18.0.ebuild b/sci-ml/onnx/onnx-1.18.0.ebuild
new file mode 100644
index 000000000000..4b42678fbd58
--- /dev/null
+++ b/sci-ml/onnx/onnx-1.18.0.ebuild
@@ -0,0 +1,73 @@
+# Copyright 2022-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+DISTUTILS_UPSTREAM_PEP517=standalone
+DISTUTILS_USE_PEP517=setuptools
+DISTUTILS_EXT=1
+PYTHON_COMPAT=( python3_{11..14} )
+inherit distutils-r1 cmake
+
+DESCRIPTION="Open Neural Network Exchange (ONNX)"
+HOMEPAGE="https://github.com/onnx/onnx";
+SRC_URI="https://github.com/onnx/${PN}/archive/refs/tags/v${PV}.tar.gz
+       -> ${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~riscv"
+IUSE="disableStaticReg"
+RESTRICT="test"
+
+RDEPEND="
+       dev-cpp/abseil-cpp:=
+       dev-libs/protobuf:=[protoc(+)]
+       dev-python/protobuf[${PYTHON_USEDEP}]
+       dev-python/pybind11[${PYTHON_USEDEP}]
+"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+       eapply "${FILESDIR}"/${PN}-1.15.0-hidden.patch \
+               "${FILESDIR}"/${PN}-1.18.0-cmake.patch
+       cmake_src_prepare
+       distutils-r1_src_prepare
+}
+
+python_configure_all()
+{
+       mycmakeargs=(
+               -DONNX_USE_PROTOBUF_SHARED_LIBS=ON
+               -DONNX_USE_LITE_PROTO=ON
+               -DBUILD_SHARED_LIBS=ON
+               -DONNX_DISABLE_STATIC_REGISTRATION=$(usex disableStaticReg ON 
OFF)
+       )
+       cmake_src_configure
+}
+
+src_configure() {
+       distutils-r1_src_configure
+}
+
+src_compile() {
+       mycmakeargs=(
+               -DONNX_USE_PROTOBUF_SHARED_LIBS=ON
+               -DONNX_USE_LITE_PROTO=ON
+               -DBUILD_SHARED_LIBS=ON
+               -DONNX_DISABLE_STATIC_REGISTRATION=$(usex disableStaticReg ON 
OFF)
+       )
+       CMAKE_ARGS="${mycmakeargs[@]}" distutils-r1_src_compile
+}
+
+python_compile_all() {
+       cmake_src_compile
+}
+
+python_install_all() {
+       cmake_src_install
+       distutils-r1_python_install_all
+}
+
+src_install() {
+       distutils-r1_src_install
+}

Reply via email to