[packages/onnx] Initial
arekm
arekm at pld-linux.org
Sun Sep 20 21:37:48 CEST 2026
commit 0d339273a2d4bc3ef9b3ff5e53e016f6066f413d
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Sun Sep 20 21:37:24 2026 +0200
Initial
onnx-soversion.patch | 13 ++++++
onnx.spec | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 125 insertions(+)
---
diff --git a/onnx.spec b/onnx.spec
new file mode 100644
index 0000000..2a3a014
--- /dev/null
+++ b/onnx.spec
@@ -0,0 +1,112 @@
+#
+# Conditional build:
+%bcond_without tests # C++ unit tests
+
+Summary: ONNX - Open Neural Network Exchange
+Summary(pl.UTF-8): ONNX - Open Neural Network Exchange
+Name: onnx
+Version: 1.23.0
+Release: 1
+License: Apache v2.0
+Group: Libraries
+#Source0Download: https://github.com/onnx/onnx/releases
+Source0: https://github.com/onnx/onnx/archive/v%{version}/%{name}-%{version}.tar.gz
+# Source0-md5: f3083c6e2188b5885513d7af9980975c
+Patch0: %{name}-soversion.patch
+URL: https://onnx.ai/
+BuildRequires: cmake >= 3.26
+BuildRequires: libstdc++-devel >= 6:7
+BuildRequires: protobuf
+BuildRequires: protobuf-devel
+BuildRequires: python3 >= 1:3.9
+BuildRequires: rpmbuild(macros) >= 1.605
+%if %{with tests}
+BuildRequires: gtest-devel
+%endif
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+# TLS symbol _ZN6google8protobuf8internal15ThreadSafeArena13thread_cache_E comes from
+# libprotobuf (DT_NEEDED, ldd -r clean); the checker misreads undefined TLS objects
+%define skip_post_check_so libonnx.so.* libonnx_proto.so.*
+
+%description
+ONNX (Open Neural Network Exchange) is an open format for representing
+machine learning models. This package contains the C++ library with
+the ONNX protobuf definitions, operator schemas, shape inference and
+checker.
+
+%description -l pl.UTF-8
+ONNX (Open Neural Network Exchange) to otwarty format reprezentacji
+modeli uczenia maszynowego. Ten pakiet zawiera bibliotekę C++ z
+definicjami protobuf ONNX, schematami operatorów, wnioskowaniem
+kształtów i narzędziem sprawdzającym.
+
+%package devel
+Summary: Header files for ONNX library
+Summary(pl.UTF-8): Pliki nagłówkowe biblioteki ONNX
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: libstdc++-devel >= 6:7
+Requires: protobuf-devel
+
+%description devel
+Header files for ONNX library.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki ONNX.
+
+%prep
+%setup -q
+%patch -P0 -p1
+
+%build
+%if %{with tests}
+# tests link library internals, which the hidden-visibility shared libonnx does not export
+%cmake -B build-static \
+ -DBUILD_SHARED_LIBS=OFF \
+ -DONNX_BUILD_PYTHON=OFF \
+ -DONNX_BUILD_TESTS=ON \
+ -DONNX_ML=ON \
+ -DONNX_USE_LITE_PROTO=OFF \
+ -DONNX_USE_PROTOBUF_SHARED_LIBS=ON
+
+%{__make} -C build-static
+%{__make} -C build-static test
+%endif
+
+%cmake -B build \
+ -DBUILD_SHARED_LIBS=ON \
+ -DONNX_BUILD_PYTHON=OFF \
+ -DONNX_BUILD_TESTS=OFF \
+ -DONNX_ML=ON \
+ -DONNX_USE_LITE_PROTO=OFF \
+ -DONNX_USE_PROTOBUF_SHARED_LIBS=ON
+
+%{__make} -C build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%{__make} -C build install \
+ DESTDIR=$RPM_BUILD_ROOT
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%doc LICENSE README.md
+%{_libdir}/libonnx.so.*.*
+%ghost %{_libdir}/libonnx.so.1
+%{_libdir}/libonnx_proto.so.*.*
+%ghost %{_libdir}/libonnx_proto.so.1
+
+%files devel
+%defattr(644,root,root,755)
+%{_libdir}/libonnx.so
+%{_libdir}/libonnx_proto.so
+%{_includedir}/onnx
+%{_libdir}/cmake/ONNX
diff --git a/onnx-soversion.patch b/onnx-soversion.patch
new file mode 100644
index 0000000..7f8f595
--- /dev/null
+++ b/onnx-soversion.patch
@@ -0,0 +1,13 @@
+Give the shared libraries a soversion; upstream sets none (their wheels only
+ever link onnx statically). Debian's libonnx1 makes the same choice.
+
+--- onnx-1.23.0/CMakeLists.txt.orig 2026-09-18 20:19:41.000000000 +0200
++++ onnx-1.23.0/CMakeLists.txt 2026-09-20 20:43:17.230829154 +0200
+@@ -711,5 +711,7 @@
+ include(${ONNX_ROOT}/cmake/unittest.cmake)
+ endif()
+
++set_target_properties(onnx onnx_proto PROPERTIES VERSION ${ONNX_VERSION} SOVERSION 1)
++
+ include(cmake/summary.cmake)
+ onnx_print_configuration_summary()
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/onnx.git/commitdiff/0d339273a2d4bc3ef9b3ff5e53e016f6066f413d
More information about the pld-cvs-commit
mailing list