%global lockver 1 %global pkgvers 2 %global scdate0 20221220 %global sctags0 2022.3.0 %global branch0 master %global source0 https://github.com/openvinotoolkit/openvino.git %define use_ocld 0 %define use_onnx 1 %define use_dnnl 0 %define use_opcv 0 Name: openvino Version: %(curl -s https://raw.githubusercontent.com/openvinotoolkit/openvino/%{sctags0}/src/core/include/openvino/core/version.hpp | grep -e "MAJOR " -e "MINOR " -e "PATCH " | awk '{print $3}' | sed ':a;N;$!ba;s/\n/./g') Release: %{scdate0}.%{pkgvers}%{?dist} Summary: Deep Learning Deployment Toolkit repository License: BSD URL: https://github.com/openvinotoolkit/openvino Patch0: dldt-assert.patch Patch1: dldt-shared.patch Patch2: openvino-gcc11.patch ExclusiveArch: x86_64 aarch64 BuildRequires: cmake wget git openblas-devel protobuf-lite-devel glibc-devel ShellCheck BuildRequires: python3 python3-devel python3-Cython pybind11-devel /usr/bin/protoc protobuf-devel BuildRequires: tbb-devel pugixml-devel libusbx-devel xbyak-devel python3-pyyaml libva-devel BuildRequires: ocl-icd-devel python3-sphinx %if 0%{?fedora} BuildRequires: gflags-devel %endif %define ext_ocld 0 %define ext_onnx 0 %define ext_dnnl 0 %if %{ext_onnx} && %{use_onnx} BuildRequires: onnx-devel %endif %if %{ext_dnnl} BuildRequires: onednn-devel %endif %global toolchain gcc %if "%{toolchain}" == "gcc" BuildRequires: gcc-c++ %else BuildRequires: clang %endif %define have_cuda 0 %if %{use_opcv} %global vcu_maj 12 %global vcu_min 0 %define have_cuda 1 BuildRequires: opencv-devel %endif %define have_cuda_gcc 1 %if %{have_cuda} %if %{have_cuda_gcc} %if (0%{?fedora} > 34) || (0%{?rhel} > 8) BuildRequires: cuda-gcc-c++ %endif %endif BuildRequires: cuda-nvcc-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvtx-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-cudart-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvml-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvrtc-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-driver-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-profiler-api-%{vcu_maj}-%{vcu_min} %endif %global _lto_cflags %{nil} %global debug_package %{nil} %undefine _hardened_build %undefine _annotated_build %global __cmake_in_source_build 1 %global _python_dist_allow_version_zero 1 %description This toolkit allows developers to deploy pre-trained deep learning models through a high-level C++ Inference Engine API integrated with application logic. %package devel Summary: Development library for %{name} Requires: %{name} = %{version}-%{release} %description devel Development library for %{name}. %package examples Summary: Library Requires: %{name} = %{version}-%{release} %description examples Contains examples that use the %{name} library. %package python3 Summary: Python library for %{name} Requires: %{name} = %{version}-%{release} %description python3 Python library for %{name}. %prep %setup -T -c -n %{name} git clone --depth 1 -n -b %{sctags0} %{source0} . git reset --hard %{sctags0} git submodule update --init --depth 1 thirdparty/ade git submodule update --init --depth 1 thirdparty/xbyak git submodule update --init --depth 1 thirdparty/json %if ! %{ext_onnx} && %{use_onnx} git submodule update --init --depth 1 thirdparty/onnx/onnx %endif %if ! %{ext_dnnl} && %{use_dnnl} git submodule update --init --depth 1 src/plugins/intel_cpu/thirdparty/onednn %endif %if ! %{ext_ocld} && %{use_ocld} git submodule update --init --depth 1 thirdparty/ocl/cl_headers git submodule update --init --depth 1 thirdparty/ocl/clhpp_headers git submodule update --init --depth 1 thirdparty/ocl/icd_loader %endif git --no-pager log --format=fuller %if ! %{use_opcv} rm -rf samples/c/hello_classification rm -rf samples/c/common/opencv_c_wrapper %endif #%patch0 -p1 %patch1 -p0 #%patch2 -p0 # gflags sed -i 's|COMPONENTS nothreads_static||g' thirdparty/CMakeLists.txt # protobuf sed -i 's|Protobuf_USE_STATIC_LIBS ON|OFF|g' thirdparty/CMakeLists.txt # pybind11 sed -i 's|add_subdirectory(thirdparty/pybind11 EXCLUDE_FROM_ALL)|find_package(pybind11 REQUIRED)|' src/bindings/python/CMakeLists.txt # no -isystem find . -name '*.txt' -exec sed -i 's| SYSTEM | |g' {} + find . -name '*.cmake' -exec sed -i 's| SYSTEM | |g' {} + # ext opencl %if %{ext_ocld} && %{use_ocld} mkdir -p thirdparty/ocl/clhpp_headers/include echo 'add_library(OpenCL SHARED IMPORTED GLOBAL)' > thirdparty/ocl/icd_loader/CMakeLists.txt sed -i '/target_include_directories(OpenCL/d' thirdparty/ocl/CMakeLists.txt %endif # ext onednn %if %{ext_dnnl} && %{use_dnnl} echo 'add_library(dnnl SHARED IMPORTED GLOBAL)' > src/plugins/intel_cpu/thirdparty/onednn/CMakeLists.txt echo 'include_directories(%{_includedir}/dnnl)' >> src/plugins/intel_cpu/thirdparty/onednn/CMakeLists.txt %endif # ext onnx %if %{ext_onnx} && %{use_onnx} echo 'add_library(onnx SHARED IMPORTED GLOBAL)' > thirdparty/onnx/onnx/CMakeLists.txt echo 'add_library(onnx_proto SHARED IMPORTED GLOBAL)' >> thirdparty/onnx/onnx/CMakeLists.txt sed -i '/target_include_directories(onnx/d' thirdparty/onnx/CMakeLists.txt %endif # no target handle sed -i '/target_compile_options(${target} PRIVATE -w)/d' cmake/developer_package/compile_flags/os_flags.cmake # tools dir %if 0%{?fedora} >= 37 find tools/mo -type f -name '*.py' -exec sed -i 's|np.str|np.str_|g' {} + find tools/mo -type f -name '*.py' -exec sed -i 's|np.bool|np.bool_|g' {} + %endif sed -i 's|DESTINATION ${OV_CPACK_TOOLSDIR}|DESTINATION ${OV_CPACK_PYTHONDIR}|g' tools/CMakeLists.txt # usb sed -i 's|0660|0666|g' src/plugins/intel_myriad/third_party/mvnc/src/97-myriad-usbboot.rules # gcc13 sed -i '1i #include ' src/frontends/onnx/onnx_common/src/onnx_model_validator.cpp sed -i '1i #include ' src/common/util/include/openvino/util/file_util.hpp sed -i '1i #include ' src/common/preprocessing/ie_preprocess_gapi_kernels.hpp sed -i '1i #include ' src/common/itt/include/openvino/itt.hpp sed -i '1i #include ' thirdparty/ade/sources/ade/include/ade/typed_graph.hpp %build mkdir -p build pushd build # % global optflags %(echo "%{optflags} -w" | sed 's|-Werror=format-security||' | sed 's|-Wp,-D_GLIBCXX_ASSERTIONS||' | sed 's|-g||') %global optflags %(echo "-w") %cmake ../ -Wno-dev \ -DCMAKE_SKIP_RPATH=ON \ -DCMAKE_VERBOSE_MAKEFILE=OFF \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON \ -DCPACK_GENERATOR=RPM \ -DBUILD_SHARED_LIBS=ON \ -DENABLE_FASTER_BUILD=OFF \ -DTREAT_WARNING_AS_ERROR=OFF \ %if 0%{?fedora} -Dgflags_BINARY_DIR=%{_bindir} \ %endif -DTHREADING=SEQ \ -DENABLE_LTO=OFF \ -DENABLE_CPPLINT=OFF \ -DENABLE_NCC_STYLE=OFF \ -DENABLE_FASTER_BUILD=OFF \ -DENABLE_CLANG_FORMAT=OFF \ -DENABLE_SYSTEM_PUGIXML=ON \ -DENABLE_SYSTEM_PROTOBUF=ON \ %if %{use_opcv} -DENABLE_OPENCV=ON \ -DOpenCV_DIR="%{_includedir}" \ %else -DENABLE_OPENCV=OFF \ %endif %if %{have_cuda} -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-%{vcu_maj}.%{vcu_min} \ -DCUDA_SDK_ROOT_DIR=/usr/local/cuda-%{vcu_maj}.%{vcu_min} \ %endif %if %{use_ocld} -DENABLE_CLDNN=ON \ %else -DENABLE_CLDNN=OFF \ %endif %if %{use_dnnl} -DENABLE_INTEL_CPU=ON \ %else -DENABLE_INTEL_CPU=OFF \ %endif -DENABLE_INTEL_GPU=ON \ -DENABLE_INTEL_GNA=OFF \ -DENABLE_ONEDNN_FOR_GPU=OFF \ -DENABLE_PYTHON=ON \ -DENABLE_TESTS=OFF \ -DENABLE_PROFILING_ITT=OFF \ -DENABLE_FUNCTIONAL_TESTS=OFF \ -DENABLE_OV_TF_FRONTEND=ON \ %if %{use_onnx} -DENABLE_OV_ONNX_FRONTEND=ON \ %else -DENABLE_OV_ONNX_FRONTEND=OFF \ %endif -DENABLE_OV_PADDLE_FRONTEND=ON \ -DENABLE_OV_CORE_UNIT_TESTS=OFF make %{?_smp_mflags} popd %install pushd build %make_install popd # python egg install %{__python3} src/bindings/python/setup.py egg_info -e %{buildroot}%{python3_sitearch} || true sed -i "s|^Version:.*|Version: %{version}-%{scdate0}.%{pkgvers}%{?dist}|" %{buildroot}%{python3_sitearch}/*.egg-info/PKG-INFO sed -i 's|[<=>].*||g' %{buildroot}%{python3_sitearch}/*.egg-info/requires.txt # move things mv -f %{buildroot}/%{_datadir}/%{name}/samples \ %{buildroot}/%{_datadir}/doc/%{name} sed -i '/^import sys/a import deployment_manager as deployman' \ %{buildroot}/%{python3_sitearch}/deployment_manager/deployment_manager.py ln -sf %{python3_sitearch}/deployment_manager/deployment_manager.py \ %{buildroot}/%{_bindir}/deployment_manager.py mkdir -p %{buildroot}%{_sysconfdir}/udev/rules.d install -m644 -t %{buildroot}%{_sysconfdir}/udev/rules.d \ src/plugins/intel_myriad/third_party/mvnc/src/*.rules # clean things rm -rf %{buildroot}/usr/setupvars.sh rm -rf %{buildroot}/%{python3_sitearch}/*.txt rm -rf %{buildroot}/usr/install_dependencies # uninstalled apps install -m755 bin/*/*/hello* %{buildroot}%{_bindir} install -m755 bin/*/*/benchmark_app* %{buildroot}%{_bindir} install -m755 bin/*/*/speech_sample %{buildroot}%{_bindir} install -m755 bin/*/*/sync_benchmark %{buildroot}%{_bindir} install -m755 bin/*/*/throughput_benchmark %{buildroot}%{_bindir} install -m755 bin/*/*/model_creation_sample %{buildroot}%{_bindir} install -m755 bin/*/*/classification_sample_async %{buildroot}%{_bindir} install -m755 bin/*/*/ov_integration_snippet %{buildroot}%{_bindir} install -m755 bin/*/*/libformat_reader.so %{buildroot}%{_libdir} %if %{use_opcv} install -m755 bin/*/*/libopencv_c_wrapper.so %{buildroot}%{_libdir} %endif # mo tools pushd tools/mo mkdir -p %{buildroot}%{python3_sitelib}/openvino/tools/mo/ %{__python3} setup.py install --root %{buildroot} --install-lib=%{python3_sitearch} sed -i d %{buildroot}%{python3_sitearch}/openvino_mo*.egg-info/requires.txt touch %{buildroot}%{python3_sitearch}/openvino/tools/mo/requirements.txt rm -rf %{buildroot}%{python3_sitelib} popd # pot tools pushd tools/pot mkdir -p %{buildroot}%{python3_sitelib}/openvino/tools/pot %{__python3} setup.py install --root %{buildroot} --install-lib=%{python3_sitearch} sed -i d %{buildroot}%{python3_sitearch}/pot*.egg-info/requires.txt sed -i "s|^Version:.*|Version: %{version}-%{scdate0}.%{pkgvers}%{?dist}|" %{buildroot}%{python3_sitearch}/pot*.egg-info/PKG-INFO rm -rf %{buildroot}%{python3_sitelib} popd # remove spurious rm -rf %{buildroot}%{python3_sitearch}/unit_tests # strip elf set +x find %{buildroot} -type f -print | LC_ALL=C sort | file -N -f - | sed -n -e 's/^\(.*\):[ \t]*.*ELF.*, not stripped.*/\1/p' | xargs --no-run-if-empty stat -c '%h %D_%i %n' | while read nlinks inum f; do echo "Stripping: $f" strip -s $f done set -x %ldconfig_scriptlets %files %doc README.md %license LICENSE %{_docdir}/* %{_bindir}/compile_tool %exclude %{_libdir}/libformat_reader.so %if %{use_opcv} %exclude %{_libdir}/libopencv_c_wrapper.so %endif %{_libdir}/*.so.* %{_libdir}/%{name}-* %{_sysconfdir}/udev/rules.d/* %files devel %{_includedir}/* %{_libdir}/*.so %{_libdir}/cmake/* %{_libdir}/pkgconfig/* %files examples %exclude %{_bindir}/mo %exclude %{_bindir}/pot %exclude %{_bindir}/compile_tool %exclude %{_bindir}/deployment_manager.py %{_bindir}/* %{_libdir}/libformat_reader.so %if %{use_opcv} %{_libdir}/libopencv_c_wrapper.so %endif %files python3 %{_bindir}/mo %{_bindir}/pot %{_bindir}/deployment_manager.py %{python3_sitearch}/* %changelog * Sun Jan 27 2019 Cristian Balint - github build