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 1}
35 %{!?trix_support: %define trix_support 1}
36 %{!?odc_build: %define odc_build 1}
37 %{!?coverage_build: %define coverage_build 0}
38 %{!?test_build: %define test_build 0}
39 %{!?extra_option: %define extra_option %{nil}}
40 %{!?config_support: %define config_support 1}
41 # Define nproc on gbs build option if you want to set number of build threads manually (ex. CI/CD infra)
42 %define build_jobs %{?!nproc:%{?_smp_mflags}%{?!_smp_mflags:-j4}}%{?nproc:-j%nproc}
43 %{!?nproc: %define nproc %{?!jobs:4}%{?jobs}}
45 %if %{coverage_build} == 1
46 # Coverage test requires debug build runtime
47 %define build_type Debug
53 Requires(post): /sbin/ldconfig
54 Requires(postun): /sbin/ldconfig
56 %if %{test_build} == 1
57 BuildRequires: pkgconfig(boost)
58 BuildRequires: pkgconfig(tensorflow2-lite)
59 BuildRequires: hdf5-devel
60 BuildRequires: libaec-devel
61 BuildRequires: pkgconfig(zlib)
62 BuildRequires: pkgconfig(libjpeg)
63 BuildRequires: gtest-devel
66 %if %{npud_build} == 1
67 BuildRequires: pkgconfig(glib-2.0)
70 %if %{trix_support} == 1
71 BuildRequires: pkgconfig(npu-engine)
75 nnfw is a high-performance, on-device neural network framework for Tizen
78 Summary: NNFW Devel Package
79 Requires: %{name} = %{version}-%{release}
82 NNFW development package for application developer using runtime
85 Summary: NNFW Devel Package
86 Requires: %{name}-devel = %{version}-%{release}
88 %description plugin-devel
89 NNFW development package for backend plugin developer
93 Summary: NNFW On-Device Compilation Package
96 NNFW package for on-device compilation
100 Summary: Minimal test binary for VD manual test
102 %description minimal-app
103 Minimal test binary for VD manual test
105 %if %{test_build} == 1
111 If you want to use test package, you should install runtime package which is build with test build option
112 If you want to get coverage info, you should install runtime package which is build with coverage build option
113 # TODO Use release runtime pacakge for test
116 %if %{npud_build} == 1
121 NPU daemon for optimal management of NPU hardware
125 %define target_arch armv7l
128 %define target_arch armv7hl
131 %define target_arch x86_64
134 %define target_arch aarch64
137 %define target_arch i686
140 %define install_dir %{_prefix}
141 %define install_path %{buildroot}%{install_dir}
142 %define nnfw_workspace build
143 %define build_env NNFW_WORKSPACE=%{nnfw_workspace}
144 %define nncc_workspace build/nncc
145 %define nncc_env NNCC_WORKSPACE=%{nncc_workspace}
146 %define overlay_path %{nnfw_workspace}/overlay
148 # Path to install test bin and scripts (test script assumes path Product/out)
149 # TODO Share path with release package
150 %define test_install_home /opt/usr/nnfw-test
151 %define test_install_dir %{test_install_home}/Product/out
152 %define test_install_path %{buildroot}/%{test_install_dir}
154 # Set option for test build (and coverage test build)
155 %define option_test -DENABLE_TEST=OFF
156 %define option_coverage %{nil}
157 %define test_suite_list infra/scripts tests/scripts
159 %if %{test_build} == 1
160 # ENVVAR_ONERT_CONFIG: Use environment variable for runtime core configuration and debug
161 %define option_test -DENABLE_TEST=ON -DENVVAR_ONERT_CONFIG=ON
164 # Set option for configuration
165 %define option_config %{nil}
166 %if %{config_support} == 1
167 %if %{npud_build} == 1
168 # ENVVAR_NPUD_CONFIG: Use environment variable for npud configuration and debug
169 %define option_config -DENVVAR_NPUD_CONFIG=ON
171 %endif # config_support
173 %if %{coverage_build} == 1
174 %define option_coverage -DENABLE_COVERAGE=ON
175 %endif # coverage_build
177 %define build_options -DCMAKE_BUILD_TYPE=%{build_type} -DTARGET_ARCH=%{target_arch} -DTARGET_OS=tizen \\\
178 -DEXTERNALS_BUILD_THREAD=%{nproc} -DBUILD_MINIMAL_SAMPLE=ON -DNNFW_OVERLAY_DIR=$(pwd)/%{overlay_path} \\\
179 %{option_test} %{option_coverage} %{option_config} %{extra_option}
185 tar -xf %{SOURCE1001} -C ./tests/nnapi/src/
186 tar -xf %{SOURCE3001} -C ./externals
187 tar -xf %{SOURCE3002} -C ./externals
188 tar -xf %{SOURCE3003} -C ./externals
189 tar -xf %{SOURCE3004} -C ./externals
190 tar -xf %{SOURCE3005} -C ./externals
191 tar -xf %{SOURCE3006} -C ./externals
192 tar -xf %{SOURCE3007} -C ./externals
193 tar -xf %{SOURCE3008} -C ./externals
194 tar -xf %{SOURCE3009} -C ./externals
195 tar -xf %{SOURCE3010} -C ./externals
196 tar -xf %{SOURCE3011} -C ./externals
197 tar -xf %{SOURCE3012} -C ./externals
198 tar -xf %{SOURCE3013} -C ./externals
199 tar -xf %{SOURCE3014} -C ./externals
200 tar -xf %{SOURCE3015} -C ./externals
201 tar -xf %{SOURCE3016} -C ./externals
202 tar -xf %{SOURCE3017} -C ./externals
203 tar -xf %{SOURCE3018} -C ./externals
204 tar -xf %{SOURCE3019} -C ./externals
207 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
209 %if %{odc_build} == 1
210 %{nncc_env} ./nncc configure -DBUILD_GTEST=OFF -DENABLE_TEST=OFF -DEXTERNALS_BUILD_THREADS=%{nproc} -DCMAKE_BUILD_TYPE=%{build_type} -DTARGET_OS=tizen \
211 -DCMAKE_INSTALL_PREFIX=$(pwd)/%{overlay_path} \
212 -DBUILD_WHITELIST="luci;foder;pepper-csv2vec;loco;locop;logo;logo-core;mio-circle06;luci-compute;oops;hermes;hermes-std;angkor;pp;pepper-strcast;pepper-str"
213 %{nncc_env} ./nncc build %{build_jobs}
214 cmake --install %{nncc_workspace}
217 # install angkor TensorIndex and oops InternalExn header (TODO: Remove this)
218 mkdir -p %{overlay_path}/include/nncc/core/ADT/tensor
219 mkdir -p %{overlay_path}/include/oops
220 cp compiler/angkor/include/nncc/core/ADT/tensor/Index.h %{overlay_path}/include/nncc/core/ADT/tensor
221 cp compiler/oops/include/oops/InternalExn.h %{overlay_path}/include/oops
224 %{build_env} ./nnfw configure %{build_options}
225 %{build_env} ./nnfw build %{build_jobs}
226 # install in workspace
227 # TODO Set install path
228 %{build_env} ./nnfw install
230 %if %{test_build} == 1
231 %if %{coverage_build} == 1
232 pwd > tests/scripts/build_path.txt
233 %endif # coverage_build
234 tar -zcf test-suite.tar.gz infra/scripts
236 %endif # arm armv7l armv7hl aarch64
239 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
241 mkdir -p %{buildroot}%{_libdir}
242 mkdir -p %{buildroot}%{_bindir}
243 mkdir -p %{buildroot}%{_includedir}
244 install -m 644 build/out/lib/*.so %{buildroot}%{_libdir}
245 install -m 755 build/out/bin/onert-minimal-app %{buildroot}%{_bindir}
246 cp -r build/out/include/* %{buildroot}%{_includedir}/
251 sed -i 's:@libdir@:%{_libdir}:g
252 s:@includedir@:%{_includedir}:g
253 s:@version@:%{version}:g' ./nnfw.pc.in
254 sed -i 's:@libdir@:%{_libdir}:g
255 s:@includedir@:%{_includedir}:g
256 s:@version@:%{version}:g' ./nnfw-plugin.pc.in
257 mkdir -p %{buildroot}%{_libdir}/pkgconfig
258 install -m 0644 ./nnfw.pc.in %{buildroot}%{_libdir}/pkgconfig/nnfw.pc
259 install -m 0644 ./nnfw-plugin.pc.in %{buildroot}%{_libdir}/pkgconfig/nnfw-plugin.pc
261 %if %{test_build} == 1
262 mkdir -p %{test_install_path}/bin
263 mkdir -p %{test_install_path}/nnapi-gtest
264 mkdir -p %{test_install_path}/unittest
265 mkdir -p %{test_install_path}/test
267 install -m 755 build/out/bin/onert_run %{test_install_path}/bin
268 install -m 755 build/out/bin/tflite_comparator %{test_install_path}/bin
269 install -m 755 build/out/bin/tflite_run %{test_install_path}/bin
270 install -m 755 build/out/nnapi-gtest/* %{test_install_path}/nnapi-gtest
271 install -m 755 build/out/unittest/*_test %{test_install_path}/unittest
272 install -m 755 build/out/unittest/test_* %{test_install_path}/unittest
273 cp -r build/out/test/* %{test_install_path}/test
274 cp -r build/out/unittest/nnfw_api_gtest_models %{test_install_path}/unittest
276 # Share test script with ubuntu (ignore error if there is no list for target)
277 cp tests/nnapi/nnapi_gtest.skip.%{target_arch}-* %{test_install_path}/nnapi-gtest/.
278 cp %{test_install_path}/nnapi-gtest/nnapi_gtest.skip.%{target_arch}-linux.cpu %{test_install_path}/nnapi-gtest/nnapi_gtest.skip
279 tar -zxf test-suite.tar.gz -C %{buildroot}%{test_install_home}
281 %if %{coverage_build} == 1
282 mkdir -p %{buildroot}%{test_install_home}/gcov
283 find %{nnfw_workspace} -name "*.gcno" -exec xargs cp {} %{buildroot}%{test_install_home}/gcov/. \;
284 install -m 0644 ./tests/scripts/build_path.txt %{buildroot}%{test_install_dir}/test/build_path.txt
285 %endif # coverage_build
288 %if %{odc_build} == 1
289 mkdir -p %{buildroot}%{_libdir}/nnfw/odc
290 install -m 644 %{overlay_path}/lib/libluci*.so %{buildroot}%{_libdir}/nnfw/odc
291 install -m 644 %{overlay_path}/lib/libloco*.so %{buildroot}%{_libdir}/nnfw/odc
292 install -m 644 build/out/lib/nnfw/odc/*.so %{buildroot}%{_libdir}/nnfw/odc
295 %if %{npud_build} == 1
296 install -m 755 build/out/bin/npud %{buildroot}%{_bindir}
298 %if %{test_build} == 1
299 mkdir -p %{test_install_path}/npud-gtest
300 install -m 755 build/out/npud-gtest/* %{test_install_path}/npud-gtest
307 %post -p /sbin/ldconfig
308 %postun -p /sbin/ldconfig
311 %manifest %{name}.manifest
312 %defattr(-,root,root,-)
313 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
315 %exclude %{_includedir}/CL/*
319 %manifest %{name}.manifest
320 %defattr(-,root,root,-)
321 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
322 %dir %{_includedir}/nnfw
323 %{_includedir}/nnfw/*
324 %{_libdir}/pkgconfig/nnfw.pc
328 %manifest %{name}.manifest
329 %defattr(-,root,root,-)
330 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
331 %dir %{_includedir}/onert
332 %{_includedir}/onert/*
333 %{_libdir}/pkgconfig/nnfw-plugin.pc
336 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
338 %manifest %{name}.manifest
339 %defattr(-,root,root,-)
340 %{_bindir}/onert-minimal-app
343 %if %{test_build} == 1
345 %manifest %{name}.manifest
346 %defattr(-,root,root,-)
347 %ifarch arm armv7l armv7hl aarch64 x86_64
348 %dir %{test_install_home}
349 %{test_install_home}/*
350 %endif # arm armv7l armv7hl aarch64
353 %if %{npud_build} == 1
355 %manifest %{name}.manifest
356 %defattr(-,root,root,-)
357 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
359 %endif # arm armv7l armv7hl aarch64 x86_64 %ix86
362 %if %{odc_build} == 1
364 %manifest %{name}.manifest
365 %defattr(-,root,root,-)
366 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
367 %dir %{_libdir}/nnfw/odc
368 %{_libdir}/nnfw/odc/*
369 %endif # arm armv7l armv7hl aarch64 x86_64 %ix86
373 * Thu Mar 15 2018 Chunseok Lee <chunseok.lee@samsung.com>
374 - Initial spec file for nnfw