6 License: Apache-2.0 and MIT and BSD-2-Clause and MPL-2.0
8 Source0: %{name}-%{version}.tar.gz
9 Source1: %{name}.manifest
10 Source1001: nnapi_test_generated.tar.gz
11 Source2001: nnfw.pc.in
12 Source2002: nnfw-plugin.pc.in
13 Source3001: ABSEIL.tar.gz
14 Source3002: CPUINFO.tar.gz
15 Source3003: EGL_HEADERS.tar.gz
16 Source3004: FARMHASH.tar.gz
17 Source3005: FP16.tar.gz
18 Source3006: FXDIV.tar.gz
19 Source3007: GEMMLOWP.tar.gz
20 Source3008: OOURAFFT.tar.gz
21 Source3009: OPENCL_HEADERS.tar.gz
22 Source3010: OPENGL_HEADERS.tar.gz
23 Source3011: PSIMD.tar.gz
24 Source3012: PTHREADPOOL.tar.gz
25 Source3013: TENSORFLOW-2.8.0-EIGEN.tar.gz
26 Source3014: TENSORFLOW-2.8.0-GEMMLOWP.tar.gz
27 Source3015: TENSORFLOW-2.8.0-RUY.tar.gz
28 Source3016: TENSORFLOW-2.8.0.tar.gz
29 Source3017: VULKAN.tar.gz
30 Source3018: XNNPACK.tar.gz
31 Source3019: FLATBUFFERS-2.0.tar.gz
33 %{!?build_type: %define build_type Release}
34 %{!?npud_build: %define npud_build 0}
35 %{!?trix_support: %define trix_support 1}
36 %{!?coverage_build: %define coverage_build 0}
37 %{!?test_build: %define test_build 0}
38 %{!?extra_option: %define extra_option %{nil}}
39 %{!?config_support: %define config_support 0}
41 %if %{coverage_build} == 1
42 # Coverage test requires debug build runtime
43 %define build_type Debug
49 Requires(post): /sbin/ldconfig
50 Requires(postun): /sbin/ldconfig
52 %if %{test_build} == 1
53 BuildRequires: pkgconfig(boost)
54 BuildRequires: pkgconfig(tensorflow2-lite)
55 BuildRequires: hdf5-devel
56 BuildRequires: libaec-devel
57 BuildRequires: pkgconfig(zlib)
58 BuildRequires: pkgconfig(libjpeg)
59 BuildRequires: gtest-devel
62 %if %{npud_build} == 1
63 BuildRequires: pkgconfig(glib-2.0)
66 %if %{trix_support} == 1
67 BuildRequires: pkgconfig(npu-engine)
71 nnfw is a high-performance, on-device neural network framework for Tizen
74 Summary: NNFW Devel Package
75 Requires: %{name} = %{version}-%{release}
78 NNFW development package for application developer using runtime
81 Summary: NNFW Devel Package
82 Requires: %{name}-devel = %{version}-%{release}
84 %description plugin-devel
85 NNFW development package for backend plugin developer
88 Summary: Minimal test binary for VD manual test
90 %description minimal-app
91 Minimal test binary for VD manual test
93 %if %{test_build} == 1
99 If you want to use test package, you should install runtime package which is build with test build option
100 If you want to get coverage info, you should install runtime package which is build with coverage build option
101 # TODO Use release runtime pacakge for test
104 %if %{npud_build} == 1
109 NPU daemon for optimal management of NPU hardware
113 %define target_arch armv7l
116 %define target_arch armv7hl
119 %define target_arch x86_64
122 %define target_arch aarch64
125 %define target_arch i686
128 %define install_dir %{_prefix}
129 %define install_path %{buildroot}%{install_dir}
130 %define nnfw_workspace build
131 %define build_env NNFW_WORKSPACE=%{nnfw_workspace}
133 # Path to install test bin and scripts (test script assumes path Product/out)
134 # TODO Share path with release package
135 %define test_install_home /opt/usr/nnfw-test
136 %define test_install_dir %{test_install_home}/Product/out
137 %define test_install_path %{buildroot}%{test_install_dir}
139 # Set option for test build (and coverage test build)
140 %define option_test -DENABLE_TEST=OFF
141 %define option_coverage %{nil}
142 %define test_suite_list infra/scripts tests/scripts
144 %if %{test_build} == 1
145 # ENVVAR_ONERT_CONFIG: Use environment variable for runtime core configuration and debug
146 %define option_test -DENABLE_TEST=ON -DENVVAR_ONERT_CONFIG=ON
149 # Set option for configuration
150 %define option_config %{nil}
151 %if %{npud_build} == 1
152 %if %{config_support} == 1
153 # ENVVAR_NPUD_CONFIG: Use environment variable for npud configuration and debug
154 %define option_config -DBUILD_NPUD=ON -DENVVAR_NPUD_CONFIG=ON
156 %define option_config -DBUILD_NPUD=ON -DENVVAR_NPUD_CONFIG=OFF
157 %endif # config_support
159 %define option_config -DBUILD_NPUD=OFF
162 %if %{coverage_build} == 1
163 %define option_coverage -DENABLE_COVERAGE=ON
164 %endif # coverage_build
166 %define build_options -DCMAKE_BUILD_TYPE=%{build_type} -DTARGET_ARCH=%{target_arch} -DTARGET_OS=tizen -DBUILD_MINIMAL_SAMPLE=ON \\\
167 %{option_test} %{option_coverage} %{option_config} %{extra_option}
173 tar -xf %{SOURCE1001} -C ./tests/nnapi/src/
174 tar -xf %{SOURCE3001} -C ./externals
175 tar -xf %{SOURCE3002} -C ./externals
176 tar -xf %{SOURCE3003} -C ./externals
177 tar -xf %{SOURCE3004} -C ./externals
178 tar -xf %{SOURCE3005} -C ./externals
179 tar -xf %{SOURCE3006} -C ./externals
180 tar -xf %{SOURCE3007} -C ./externals
181 tar -xf %{SOURCE3008} -C ./externals
182 tar -xf %{SOURCE3009} -C ./externals
183 tar -xf %{SOURCE3010} -C ./externals
184 tar -xf %{SOURCE3011} -C ./externals
185 tar -xf %{SOURCE3012} -C ./externals
186 tar -xf %{SOURCE3013} -C ./externals
187 tar -xf %{SOURCE3014} -C ./externals
188 tar -xf %{SOURCE3015} -C ./externals
189 tar -xf %{SOURCE3016} -C ./externals
190 tar -xf %{SOURCE3017} -C ./externals
191 tar -xf %{SOURCE3018} -C ./externals
192 tar -xf %{SOURCE3019} -C ./externals
195 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
197 %{build_env} ./nnfw configure %{build_options}
198 %{build_env} ./nnfw build -j4
199 # install in workspace
200 # TODO Set install path
201 %{build_env} ./nnfw install
203 %if %{test_build} == 1
204 %if %{coverage_build} == 1
205 pwd > tests/scripts/build_path.txt
206 %endif # coverage_build
207 tar -zcf test-suite.tar.gz infra/scripts
209 %endif # arm armv7l armv7hl aarch64
212 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
214 mkdir -p %{buildroot}%{_libdir}
215 mkdir -p %{buildroot}%{_bindir}
216 mkdir -p %{buildroot}%{_includedir}
217 install -m 644 build/out/lib/*.so %{buildroot}%{_libdir}
218 install -m 755 build/out/bin/onert-minimal-app %{buildroot}%{_bindir}
219 cp -r build/out/include/* %{buildroot}%{_includedir}/
224 sed -i 's:@libdir@:%{_libdir}:g
225 s:@includedir@:%{_includedir}:g
226 s:@version@:%{version}:g' ./nnfw.pc.in
227 sed -i 's:@libdir@:%{_libdir}:g
228 s:@includedir@:%{_includedir}:g
229 s:@version@:%{version}:g' ./nnfw-plugin.pc.in
230 mkdir -p %{buildroot}%{_libdir}/pkgconfig
231 install -m 0644 ./nnfw.pc.in %{buildroot}%{_libdir}/pkgconfig/nnfw.pc
232 install -m 0644 ./nnfw-plugin.pc.in %{buildroot}%{_libdir}/pkgconfig/nnfw-plugin.pc
234 %if %{test_build} == 1
235 mkdir -p %{test_install_path}/bin
236 mkdir -p %{test_install_path}/nnapi-gtest
237 mkdir -p %{test_install_path}/unittest
238 mkdir -p %{test_install_path}/test
240 install -m 755 build/out/bin/onert_run %{test_install_path}/bin
241 install -m 755 build/out/bin/tflite_comparator %{test_install_path}/bin
242 install -m 755 build/out/bin/tflite_run %{test_install_path}/bin
243 install -m 755 build/out/nnapi-gtest/* %{test_install_path}/nnapi-gtest
244 install -m 755 build/out/unittest/*_test %{test_install_path}/unittest
245 install -m 755 build/out/unittest/test_* %{test_install_path}/unittest
246 cp -r build/out/test/* %{test_install_path}/test
247 cp -r build/out/unittest/nnfw_api_gtest_models %{test_install_path}/unittest
249 # Share test script with ubuntu (ignore error if there is no list for target)
250 cp tests/nnapi/nnapi_gtest.skip.%{target_arch}-* %{test_install_path}/nnapi-gtest/.
251 cp %{test_install_path}/nnapi-gtest/nnapi_gtest.skip.%{target_arch}-linux.cpu %{test_install_path}/nnapi-gtest/nnapi_gtest.skip
252 tar -zxf test-suite.tar.gz -C %{buildroot}%{test_install_home}
254 %if %{coverage_build} == 1
255 mkdir -p %{buildroot}%{test_install_home}/gcov
256 find %{nnfw_workspace} -name "*.gcno" -exec xargs cp {} %{buildroot}%{test_install_home}/gcov/. \;
257 install -m 0644 ./tests/scripts/build_path.txt %{buildroot}%{test_install_dir}/test/build_path.txt
258 %endif # coverage_build
261 %if %{npud_build} == 1
262 install -m 755 build/out/bin/npud %{buildroot}%{_bindir}
264 %if %{test_build} == 1
265 mkdir -p %{test_install_path}/npud-gtest
266 install -m 755 build/out/npud-gtest/* %{test_install_path}/npud-gtest
273 %post -p /sbin/ldconfig
274 %postun -p /sbin/ldconfig
277 %manifest %{name}.manifest
278 %defattr(-,root,root,-)
279 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
281 %exclude %{_includedir}/CL/*
285 %manifest %{name}.manifest
286 %defattr(-,root,root,-)
287 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
288 %dir %{_includedir}/nnfw
289 %{_includedir}/nnfw/*
290 %{_libdir}/pkgconfig/nnfw.pc
294 %manifest %{name}.manifest
295 %defattr(-,root,root,-)
296 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
297 %dir %{_includedir}/onert
298 %{_includedir}/onert/*
299 %{_libdir}/pkgconfig/nnfw-plugin.pc
302 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
304 %manifest %{name}.manifest
305 %defattr(-,root,root,-)
306 %{_bindir}/onert-minimal-app
309 %if %{test_build} == 1
311 %manifest %{name}.manifest
312 %defattr(-,root,root,-)
313 %ifarch arm armv7l armv7hl aarch64 x86_64
314 %dir %{test_install_home}
315 %{test_install_home}/*
316 %endif # arm armv7l armv7hl aarch64
319 %if %{npud_build} == 1
321 %manifest %{name}.manifest
322 %defattr(-,root,root,-)
323 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
325 %endif # arm armv7l armv7hl aarch64 x86_64 %ix86
329 * Thu Mar 15 2018 Chunseok Lee <chunseok.lee@samsung.com>
330 - Initial spec file for nnfw