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 Source2001: nnfw.pc.in
17 Source2002: nnfw-plugin.pc.in
19 %{!?build_type: %define build_type Release}
20 %{!?coverage_build: %define coverage_build 0}
21 %{!?test_build: %define test_build 0}
22 %{!?extra_option: %define extra_option %{nil}}
23 %if %{coverage_build} == 1
28 # Require flatbuffers-devel for onert frontend (model loading)
29 BuildRequires: flatbuffers-devel
31 %ifarch %{arm} aarch64
32 # Require python for acl-ex library build pre-process
34 BuildRequires: libarmcl-devel >= v20.05
37 Requires(post): /sbin/ldconfig
38 Requires(postun): /sbin/ldconfig
40 %if %{test_build} == 1
41 BuildRequires: boost-devel
42 BuildRequires: tensorflow-lite-devel
43 BuildRequires: hdf5-devel
44 BuildRequires: libaec-devel
45 BuildRequires: zlib-devel
46 BuildRequires: libjpeg-devel
50 nnfw is a high-performance, on-device neural network framework for Tizen
53 Summary: NNFW Devel Package
54 Requires: %{name} = %{version}-%{release}
57 NNFW development package for application developer using runtime
60 Summary: NNFW Devel Package
61 Requires: %{name}-devel = %{version}-%{release}
63 %description plugin-devel
64 NNFW development package for backend plugin developer
67 Summary: Minimal test binary for VD manual test
69 %description minimal-app
70 Minimal test binary for VD manual test
72 %if %{test_build} == 1
77 NNFW test rpm. It does not depends on nnfw rpm since it contains nnfw runtime.
81 %define target_arch armv7l
84 %define target_arch x86_64
87 %define target_arch aarch64
90 %define install_dir %{_prefix}
91 %define install_path %{buildroot}%{install_dir}
92 %define build_env NNFW_WORKSPACE=build
93 %define build_options -DCMAKE_BUILD_TYPE=%{build_type} -DTARGET_ARCH=%{target_arch} -DTARGET_OS=tizen -DENABLE_TEST=off -DBUILD_MINIMAL_SAMPLE=on
95 # Set option for test build (and coverage test build)
96 %define test_install_home /opt/usr/nnfw-test
97 %define test_install_dir %{test_install_home}/Product/out
98 %define test_install_path %{buildroot}%{test_install_dir}
99 %define coverage_option %{nil}
100 %define test_suite_list infra/scripts tests/scripts
101 %define test_build_type %{build_type}
102 %if %{coverage_build} == 1
103 %define coverage_option -DENABLE_COVERAGE=ON
104 %define test_build_type Debug
106 %define test_build_env NNFW_INSTALL_PREFIX=%{test_install_path} NNFW_WORKSPACE=build_for_test
107 %define test_build_options %{coverage_option} -DCMAKE_BUILD_TYPE=%{test_build_type} -DTARGET_ARCH=%{target_arch} -DTARGET_OS=tizen -DENVVAR_ONERT_CONFIG=ON
113 tar -xf %{SOURCE1001} -C ./tests/nnapi/src/
114 tar -xf %{SOURCE1002} -C ./externals
115 tar -xf %{SOURCE1003} -C ./externals
116 tar -xf %{SOURCE1004} -C ./externals
117 tar -xf %{SOURCE1005} -C ./externals
118 tar -xf %{SOURCE1006} -C ./externals
121 %ifarch arm armv7l aarch64 x86_64
123 %{build_env} ./nnfw configure %{build_options} %{extra_option}
124 %{build_env} ./nnfw build -j4
125 # install in workspace
126 # TODO Set install path
127 %{build_env} ./nnfw install
129 %if %{test_build} == 1
131 # TODO remove duplicated build process
132 %{test_build_env} ./nnfw configure %{test_build_options} %{extra_option}
133 %{test_build_env} ./nnfw build -j4
134 %if %{coverage_build} == 1
135 pwd > tests/scripts/build_path.txt
136 %endif # coverage_build
137 tar -zcf test-suite.tar.gz infra/scripts
139 %endif # arm armv7l aarch64
142 %ifarch arm armv7l aarch64 x86_64
144 mkdir -p %{buildroot}%{_libdir}
145 mkdir -p %{buildroot}%{_bindir}
146 mkdir -p %{buildroot}%{_includedir}
147 install -m 644 build/out/lib/*.so %{buildroot}%{_libdir}
148 install -m 755 build/out/bin/onert-minimal-app %{buildroot}%{_bindir}
149 cp -r build/out/include/* %{buildroot}%{_includedir}/
154 sed -i 's:@libdir@:%{_libdir}:g
155 s:@includedir@:%{_includedir}:g
156 s:@version@:%{version}:g' ./nnfw.pc.in
157 sed -i 's:@libdir@:%{_libdir}:g
158 s:@includedir@:%{_includedir}:g
159 s:@version@:%{version}:g' ./nnfw-plugin.pc.in
160 mkdir -p %{buildroot}%{_libdir}/pkgconfig
161 install -m 0644 ./nnfw.pc.in %{buildroot}%{_libdir}/pkgconfig/nnfw.pc
162 install -m 0644 ./nnfw-plugin.pc.in %{buildroot}%{_libdir}/pkgconfig/nnfw-plugin.pc
164 %if %{test_build} == 1
165 %{test_build_env} ./nnfw install
166 # Share test script with ubuntu (ignore error if there is no list for target)
167 cp tests/nnapi/nnapi_gtest.skip.%{target_arch}-* %{buildroot}%{test_install_dir}/unittest/.
168 cp %{buildroot}%{test_install_dir}/unittest/nnapi_gtest.skip.%{target_arch}-linux.cpu %{buildroot}%{test_install_dir}/unittest/nnapi_gtest.skip
169 tar -zxf test-suite.tar.gz -C %{buildroot}%{test_install_home}
171 %if %{coverage_build} == 1
172 mkdir -p %{buildroot}%{test_install_home}/gcov
173 find . -name "*.gcno" -exec xargs cp {} %{buildroot}%{test_install_home}/gcov/. \;
174 install -m 0644 ./tests/scripts/build_path.txt %{buildroot}%{test_install_dir}/test/build_path.txt
175 %endif # coverage_build
180 %post -p /sbin/ldconfig
181 %postun -p /sbin/ldconfig
184 %manifest %{name}.manifest
185 %defattr(-,root,root,-)
186 %ifarch arm armv7l aarch64 x86_64
191 %manifest %{name}.manifest
192 %defattr(-,root,root,-)
193 %ifarch arm armv7l aarch64 x86_64
194 %dir %{_includedir}/nnfw
195 %{_includedir}/nnfw/*
196 %{_libdir}/pkgconfig/nnfw.pc
200 %manifest %{name}.manifest
201 %defattr(-,root,root,-)
202 %ifarch arm armv7l aarch64 x86_64
203 %dir %{_includedir}/onert
204 %{_includedir}/onert/*
205 %{_libdir}/pkgconfig/nnfw-plugin.pc
208 %ifarch arm armv7l aarch64 x86_64
210 %manifest %{name}.manifest
211 %defattr(-,root,root,-)
212 %{_bindir}/onert-minimal-app
215 %if %{test_build} == 1
217 %manifest %{name}.manifest
218 %defattr(-,root,root,-)
219 %ifarch arm armv7l aarch64 x86_64
220 %dir %{test_install_home}
221 %{test_install_home}/*
222 %endif # arm armv7l aarch64
226 * Thu Mar 15 2018 Chunseok Lee <chunseok.lee@samsung.com>
227 - Initial spec file for nnfw