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 Source2001: nnfw.pc.in
16 Source2002: nnfw-plugin.pc.in
18 %{!?build_type: %define build_type Release}
19 %{!?coverage_build: %define coverage_build 0}
20 %{!?test_build: %define test_build 0}
21 %{!?extra_option: %define extra_option %{nil}}
22 %if %{coverage_build} == 1
27 # Require flatbuffers-devel for onert frontend (model loading)
28 BuildRequires: flatbuffers-devel
30 %ifarch %{arm} aarch64
31 # Require python for acl-ex library build pre-process
33 BuildRequires: libarmcl-devel >= v20.05
36 Requires(post): /sbin/ldconfig
37 Requires(postun): /sbin/ldconfig
39 %if %{test_build} == 1
40 BuildRequires: boost-devel
41 BuildRequires: tensorflow-lite-devel
42 BuildRequires: hdf5-devel
43 BuildRequires: libaec-devel
44 BuildRequires: zlib-devel
45 BuildRequires: libjpeg-devel
49 nnfw is a high-performance, on-device neural network framework for Tizen
52 Summary: NNFW Devel Package
53 Requires: %{name} = %{version}-%{release}
56 NNFW development package for application developer using runtime
59 Summary: NNFW Devel Package
60 Requires: %{name}-devel = %{version}-%{release}
62 %description plugin-devel
63 NNFW development package for backend plugin developer
66 Summary: Minimal test binary for VD manual test
68 %description minimal-app
69 Minimal test binary for VD manual test
71 %if %{test_build} == 1
76 NNFW test rpm. It does not depends on nnfw rpm since it contains nnfw runtime.
80 %define target_arch armv7l
83 %define target_arch x86_64
86 %define target_arch aarch64
89 %define install_dir %{_prefix}
90 %define install_path %{buildroot}%{install_dir}
91 %define build_env NNFW_WORKSPACE=build
92 %define build_options -DCMAKE_BUILD_TYPE=%{build_type} -DTARGET_ARCH=%{target_arch} -DTARGET_OS=tizen -DENABLE_TEST=off -DBUILD_MINIMAL_SAMPLE=on
94 # Set option for test build (and coverage test build)
95 %define test_install_home /opt/usr/nnfw-test
96 %define test_install_dir %{test_install_home}/Product/out
97 %define test_install_path %{buildroot}%{test_install_dir}
98 %define coverage_option %{nil}
99 %define test_suite_list infra/scripts tests/scripts
100 %define test_build_type %{build_type}
101 %if %{coverage_build} == 1
102 %define coverage_option -DENABLE_COVERAGE=ON
103 %define test_build_type Debug
105 %define test_build_env NNFW_INSTALL_PREFIX=%{test_install_path} NNFW_WORKSPACE=build_for_test
106 %define test_build_options %{coverage_option} -DCMAKE_BUILD_TYPE=%{test_build_type} -DTARGET_ARCH=%{target_arch} -DTARGET_OS=tizen -DENVVAR_ONERT_CONFIG=ON
112 tar -xf %{SOURCE1001} -C ./tests/nnapi/src/
113 tar -xf %{SOURCE1002} -C ./externals
114 tar -xf %{SOURCE1003} -C ./externals
115 tar -xf %{SOURCE1004} -C ./externals
116 tar -xf %{SOURCE1005} -C ./externals
119 %ifarch arm armv7l aarch64
121 %{build_env} ./nnfw configure %{build_options} %{extra_option}
122 %{build_env} ./nnfw build -j4
123 # install in workspace
124 # TODO Set install path
125 %{build_env} ./nnfw install
127 %if %{test_build} == 1
129 # TODO remove duplicated build process
130 %{test_build_env} ./nnfw configure %{test_build_options} %{extra_option}
131 %{test_build_env} ./nnfw build -j4
132 %if %{coverage_build} == 1
133 pwd > tests/scripts/build_path.txt
134 %endif # coverage_build
135 tar -zcf test-suite.tar.gz infra/scripts
137 %endif # arm armv7l aarch64
140 %ifarch arm armv7l aarch64
142 mkdir -p %{buildroot}%{_libdir}
143 mkdir -p %{buildroot}%{_bindir}
144 mkdir -p %{buildroot}%{_includedir}
145 install -m 644 build/out/lib/*.so %{buildroot}%{_libdir}
146 install -m 755 build/out/bin/onert-minimal-app %{buildroot}%{_bindir}
147 cp -r build/out/include/* %{buildroot}%{_includedir}/
152 sed -i 's:@libdir@:%{_libdir}:g
153 s:@includedir@:%{_includedir}:g
154 s:@version@:%{version}:g' ./nnfw.pc.in
155 sed -i 's:@libdir@:%{_libdir}:g
156 s:@includedir@:%{_includedir}:g
157 s:@version@:%{version}:g' ./nnfw-plugin.pc.in
158 mkdir -p %{buildroot}%{_libdir}/pkgconfig
159 install -m 0644 ./nnfw.pc.in %{buildroot}%{_libdir}/pkgconfig/nnfw.pc
160 install -m 0644 ./nnfw-plugin.pc.in %{buildroot}%{_libdir}/pkgconfig/nnfw-plugin.pc
162 %if %{test_build} == 1
163 %{test_build_env} ./nnfw install
164 # Share test script with ubuntu (ignore error if there is no list for target)
165 cp tests/nnapi/nnapi_gtest.skip.%{target_arch}-* %{buildroot}%{test_install_dir}/unittest/.
166 cp %{buildroot}%{test_install_dir}/unittest/nnapi_gtest.skip.%{target_arch}-linux.cpu %{buildroot}%{test_install_dir}/unittest/nnapi_gtest.skip
167 tar -zxf test-suite.tar.gz -C %{buildroot}%{test_install_home}
169 %if %{coverage_build} == 1
170 mkdir -p %{buildroot}%{test_install_home}/gcov
171 find . -name "*.gcno" -exec xargs cp {} %{buildroot}%{test_install_home}/gcov/. \;
172 install -m 0644 ./tests/scripts/build_path.txt %{buildroot}%{test_install_dir}/test/build_path.txt
173 %endif # coverage_build
178 %post -p /sbin/ldconfig
179 %postun -p /sbin/ldconfig
182 %manifest %{name}.manifest
183 %defattr(-,root,root,-)
184 %ifarch arm armv7l aarch64
189 %manifest %{name}.manifest
190 %defattr(-,root,root,-)
191 %ifarch arm armv7l aarch64
192 %dir %{_includedir}/nnfw
193 %{_includedir}/nnfw/*
194 %{_libdir}/pkgconfig/nnfw.pc
198 %manifest %{name}.manifest
199 %defattr(-,root,root,-)
200 %ifarch arm armv7l aarch64
201 %dir %{_includedir}/onert
202 %{_includedir}/onert/*
203 %{_libdir}/pkgconfig/nnfw-plugin.pc
207 %manifest %{name}.manifest
208 %defattr(-,root,root,-)
209 %{_bindir}/onert-minimal-app
211 %if %{test_build} == 1
213 %manifest %{name}.manifest
214 %defattr(-,root,root,-)
215 %ifarch arm armv7l aarch64
216 %dir %{test_install_home}
217 %{test_install_home}/*
218 %endif # arm armv7l aarch64
222 * Thu Mar 15 2018 Chunseok Lee <chunseok.lee@samsung.com>
223 - Initial spec file for nnfw