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 # TODO Update source number
11 Source1001: nnapi_test_generated.tar.gz
12 #Source1002: GTEST.tar.gz
13 Source1003: TENSORFLOW-2.3.0-EIGEN.tar.gz
14 Source1004: GEMMLOWP.tar.gz
15 Source1005: TENSORFLOW-2.8.0-RUY.tar.gz
16 Source1006: CPUINFO.tar.gz
17 Source1007: XNNPACK.tar.gz
18 Source1008: FXDIV.tar.gz
19 Source1009: PTHREADPOOL.tar.gz
20 Source1010: PSIMD.tar.gz
21 Source1011: FP16.tar.gz
22 Source1012: OPENCL_HEADERS.tar.gz
23 Source1013: FARMHASH.tar.gz
24 Source1014: ABSEIL.tar.gz
25 Source1015: OOURAFFT.tar.gz
26 Source1016: TENSORFLOW_GPU.tar.gz
27 Source2001: nnfw.pc.in
28 Source2002: nnfw-plugin.pc.in
30 %{!?build_type: %define build_type Release}
31 %{!?npud_build: %define npud_build 1}
32 %{!?trix_support: %define trix_support 1}
33 %{!?coverage_build: %define coverage_build 0}
34 %{!?test_build: %define test_build 0}
35 %{!?extra_option: %define extra_option %{nil}}
36 %{!?config_support: %define config_support 1}
38 %if %{coverage_build} == 1
39 # Coverage test requires debug build runtime
40 %define build_type Debug
45 # Require flatbuffers-devel for onert frontend (model loading)
46 BuildRequires: pkgconfig(flatbuffers)
48 %ifarch %{arm} aarch64
49 # Require python for acl-ex library build pre-process
50 BuildRequires: python3
51 BuildRequires: libarmcl-devel >= v21.02
54 Requires(post): /sbin/ldconfig
55 Requires(postun): /sbin/ldconfig
57 %if %{test_build} == 1
58 BuildRequires: pkgconfig(boost)
59 BuildRequires: pkgconfig(tensorflow-lite)
60 BuildRequires: hdf5-devel
61 BuildRequires: libaec-devel
62 BuildRequires: pkgconfig(zlib)
63 BuildRequires: pkgconfig(libjpeg)
64 BuildRequires: gtest-devel
67 %if %{npud_build} == 1
68 BuildRequires: pkgconfig(glib-2.0)
71 %if %{trix_support} == 1
72 BuildRequires: pkgconfig(npu-engine)
76 nnfw is a high-performance, on-device neural network framework for Tizen
79 Summary: NNFW Devel Package
80 Requires: %{name} = %{version}-%{release}
83 NNFW development package for application developer using runtime
86 Summary: NNFW Devel Package
87 Requires: %{name}-devel = %{version}-%{release}
89 %description plugin-devel
90 NNFW development package for backend plugin developer
93 Summary: Minimal test binary for VD manual test
95 %description minimal-app
96 Minimal test binary for VD manual test
98 %if %{test_build} == 1
104 If you want to use test package, you should install runtime package which is build with test build option
105 If you want to get coverage info, you should install runtime package which is build with coverage build option
106 # TODO Use release runtime pacakge for test
109 %if %{npud_build} == 1
114 NPU daemon for optimal management of NPU hardware
118 %define target_arch armv7l
121 %define target_arch armv7hl
124 %define target_arch x86_64
127 %define target_arch aarch64
130 %define target_arch i686
133 %define install_dir %{_prefix}
134 %define install_path %{buildroot}%{install_dir}
135 %define nnfw_workspace build
136 %define build_env NNFW_WORKSPACE=%{nnfw_workspace}
138 # Path to install test bin and scripts (test script assumes path Product/out)
139 # TODO Share path with release package
140 %define test_install_home /opt/usr/nnfw-test
141 %define test_install_dir %{test_install_home}/Product/out
142 %define test_install_path %{buildroot}%{test_install_dir}
144 # Set option for test build (and coverage test build)
145 %define option_test -DENABLE_TEST=OFF
146 %define option_coverage %{nil}
147 %define test_suite_list infra/scripts tests/scripts
149 %if %{test_build} == 1
150 # ENVVAR_ONERT_CONFIG: Use environment variable for runtime core configuration and debug
151 %define option_test -DENABLE_TEST=ON -DENVVAR_ONERT_CONFIG=ON
154 # Set option for configuration
155 %define option_config %{nil}
156 %if %{config_support} == 1
157 %if %{npud_build} == 1
158 # ENVVAR_NPUD_CONFIG: Use environment variable for npud configuration and debug
159 %define option_config -DENVVAR_NPUD_CONFIG=ON
161 %endif # config_support
163 %if %{coverage_build} == 1
164 %define option_coverage -DENABLE_COVERAGE=ON
165 %endif # coverage_build
167 %define build_options -DCMAKE_BUILD_TYPE=%{build_type} -DTARGET_ARCH=%{target_arch} -DTARGET_OS=tizen -DBUILD_MINIMAL_SAMPLE=ON \\\
168 %{option_test} %{option_coverage} %{option_config} %{extra_option}
174 tar -xf %{SOURCE1001} -C ./tests/nnapi/src/
175 #tar -xf %{SOURCE1002} -C ./externals
176 tar -xf %{SOURCE1003} -C ./externals
177 tar -xf %{SOURCE1004} -C ./externals
178 tar -xf %{SOURCE1005} -C ./externals
179 tar -xf %{SOURCE1006} -C ./externals
180 tar -xf %{SOURCE1007} -C ./externals
181 tar -xf %{SOURCE1008} -C ./externals
182 tar -xf %{SOURCE1009} -C ./externals
183 tar -xf %{SOURCE1010} -C ./externals
184 tar -xf %{SOURCE1011} -C ./externals
185 tar -xf %{SOURCE1012} -C ./externals
186 tar -xf %{SOURCE1013} -C ./externals
187 tar -xf %{SOURCE1014} -C ./externals
188 tar -xf %{SOURCE1015} -C ./externals
189 tar -xf %{SOURCE1016} -C ./externals
192 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
194 %{build_env} ./nnfw configure %{build_options}
195 %{build_env} ./nnfw build -j4
196 # install in workspace
197 # TODO Set install path
198 %{build_env} ./nnfw install
200 %if %{test_build} == 1
201 %if %{coverage_build} == 1
202 pwd > tests/scripts/build_path.txt
203 %endif # coverage_build
204 tar -zcf test-suite.tar.gz infra/scripts
206 %endif # arm armv7l armv7hl aarch64
209 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
211 mkdir -p %{buildroot}%{_libdir}
212 mkdir -p %{buildroot}%{_bindir}
213 mkdir -p %{buildroot}%{_includedir}
214 install -m 644 build/out/lib/*.so %{buildroot}%{_libdir}
215 install -m 755 build/out/bin/onert-minimal-app %{buildroot}%{_bindir}
216 cp -r build/out/include/* %{buildroot}%{_includedir}/
221 sed -i 's:@libdir@:%{_libdir}:g
222 s:@includedir@:%{_includedir}:g
223 s:@version@:%{version}:g' ./nnfw.pc.in
224 sed -i 's:@libdir@:%{_libdir}:g
225 s:@includedir@:%{_includedir}:g
226 s:@version@:%{version}:g' ./nnfw-plugin.pc.in
227 mkdir -p %{buildroot}%{_libdir}/pkgconfig
228 install -m 0644 ./nnfw.pc.in %{buildroot}%{_libdir}/pkgconfig/nnfw.pc
229 install -m 0644 ./nnfw-plugin.pc.in %{buildroot}%{_libdir}/pkgconfig/nnfw-plugin.pc
231 %if %{test_build} == 1
232 mkdir -p %{test_install_path}/bin
233 mkdir -p %{test_install_path}/unittest
234 mkdir -p %{test_install_path}/unittest_standalone
235 mkdir -p %{test_install_path}/test
237 install -m 755 build/out/bin/nnapi_test %{test_install_path}/bin
238 install -m 755 build/out/bin/nnpackage_run %{test_install_path}/bin
239 install -m 755 build/out/bin/tflite_comparator %{test_install_path}/bin
240 install -m 755 build/out/bin/tflite_run %{test_install_path}/bin
241 install -m 755 build/out/unittest/* %{test_install_path}/unittest
242 install -m 755 build/out/unittest_standalone/*_test %{test_install_path}/unittest_standalone
243 install -m 755 build/out/unittest_standalone/test_* %{test_install_path}/unittest_standalone
244 cp -r build/out/test/* %{test_install_path}/test
245 cp -r build/out/unittest_standalone/nnfw_api_gtest_models %{test_install_path}/unittest_standalone
247 # Share test script with ubuntu (ignore error if there is no list for target)
248 cp tests/nnapi/nnapi_gtest.skip.%{target_arch}-* %{test_install_path}/unittest/.
249 cp %{test_install_path}/unittest/nnapi_gtest.skip.%{target_arch}-linux.cpu %{test_install_path}/unittest/nnapi_gtest.skip
250 tar -zxf test-suite.tar.gz -C %{buildroot}%{test_install_home}
252 %if %{coverage_build} == 1
253 mkdir -p %{buildroot}%{test_install_home}/gcov
254 find %{nnfw_workspace} -name "*.gcno" -exec xargs cp {} %{buildroot}%{test_install_home}/gcov/. \;
255 install -m 0644 ./tests/scripts/build_path.txt %{buildroot}%{test_install_dir}/test/build_path.txt
256 %endif # coverage_build
259 %if %{npud_build} == 1
260 install -m 755 build/out/bin/npud %{buildroot}%{_bindir}
265 %post -p /sbin/ldconfig
266 %postun -p /sbin/ldconfig
269 %manifest %{name}.manifest
270 %defattr(-,root,root,-)
271 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
273 %exclude %{_includedir}/CL/*
277 %manifest %{name}.manifest
278 %defattr(-,root,root,-)
279 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
280 %dir %{_includedir}/nnfw
281 %{_includedir}/nnfw/*
282 %{_libdir}/pkgconfig/nnfw.pc
286 %manifest %{name}.manifest
287 %defattr(-,root,root,-)
288 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
289 %dir %{_includedir}/onert
290 %{_includedir}/onert/*
291 %{_libdir}/pkgconfig/nnfw-plugin.pc
294 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
296 %manifest %{name}.manifest
297 %defattr(-,root,root,-)
298 %{_bindir}/onert-minimal-app
301 %if %{test_build} == 1
303 %manifest %{name}.manifest
304 %defattr(-,root,root,-)
305 %ifarch arm armv7l armv7hl aarch64 x86_64
306 %dir %{test_install_home}
307 %{test_install_home}/*
308 %endif # arm armv7l armv7hl aarch64
311 %if %{npud_build} == 1
313 %manifest %{name}.manifest
314 %defattr(-,root,root,-)
315 %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
317 %endif # arm armv7l armv7hl aarch64 x86_64 %ix86
321 * Thu Mar 15 2018 Chunseok Lee <chunseok.lee@samsung.com>
322 - Initial spec file for nnfw