# Tests by default. No tests: rpm -ba --define 'dotests 0' *.spec %{!?dotests: %define dotests 0} %global __tar /opt/freeware/bin/tar %global name onnx %global version 1.13.0 %global release 1 %global python_pkg %{name}-python3 #python related configs %global py_major 3.9 %global py_minor 16 %global python_major python%{py_major} %global python3_sitearch %(%{python_major} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(0))") %global python3_sitearch64 %(%{python_major} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))") Summary: Open standard for machine learning interoperability Name: %{name} Version: %{version} Release: %{release}_beta License: Apache-2.0 license (ASL) Group: Development/Libraries URL: https://onnx.ai/ Source0: https://github.com/onnx/onnx/archive/refs/tags/v%{version}.tar.gz Source1: https://github.com/pybind/pybind11/archive/refs/tags/v2.10.1.tar.gz Patch0: onnx-helper.patch BuildRequires: gcc >= 10 BuildRequires: gcc-c++ >= 10 BuildRequires: cmake >= 3.24 BuildRequires: zlib-devel >= 1.2.13 Requires: libstdc++ >= 10 Requires: libgcc >= 10 Requires: zlib >= 1.2.13 %global onnx_description \ Open Neural Network Exchange (ONNX) is an open ecosystem that empowers AI developers to choose the right tools as their project evolves. \ ONNX provides an open source format for AI models, both deep learning and traditional ML. \ It defines an extensible computation graph model, as well as definitions of built-in operators and standard data types. Currently we focus on the capabilities needed for inferencing (scoring) %description %{onnx_description} %package -n %{python_pkg} Summary: %{summary} Group: Development/Libraries/Python BuildRequires: gcc >= 10 BuildRequires: gcc-c++ >= 10 BuildRequires: cmake >= 3.24 BuildRequires: zlib-devel >= 1.2.13 BuildRequires: %{python_major}-devel >= %{py_major}.%{py_minor} BuildRequires: %{python_major}-setuptools >= 65.2.0 BuildRequires: %{python_major}-pip >= 22.2.2 BuildRequires: protobuf-devel >= 3.20.2 BuildRequires: protobuf-lite >= 3.20.2 Requires: libstdc++ >= 10 Requires: libgcc >= 10 Requires: zlib >= 1.2.13 Requires: %{python_major} >= %{py_major}.%{py_minor} Requires: %{python_major}-numpy >= 1.21.2-2 Requires: protobuf-python3 >= 3.20.2 Requires: protobuf-lite >= 3.20.2 %description -n %{python_pkg} %{onnx_description} %prep %setup -n onnx-%{version} %patch0 -p6 %{__tar} -xvf %{SOURCE1} --strip 1 -C third_party/pybind11/ %build #env exports export OBJECT_MODE=64 export CC="/opt/freeware/bin/gcc -pthread -maix64 " export CXX="/opt/freeware/bin/g++ -pthread -maix64 " export CPPFLAGS="-I/opt/freeware/include" export CFLAGS="${CPPFLAGS} -maltivec -mvsx -Wl,-bbigtoc -Wno-unused-variable -Wno-unused-parameter -Wno-sign-compare -Wl,-berok" export CXXFLAGS="${CPPFLAGS} -maltivec -mvsx -Wl,-bbigtoc -Wno-unused-variable -Wno-unused-parameter -Wno-sign-compare -Wl,-berok" export LDFLAGS="-L/opt/freeware/lib/pthread -L/opt/freeware/lib64 -L/opt/freeware/lib -lpthread -l%{python_major}" export CMAKE_ARGS="-DONNX_USE_LITE_PROTO=ON -DONNX_USE_PROTOBUF_SHARED_LIBS=ON -DBUILD_ONNX_PYTHON=ON" %{python_major} setup.py build %install #env exports export OBJECT_MODE=64 export CC="/opt/freeware/bin/gcc -pthread -maix64 " export CXX="/opt/freeware/bin/g++ -pthread -maix64 " export CPPFLAGS="-I/opt/freeware/include" export CFLAGS="${CPPFLAGS} -maltivec -mvsx -Wl,-bbigtoc -Wno-unused-variable -Wno-unused-parameter -Wno-sign-compare -Wl,-berok" export CXXFLAGS="${CPPFLAGS} -maltivec -mvsx -Wl,-bbigtoc -Wno-unused-variable -Wno-unused-parameter -Wno-sign-compare -Wl,-berok" export LDFLAGS="-L/opt/freeware/lib/pthread -L/opt/freeware/lib64 -L/opt/freeware/lib -lpthread -l%{python_major}" %{python_major} setup.py install \ --prefix=%{_prefix} \ --install-data=$RPM_BUILD_ROOT \ --root $RPM_BUILD_ROOT \ --record=INSTALLED_FILES %check %files -n %{python_pkg} %defattr(-,root,system,-) %doc LICENSE VERSION_NUMBER README.md docs/* %{_bindir}/* %{python3_sitearch64}/* %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %changelog * Tue May 9 2023 Ranjit Ranjan 1.13.0-1 - Port on AIX