Install this version:
emerge -a =sci-ml/onnx-1.23.2
If this version is masked, you can unmask it using the autounmask tool or standard emerge options:
autounmask =sci-ml/onnx-1.23.2
Or alternatively:
emerge --autounmask-write -a =sci-ml/onnx-1.23.2
| Version | EAPI | Keywords | Slot |
|---|---|---|---|
| 1.23.2 | 8 | ~amd64 | 0 |
# Copyright 2022-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
# 1.23.2 ships no setup.py: pyproject.toml builds with
# scikit-build-core, so the setuptools backend override is gone.
DISTUTILS_USE_PEP517=scikit-build-core
DISTUTILS_EXT=1
# Based on ::gentoo's 1.20.1 ebuild, bumped to 1.23.2; python3_15 added.
# The Python build moved to scikit-build-core (CMake args via DISTUTILS_ARGS)
# and the runtime floors follow pyproject.toml (ml_dtypes>=0.5.4,
# protobuf>=6.31.1).
# BENTOO-DIVERGENCE: IUSE - python3_15 added to PYTHON_COMPAT.
# BENTOO-DIVERGENCE: REQUIRED_USE - python3_15 added to PYTHON_COMPAT.
# BENTOO-DIVERGENCE: DEPEND - python3_15 added; ml-dtypes and protobuf floors from 1.23 pyproject.toml.
# BENTOO-DIVERGENCE: RDEPEND - python3_15 added; ml-dtypes and protobuf floors from 1.23 pyproject.toml.
# BENTOO-DIVERGENCE: BDEPEND - python3_15 added; scikit-build-core replaces setuptools as build backend.
# BENTOO-DIVERGENCE: KEYWORDS - bumped past ::gentoo, so overlay baseline ~amd64 only.
PYTHON_COMPAT=( python3_{11..15} )
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"
IUSE="disableStaticReg"
RESTRICT="test"
RDEPEND="
dev-cpp/abseil-cpp:=
dev-libs/protobuf:=[protoc(+)]
>=dev-python/ml-dtypes-0.5.4[${PYTHON_USEDEP}]
dev-python/numpy[${PYTHON_USEDEP}]
>=dev-python/protobuf-6.31.1[${PYTHON_USEDEP}]
dev-python/typing-extensions[${PYTHON_USEDEP}]
"
DEPEND="${RDEPEND}"
BDEPEND="
dev-python/nanobind[${PYTHON_USEDEP}]
"
src_prepare() {
# 1.23 builds libonnx with hidden visibility and exports only the ONNX_API
# surface. That surface is too small for a shared libonnx: upstream's only
# consumers link a static onnx, and sci-libs/onnxruntime fails at link time
# with ~300 undefined onnx:: references (OpSchema::Attr, DataTypeUtils,
# shape-inference helpers). Export everything, as libonnx did up to 1.20.
# The guard makes a bump that moves the line fail here, not at a consumer.
grep -qF 'set_target_properties(onnx PROPERTIES CXX_VISIBILITY_PRESET hidden)' \
CMakeLists.txt || die "onnx visibility line moved; re-check the export fix"
sed -i -e 's/set_target_properties(onnx PROPERTIES CXX_VISIBILITY_PRESET hidden)/set_target_properties(onnx PROPERTIES CXX_VISIBILITY_PRESET default)/' \
CMakeLists.txt || die
cmake_src_prepare
distutils-r1_src_prepare
}
src_configure() {
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
}
python_compile() {
# 1.23.2's CMakeLists.txt rejects ONNX_BUILD_PYTHON=ON together with
# BUILD_SHARED_LIBS=ON: the extension links a static libonnx of its own,
# while the shared libonnx comes from the plain cmake build above.
local DISTUTILS_ARGS=(
"${mycmakeargs[@]/-DBUILD_SHARED_LIBS=ON/-DBUILD_SHARED_LIBS=OFF}"
-Dnanobind_DIR="$(python_get_sitedir)/nanobind/cmake"
)
# scikit-build-core's build-dir is in-tree (pyproject.toml); never let one
# implementation reuse another's CMake cache.
rm -rf .setuptools-cmake-build || die
distutils-r1_python_compile
}
src_compile() {
cmake_src_compile
distutils-r1_src_compile
}
src_install() {
cmake_src_install
distutils-r1_src_install
}
Manage flags for this package:
euse -i <flag> -p sci-ml/onnx |
euse -E <flag> -p sci-ml/onnx |
euse -D <flag> -p sci-ml/onnx
dev-cpp/abseil-cpp:= dev-libs/protobuf:=[protoc(+)] >=dev-python/ml-dtypes-0.5.4[] dev-python/numpy[] >=dev-python/protobuf-6.31.1[] dev-python/typing-extensions[]
dev-cpp/abseil-cpp:= dev-libs/protobuf:=[protoc(+)] >=dev-python/ml-dtypes-0.5.4[] dev-python/numpy[] >=dev-python/protobuf-6.31.1[] dev-python/typing-extensions[]
dev-python/nanobind[]
| Type | File | Size | Source URLs |
|---|---|---|---|
| DIST | onnx-1.23.2.tar.gz | 7821604 bytes | https://github.com/onnx/onnx/archive/refs/tags/v1.23.2.tar.gz |