[Dist/Tizen] Revise packaging to fix build breaks on gcc 13
[platform/upstream/dldt.git] / packaging / openvino.spec
1 %bcond_with tizen
2 %if %{with tizen}
3 %global debug_package %{nil}
4 %global __debug_install_post %{nil}
5
6 %if "%{?_lib}" == "lib64"
7 %define _cmake_lib_suffix_flag %{?_cmake_lib_suffix64}
8 %else
9 %define _cmake_lib_suffix_flag %{nil}
10 %endif
11
12 %ifarch x86_64
13 %define _cmake_sse_support_flag -DENABLE_SSE42=1
14 %else
15 %define _cmake_sse_support_flag -DENABLE_SSE42=0
16 %endif
17
18 %define _extra_cmake_flags %{_cmake_lib_suffix_flag} %{_cmake_sse_support_flag} -DLINUX_OS_NAME="Tizen %{tizen_full_version}"
19
20 %ifarch x86_64 i686 armv7l aarch64 armv7hl
21
22 %ifarch x86_64
23 %define install_arch    intel64
24 %endif
25
26 %ifarch i686
27 %define install_arch    i686
28 %endif
29
30 %ifarch armv7l armv7hl
31 %define install_arch    armv7l
32 %endif
33
34 %ifarch aarch64
35 %define install_arch    aarch64
36 %endif
37
38 %else
39 %define install_arch    %{_arch}
40 %endif
41
42 %endif
43
44 %define     external_ade_archive        ade-cbe2db61a659c2cc304c3837406f95c39dfa938e
45 %define     external_ngraph_archive     ngraph-0.22.0-rc.2
46
47 Name:           openvino
48 Summary:        OpenVINO™ Toolkit - Deep Learning Deployment Toolkit
49 Version:        2019R3
50 Release:        0
51 Group:          Development/Libraries
52 Packager:       Wook Song <wook16.song@samsung.com>
53 License:        Apache-2.0
54 Source0:        %{name}-%{version}.tar.gz
55 Source1:        %{name}.manifest
56 Source1001:     %{external_ade_archive}.tar.gz
57 Source1002:     %{external_ngraph_archive}.tar.gz
58 Source1003:     openvino.pc.in
59 Patch0:         0001-CMake-Do-not-call-get_linux_name-when-LINUX_OS_NAME-.patch
60 Patch1:         0002-CMake-Add-a-variable-to-resolve-dependency-on-TBB-us.patch
61 Patch2:         0003-VPU-CMake-Add-a-cmake-option-to-skip-downloading-MVN.patch
62 Patch3:         0004-Tizen-Fix-build-breaks-on-Tizen-GCC-13.patch
63 BuildRequires:  cmake
64 BuildRequires:  pkgconfig(libtbb)
65 BuildRequires:  pkgconfig(libusb-1.0)
66 BuildRequires:  pkg-config
67 Requires:       intel-mvnc-firmware
68 ## Please note that when you include openvino in a Tizen image (via mic/tic),
69 ## you need to specify firmware type instead of intel-mvnc-firmware or
70 ## relying on dependency resolution.
71 ## E.g., add "mvnc-2x8x-firmware" to image explicitly.
72 ## If you want to support NCS 1 and 2 simultaneously, install both firmware
73 ## packages.
74
75 %description
76 OpenVINO™ toolkit, short for Open Visual Inference and Neural network Optimization toolkit,
77 provides developers with improved neural network performance on a variety of Intel® processors
78 and helps them further unlock cost-effective, real-time vision applications.
79 The toolkit enables deep learning inference and easy heterogeneous execution across multiple
80 Intel® platforms (CPU, Intel® Processor Graphics)—providing implementations across cloud
81 architectures to edge devices. This open source distribution provides flexibility and
82 availability to the developer community to innovate deep learning and AI solutions.
83
84 %package devel
85 Summary:        Development package for OpenVINO™ Toolkit
86 Requires:       %{name} = %{version}-%{release}
87 Recommends:     mvnc-2x8x-firmware
88
89 %description devel
90 Development package for Open Visual Inference and Neural network Optimization toolkit.
91 This contains corresponding header files and static archives.
92
93 %prep
94 %setup -q
95 %patch0 -p1
96 %patch1 -p1
97 %patch2 -p1
98 %patch3 -p1
99 cp %{SOURCE1} .
100 cp %{SOURCE1001} ./inference-engine/thirdparty
101 cp %{SOURCE1002} ./inference-engine/thirdparty
102 cp %{SOURCE1003} .
103 pushd inference-engine
104 pushd thirdparty
105 tar zxf %{external_ade_archive}.tar.gz
106 mv %{external_ade_archive}/* ade/
107 tar zxf %{external_ngraph_archive}.tar.gz
108 mv %{external_ngraph_archive}/* ngraph/
109 rm -rf *.tar.gz %{external_ade_archive} %{external_ngraph_archive}
110 popd
111 rm -rf build && mkdir -p build
112 pushd build
113 CFLAGS="${CFLAGS:-%optflags}"; export CFLAGS=${CFLAGS/-Wall/};
114 CFLAGS=`echo ${CFLAGS} -Wno-format-truncation`
115 CXXFLAGS="${CXXFLAGS:-%optflags}"; export CXXFLAGS=${CXXFLAGS/-Wall/};
116 CXXFLAGS=`echo ${CXXFLAGS} -Wno-format-truncation -Wno-unused-const-variable -Wno-free-nonheap-object -Wno-deprecated-declarations -Wno-array-bounds`
117 FFLAGS="${FFLAGS:-%optflags}"; export FFLAGS=${FFLAGS/-Wall/};
118 cmake .. \
119         -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
120         -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \
121         -DLIB_INSTALL_DIR:PATH=%{_libdir} -DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \
122         -DSHARE_INSTALL_PREFIX:PATH=%{_datadir} \
123         %{?_cmake_skip_rpath} -DUSE_TBB_SYSTEM_DEPS=ON -DUSE_MYRIAD_SYSTEM_DEPS=ON \
124         -DENABLE_VPU=ON -DENABLE_MYRIAD=ON -DENABLE_MYRIAD_MVNC_TESTS=OFF -DENABLE_MYRIAD_NO_BOOT=OFF \
125         -DBUILD_ADE_DOCUMENTATION=OFF -DBUILD_ADE_TUTORIAL=OFF \
126         -DBUILD_PKGCONFIG=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DBUILD_TESTS=OFF \
127         -DCLDNN__INCLUDE_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release -DCOVERAGE=OFF \
128         -DDEVELOPMENT_PLUGIN_MODE=OFF-DENABLE_ADE_TESTING=OFF \
129         -DENABLE_AFFINITY_GENERATOR=OFF -DENABLE_ALTERNATIVE_TEMP=OFF -DENABLE_CLDNN=OFF \
130         -DENABLE_CLDNN_BUILD=OFF -DENABLE_CLDNN_TESTS=OFF -DENABLE_CPPCHECK=OFF -DENABLE_CPPLINT=OFF \
131         -DENABLE_CPPLINT_REPORT=OFF -DENABLE_CPP_CCT=OFF -DENABLE_DEBUG_SYMBOLS=OFF \
132         -DENABLE_FUZZING=OFF -DENABLE_GAPI_TESTS=OFF -DENABLE_GNA=OFF -DENABLE_LTO=OFF \
133         -DENABLE_MKL_DNN=OFF \
134         -DENABLE_OBJECT_DETECTION_TESTS=ON -DENABLE_OPENCV=OFF -DENABLE_PLUGIN_RPATH=OFF \
135         -DENABLE_PROFILING_ITT=OFF -DENABLE_PROFILING_RAW=OFF -DENABLE_PYTHON=OFF -DENABLE_ROCKHOPER=OFF \
136         -DENABLE_SAMPLES=OFF -DENABLE_SAMPLES_CORE=OFF -DENABLE_SEGMENTATION_TESTS=OFF -DENABLE_TESTS=ON \
137         -DTREAT_WARNING_AS_ERROR=OFF %{_extra_cmake_flags}
138 popd
139 popd
140
141 %build
142 pushd inference-engine
143 pushd build
144 %{__make} %{?_smp_mflags}
145 popd
146 popd
147 sed -i 's|@VERSION@|%{version}|g' openvino.pc.in
148 sed -i 's|@PREFIX@|%{_prefix}|g' openvino.pc.in
149 sed -i 's|@LIB_INSTALL_DIR@|%{_libdir}|g' openvino.pc.in
150 sed -i 's|@INCLUDE_INSTALL_DIR@|%{_includedir}|g' openvino.pc.in
151
152 %install
153 mkdir -p %{buildroot}%{_libdir}
154 mkdir -p %{buildroot}%{_libdir}/pkgconfig
155 cp openvino.pc.in %{buildroot}%{_libdir}/pkgconfig/openvino.pc
156
157 pushd inference-engine/bin/%{install_arch}/Release
158 install -m 644 lib/*.so %{buildroot}%{_libdir}
159 install -m 644 lib/*.xml %{buildroot}%{_libdir}
160 rm -rf lib/libstb_image.a
161 rm -rf lib/libgflags_nothreads.a
162 rm -rf lib/libgtest_main.a
163 rm -rf lib/libgtest.a
164 rm -rf lib/libgmock_main.a
165 rm -rf lib/libgmock.a
166 install -m 644 lib/*.a %{buildroot}%{_libdir}
167 popd
168
169 mkdir -p %{buildroot}%{_includedir}
170 mkdir -p %{buildroot}%{_includedir}/builders
171 mkdir -p %{buildroot}%{_includedir}/cpp
172 mkdir -p %{buildroot}%{_includedir}/details
173 mkdir -p %{buildroot}%{_includedir}/details/os
174 mkdir -p %{buildroot}%{_includedir}/hetero
175 mkdir -p %{buildroot}%{_includedir}/multi-device
176 pushd inference-engine
177 install -m 644 include/*.h* %{buildroot}%{_includedir}
178 install -m 644 include/builders/*.h* %{buildroot}%{_includedir}/builders/
179 install -m 644 include/cpp/*.h* %{buildroot}%{_includedir}/cpp/
180 install -m 644 include/details/*.h* %{buildroot}%{_includedir}/details/
181 install -m 644 include/details/os/*.h* %{buildroot}%{_includedir}/details/os/
182 install -m 644 include/hetero/*.h* %{buildroot}%{_includedir}/hetero/
183 install -m 644 include/multi-device/*.h* %{buildroot}%{_includedir}/multi-device/
184 popd
185
186 # Block running tests until it is stabilized
187 #%check
188 #pushd inference-engine/bin/%{install_arch}/Release
189 #LD_LIBRARY_PATH=./lib ./InferenceEngineUnitTests
190 #popd
191
192 %post
193 %{_sbindir}/ldconfig
194
195 %postun
196 %{_sbindir}/ldconfig
197
198 %files
199 %manifest %{name}.manifest
200 %license LICENSE
201 %{_libdir}/*.so
202 %{_libdir}/*.xml
203
204 %files devel
205 %manifest %{name}.manifest
206 %license LICENSE
207 %{_libdir}/*.a
208 %{_libdir}/pkgconfig/openvino.pc
209 %{_includedir}/*