%global pkgvers 0 %global scdate0 20240303 %global schash0 b3a4611861734e0731bbcc2bed1f080139e4988b %global branch0 master %global source0 https://github.com/onnx/optimizer.git %global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}} Name: onnx-optimizer Version: 0.3.19 Release: %{scdate0}.%{pkgvers}.git%{sshort0}%{?dist} Summary: Open Neural Network Exchange Optimizer License: Apache URL: https://github.com/onnx/optimizer BuildRequires: doxygen cmake gcc-c++ pybind11-devel git BuildRequires: python3-devel python3-setuptools python3-pytest-runner onnx-devel %if 0%{?fedora} BuildRequires: protobuf-compat-devel >= 3.21 %else BuildRequires: protobuf-devel %endif %description Open Neural Network Exchange Optimizer %package devel Summary: Development files for onnx Requires: %{name} = %{version}-%{release} %description devel This package contains development files for onnx. %package python3 Summary: Python files for onnx Requires: %{name} = %{version}-%{release} %description python3 This package contains python files for onnx. %prep %setup -T -c -n %{name} git clone --depth 1 -n -b %{branch0} %{source0} . git fetch --depth 1 origin %{schash0} git reset --hard %{schash0} git log --format=fuller %build # ver sed -i 's|VERSION 3.22|VERSION 3.20|g' CMakeLists.txt # ext rm -rf third_party/onnx rm -rf third_party/protobuf sed -i '/third_party\/protobuf/d' CMakeLists.txt sed -i '/add_subdirectory.*(${ONNX_ROOT}/d' CMakeLists.txt sed -i '/Utils.cmake/d' cmake/utils.cmake # ext flags sed -i 's|onnx_optimizer PUBLIC ${ONNX_TARGET_NAME}|onnx_optimizer PUBLIC ${ONNX_TARGET_NAME} protobuf onnx_proto|g' CMakeLists.txt %if 0%{?rhel} sed -i 's|onnx_optimizer PUBLIC ${ONNX_TARGET_NAME}|onnx_optimizer PUBLIC ${ONNX_TARGET_NAME} stdc++fs|g' CMakeLists.txt %endif # build export ONNX_ML=0 export ONNX_NAMESPACE=onnx export CXXFLAGS="%{optflags} -DONNX_NAMESPACE=onnx" export CMAKE_ARGS="-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_SKIP_RPATH=ON -DCMAKE_VERBOSE_MAKEFILE=OFF -DCMAKE_BUILD_TYPE=RelWithDebug" %{__python3} setup.py build %{?_smp_mflags} %install pushd .setuptools-cmake-build make install DESTDIR=%{buildroot} popd export ONNX_ML=0 export ONNX_NAMESPACE=onnx export CXXFLAGS="%{optflags} -DONNX_NAMESPACE=onnx" export CMAKE_ARGS="-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_SKIP_RPATH=ON -DCMAKE_VERBOSE_MAKEFILE=OFF -DCMAKE_BUILD_TYPE=RelWithDebug" %{__python3} setup.py install --root %{buildroot} mkdir -p %{buildroot}/%{_bindir} mkdir -p %{buildroot}/%{_includedir}/onnx ln -sf %{_includedir}/onnxoptimizer %{buildroot}/%{_includedir}/onnx/optimizer install -pm 0755 .setuptools-cmake-build/onnx_optimizer_exec %{buildroot}/%{_bindir}/ sed -i 's|[<=>].*||g' %{buildroot}%{python3_sitearch}/*.egg-info/requires.txt %files %doc README.md %license LICENSE %{_bindir}/* %{_libdir}/lib*.so* %files devel %{_includedir}/* %{_libdir}/cmake/* %files python3 %{python3_sitearch}/* %changelog * Tue Mar 26 2019 Balint Cristian - github update releases