commit:     a3380e05cc3bf05ef227c05c52fe764433e54d8d
Author:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Sat May  4 18:18:43 2024 +0000
Commit:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Sat May  4 18:23:29 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a3380e05

sci-libs/onnx: fix unresolved symbol

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

 sci-libs/onnx/files/onnx-1.15.0-hidden.patch       | 10 +++++
 ...onnx-1.15.0-r1.ebuild => onnx-1.15.0-r2.ebuild} | 45 +++++++++++-----------
 2 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/sci-libs/onnx/files/onnx-1.15.0-hidden.patch 
b/sci-libs/onnx/files/onnx-1.15.0-hidden.patch
new file mode 100644
index 000000000000..b500c01a91bc
--- /dev/null
+++ b/sci-libs/onnx/files/onnx-1.15.0-hidden.patch
@@ -0,0 +1,10 @@
+--- a/CMakeLists.txt   2024-05-04 19:39:17.464135798 +0200
++++ b/CMakeLists.txt   2024-05-04 19:39:23.155068064 +0200
+@@ -496,7 +496,6 @@
+ else()
+   # On non-Windows, hide all symbols we don't need
+   set(ONNX_API_DEFINE 
"-DONNX_API=__attribute__\(\(__visibility__\(\"default\"\)\)\)")
+-  set_target_properties(onnx_proto PROPERTIES CXX_VISIBILITY_PRESET hidden)
+   set_target_properties(onnx_proto PROPERTIES VISIBILITY_INLINES_HIDDEN 1)
+ endif()
+ target_compile_definitions(onnx_proto PRIVATE ${ONNX_API_DEFINE})

diff --git a/sci-libs/onnx/onnx-1.15.0-r1.ebuild 
b/sci-libs/onnx/onnx-1.15.0-r2.ebuild
similarity index 60%
rename from sci-libs/onnx/onnx-1.15.0-r1.ebuild
rename to sci-libs/onnx/onnx-1.15.0-r2.ebuild
index 8e846b3e6d5f..63e8ab1695e9 100644
--- a/sci-libs/onnx/onnx-1.15.0-r1.ebuild
+++ b/sci-libs/onnx/onnx-1.15.0-r2.ebuild
@@ -3,6 +3,7 @@
 
 EAPI=8
 DISTUTILS_USE_PEP517=setuptools
+DISTUTILS_OPTIONAL=1
 DISTUTILS_EXT=1
 PYTHON_COMPAT=( python3_{9..12} )
 inherit distutils-r1 cmake
@@ -15,49 +16,47 @@ 
SRC_URI="https://github.com/onnx/${PN}/archive/refs/tags/v${PV}.tar.gz
 LICENSE="Apache-2.0"
 SLOT="0"
 KEYWORDS="~amd64 ~riscv"
+IUSE="python"
 RESTRICT="test"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
 
 RDEPEND="
-       dev-python/protobuf-python[${PYTHON_USEDEP}]
-       dev-python/pybind11[${PYTHON_USEDEP}]
+       python? (
+               ${PYTHON_DEPS}
+               dev-python/protobuf-python[${PYTHON_USEDEP}]
+               dev-python/pybind11[${PYTHON_USEDEP}]
+       )
        dev-libs/protobuf:=
 "
 DEPEND="${RDEPEND}"
 
+BDEPEND="python? (
+       ${DISTUTILS_DEPS}
+)"
+
+PATCHES=( "${FILESDIR}"/${P}-hidden.patch )
+
 src_prepare() {
        cmake_src_prepare
-       distutils-r1_src_prepare
+       use python && distutils-r1_src_prepare
 }
 
-python_configure_all() {
+src_configure() {
        mycmakeargs=(
                -DONNX_USE_PROTOBUF_SHARED_LIBS=ON
                -DONNX_USE_LITE_PROTO=ON
+               -DONNX_BUILD_SHARED_LIBS=ON
        )
        cmake_src_configure
-}
-
-src_configure() {
-       distutils-r1_src_configure
-}
-
-python_compile_all() {
-       cmake_src_compile
+       use python && distutils-r1_src_configure
 }
 
 src_compile() {
-       mycmakeargs=(
-               -DONNX_USE_PROTOBUF_SHARED_LIBS=ON
-               -DONNX_USE_LITE_PROTO=ON
-       )
-       CMAKE_ARGS="${mycmakeargs[@]}" distutils-r1_src_compile
-}
-
-python_install_all() {
-       cmake_src_install
-       distutils-r1_python_install_all
+       cmake_src_compile
+       use python && CMAKE_ARGS="${mycmakeargs[@]}" distutils-r1_src_compile
 }
 
 src_install() {
-       distutils-r1_src_install
+       cmake_src_install
+       use python && distutils-r1_src_install
 }

Reply via email to