# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. # Disable build id note requirement for now %undefine _missing_build_ids_terminate_build # Force special prefix for Vespa %define _prefix /opt/vespa-deps # Only strip debug info %global _find_debuginfo_opts -g # Don't provide shared library or pkgconfig %global __provides_exclude ^(lib.*\\.so\\.[0-9.]*\\([A-Z._0-9]*\\)\\(64bit\\)|pkgconfig\\(.*)$ %global __requires_exclude ^libonnxruntime\\.so\\.[0-9.]*\\([A-Z._0-9]*\\)\\(64bit\\)$ # Version %define ver_major 1 %define ver_minor 11 %define ver_patch 0 %define ver_release 1 Summary: ONNX Runtime package for Vespa Name: vespa-onnxruntime Version: %{ver_major}.%{ver_minor}.%{ver_patch} Release: %{ver_release}%{?dist} License: MIT License URL: https://microsoft.github.io/onnxruntime Source0: vespa-onnxruntime-%{version}.tar.gz %if 0%{?el7} %if 0%{?amzn2} BuildRequires: gcc10-c++%{?_isa} %define _toolset_compiler_cmake_args CMAKE_C_COMPILER=gcc10-gcc CMAKE_CXX_COMPILER=gcc10-g++ %else %define _devtoolset_enable /opt/rh/devtoolset-11/enable BuildRequires: devtoolset-11-gcc-c++%{?_isa} %endif BuildRequires: wget %define _cmake_version 3.23.0 %define _cmake_prefix $(pwd)/cmake-%{_cmake_version}-linux-x86_64 %define _cmake_prog %{_cmake_prefix}/bin/cmake %define _ctest_prog %{_cmake_prefix}/bin/ctest %define _download_cmake_tar 1 %endif %if 0%{?el8} %define _devtoolset_enable /opt/rh/gcc-toolset-11/enable BuildRequires: gcc-toolset-11-gcc-c++ BuildRequires: make BuildRequires: glibc-langpack-en BuildRequires: wget BuildRequires: cmake %define _cmake_prog cmake %define _ctest_prog ctest %endif %if 0%{?el9} BuildRequires: gcc-c++ BuildRequires: make BuildRequires: glibc-langpack-en BuildRequires: cmake %define _cmake_prog cmake %define _ctest_prog ctest %endif %if 0%{?fedora} BuildRequires: gcc-c++ BuildRequires: make BuildRequires: cmake BuildRequires: glibc-langpack-en %define _cmake_prog cmake %define _ctest_prog ctest %endif BuildRequires: zlib-devel %if ! 0%{?el9} BuildRequires: redhat-lsb-core %endif BuildRequires: expat-devel BuildRequires: libcurl-devel BuildRequires: python3-devel %if 0%{?amzn2} BuildRequires: numpy %else BuildRequires: python3-numpy %endif %if ! 0%{?el9} BuildRequires: libunwind %endif BuildRequires: python3-setuptools BuildRequires: bzip2 %description ONNX Runtime package for Vespa. See https://github.com/vespa-engine/vespa-3rdparty-deps for details about packaging. %package devel Summary: ONNX Runtime dev package for Vespa. Requires: %{name} = %{version}-%{release} %description devel %{version} dev package for Vespa. See https://github.com/vespa-engine/vespa-3rdparty-deps for details about packaging. %prep %setup -q %if 0%{?_download_cmake_tar} # Download precompiled cmake version on CentOS 7, RHEL 7 and Amazon Linux 2 for now. if test -f %{cmake_prog} then : else wget -O /tmp/cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v%{_cmake_version}/cmake-%{_cmake_version}-Linux-x86_64.tar.gz tar xf /tmp/cmake.tar.gz rm -f /tmp/cmake.tar.gz fi %endif %build %if 0%{?_devtoolset_enable:1} source %{_devtoolset_enable} || true %endif ./build.sh --config RelWithDebInfo --build_shared_lib --parallel --cmake_path %{_cmake_prog} --ctest_path %{_ctest_prog} --skip_submodule_sync --cmake_extra_defines CMAKE_INSTALL_PREFIX=%{_prefix} onnxruntime_DEV_MODE=OFF onnxruntime_USE_OPENMP=OFF %{?_toolset_compiler_cmake_args} %install rm -rf $RPM_BUILD_ROOT %if 0%{?_devtoolset_enable:1} source %{_devtoolset_enable} || true %endif make -C build/Linux/RelWithDebInfo DESTDIR=%{buildroot} install # Compat links with tarfile distribution ln -s core/session/onnxruntime_c_api.h %{buildroot}%{_prefix}/include/onnxruntime/onnxruntime_c_api.h ln -s core/session/onnxruntime_cxx_api.h %{buildroot}%{_prefix}/include/onnxruntime/onnxruntime_cxx_api.h ln -s core/session/onnxruntime_cxx_inline.h %{buildroot}%{_prefix}/include/onnxruntime/onnxruntime_cxx_inline.h %files %{_prefix}/lib64/ %exclude %{_prefix}/bin/ %license LICENSE %files devel %{_prefix}/include/ %license LICENSE %changelog