6 License: Apache-2.0 and MIT and BSD-2-Clause
8 Source0: %{name}-%{version}.tar.gz
9 Source1: %{name}.manifest
10 Source1001: nnapi_test_generated.tar.gz
11 Source1002: gtest.tar.gz
12 Source1003: eigen.tar.gz
13 Source1004: gemmlowp.tar.gz
14 Source1005: ruy.tar.gz
15 Source1006: cpuinfo.tar.gz
16 Source1007: XNNPACK.tar.gz
17 Source1008: FXDIV.tar.gz
18 Source1009: PTHREADPOOL.tar.gz
19 Source1010: PSIMD.tar.gz
20 Source1011: FP16.tar.gz
21 Source2001: nnfw.pc.in
22 Source2002: nnfw-plugin.pc.in
24 %{!?build_type: %define build_type Release}
25 %{!?coverage_build: %define coverage_build 0}
26 %{!?test_build: %define test_build 0}
27 %{!?extra_option: %define extra_option %{nil}}
28 %if %{coverage_build} == 1
33 # Require flatbuffers-devel for onert frontend (model loading)
34 BuildRequires: flatbuffers-devel
36 %ifarch %{arm} aarch64
37 # Require python for acl-ex library build pre-process
39 BuildRequires: libarmcl-devel >= v20.05
42 Requires(post): /sbin/ldconfig
43 Requires(postun): /sbin/ldconfig
45 %if %{test_build} == 1
46 BuildRequires: boost-devel
47 BuildRequires: tensorflow-lite-devel
48 BuildRequires: hdf5-devel
49 BuildRequires: libaec-devel
50 BuildRequires: zlib-devel
51 BuildRequires: libjpeg-devel
55 nnfw is a high-performance, on-device neural network framework for Tizen
58 Summary: NNFW Devel Package
59 Requires: %{name} = %{version}-%{release}
62 NNFW development package for application developer using runtime
65 Summary: NNFW Devel Package
66 Requires: %{name}-devel = %{version}-%{release}
68 %description plugin-devel
69 NNFW development package for backend plugin developer
72 Summary: Minimal test binary for VD manual test
74 %description minimal-app
75 Minimal test binary for VD manual test
77 %if %{test_build} == 1
82 NNFW test rpm. It does not depends on nnfw rpm since it contains nnfw runtime.
86 %define target_arch armv7l
89 %define target_arch x86_64
92 %define target_arch aarch64
95 %define install_dir %{_prefix}
96 %define install_path %{buildroot}%{install_dir}
97 %define build_env NNFW_WORKSPACE=build
98 %define build_options -DCMAKE_BUILD_TYPE=%{build_type} -DTARGET_ARCH=%{target_arch} -DTARGET_OS=tizen -DENABLE_TEST=off -DBUILD_MINIMAL_SAMPLE=on
100 # Set option for test build (and coverage test build)
101 %define test_install_home /opt/usr/nnfw-test
102 %define test_install_dir %{test_install_home}/Product/out
103 %define test_install_path %{buildroot}%{test_install_dir}
104 %define coverage_option %{nil}
105 %define test_suite_list infra/scripts tests/scripts
106 %define test_build_type %{build_type}
107 %if %{coverage_build} == 1
108 %define coverage_option -DENABLE_COVERAGE=ON
109 %define test_build_type Debug
111 %define test_build_env NNFW_INSTALL_PREFIX=%{test_install_path} NNFW_WORKSPACE=build_for_test
112 %define test_build_options %{coverage_option} -DCMAKE_BUILD_TYPE=%{test_build_type} -DTARGET_ARCH=%{target_arch} -DTARGET_OS=tizen -DENVVAR_ONERT_CONFIG=ON
118 tar -xf %{SOURCE1001} -C ./tests/nnapi/src/
119 tar -xf %{SOURCE1002} -C ./externals
120 tar -xf %{SOURCE1003} -C ./externals
121 tar -xf %{SOURCE1004} -C ./externals
122 tar -xf %{SOURCE1005} -C ./externals
123 tar -xf %{SOURCE1006} -C ./externals
124 tar -xf %{SOURCE1007} -C ./externals
125 tar -xf %{SOURCE1008} -C ./externals
126 tar -xf %{SOURCE1009} -C ./externals
127 tar -xf %{SOURCE1010} -C ./externals
128 tar -xf %{SOURCE1011} -C ./externals
131 %ifarch arm armv7l aarch64 x86_64
133 %{build_env} ./nnfw configure %{build_options} %{extra_option}
134 %{build_env} ./nnfw build -j4
135 # install in workspace
136 # TODO Set install path
137 %{build_env} ./nnfw install
139 %if %{test_build} == 1
141 # TODO remove duplicated build process
142 %{test_build_env} ./nnfw configure %{test_build_options} %{extra_option}
143 %{test_build_env} ./nnfw build -j4
144 %if %{coverage_build} == 1
145 pwd > tests/scripts/build_path.txt
146 %endif # coverage_build
147 tar -zcf test-suite.tar.gz infra/scripts
149 %endif # arm armv7l aarch64
152 %ifarch arm armv7l aarch64 x86_64
154 mkdir -p %{buildroot}%{_libdir}
155 mkdir -p %{buildroot}%{_bindir}
156 mkdir -p %{buildroot}%{_includedir}
157 install -m 644 build/out/lib/*.so %{buildroot}%{_libdir}
158 install -m 755 build/out/bin/onert-minimal-app %{buildroot}%{_bindir}
159 cp -r build/out/include/* %{buildroot}%{_includedir}/
164 sed -i 's:@libdir@:%{_libdir}:g
165 s:@includedir@:%{_includedir}:g
166 s:@version@:%{version}:g' ./nnfw.pc.in
167 sed -i 's:@libdir@:%{_libdir}:g
168 s:@includedir@:%{_includedir}:g
169 s:@version@:%{version}:g' ./nnfw-plugin.pc.in
170 mkdir -p %{buildroot}%{_libdir}/pkgconfig
171 install -m 0644 ./nnfw.pc.in %{buildroot}%{_libdir}/pkgconfig/nnfw.pc
172 install -m 0644 ./nnfw-plugin.pc.in %{buildroot}%{_libdir}/pkgconfig/nnfw-plugin.pc
174 %if %{test_build} == 1
175 %{test_build_env} ./nnfw install
176 # Share test script with ubuntu (ignore error if there is no list for target)
177 cp tests/nnapi/nnapi_gtest.skip.%{target_arch}-* %{buildroot}%{test_install_dir}/unittest/.
178 cp %{buildroot}%{test_install_dir}/unittest/nnapi_gtest.skip.%{target_arch}-linux.cpu %{buildroot}%{test_install_dir}/unittest/nnapi_gtest.skip
179 tar -zxf test-suite.tar.gz -C %{buildroot}%{test_install_home}
181 %if %{coverage_build} == 1
182 mkdir -p %{buildroot}%{test_install_home}/gcov
183 find . -name "*.gcno" -exec xargs cp {} %{buildroot}%{test_install_home}/gcov/. \;
184 install -m 0644 ./tests/scripts/build_path.txt %{buildroot}%{test_install_dir}/test/build_path.txt
185 %endif # coverage_build
190 %post -p /sbin/ldconfig
191 %postun -p /sbin/ldconfig
194 %manifest %{name}.manifest
195 %defattr(-,root,root,-)
196 %ifarch arm armv7l aarch64 x86_64
201 %manifest %{name}.manifest
202 %defattr(-,root,root,-)
203 %ifarch arm armv7l aarch64 x86_64
204 %dir %{_includedir}/nnfw
205 %{_includedir}/nnfw/*
206 %{_libdir}/pkgconfig/nnfw.pc
210 %manifest %{name}.manifest
211 %defattr(-,root,root,-)
212 %ifarch arm armv7l aarch64 x86_64
213 %dir %{_includedir}/onert
214 %{_includedir}/onert/*
215 %{_libdir}/pkgconfig/nnfw-plugin.pc
218 %ifarch arm armv7l aarch64 x86_64
220 %manifest %{name}.manifest
221 %defattr(-,root,root,-)
222 %{_bindir}/onert-minimal-app
225 %if %{test_build} == 1
227 %manifest %{name}.manifest
228 %defattr(-,root,root,-)
229 %ifarch arm armv7l aarch64 x86_64
230 %dir %{test_install_home}
231 %{test_install_home}/*
232 %endif # arm armv7l aarch64
236 * Thu Mar 15 2018 Chunseok Lee <chunseok.lee@samsung.com>
237 - Initial spec file for nnfw