summaryrefslogtreecommitdiff
path: root/packaging/nnfw.spec
blob: 40459890ce46ff18dfd719bbf6dff4228c16ce40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
Name:    nnfw
Summary: nnfw
Version: 0.3
Release: 1
Group:   Development
License: Apache-2.0 and MIT and BSD-2-Clause

Source0: %{name}-%{version}.tar.gz
Source1: %{name}.manifest
Source1001: flatbuffers.tar.gz

%ifarch arm armv7l aarch64
BuildRequires:	cmake
BuildRequires:	python
BuildRequires:	python3
BuildRequires:	boost-devel
BuildRequires:	gtest-devel
BuildRequires:	tensorflow-lite-devel

BuildRequires:	libarmcl-devel
%endif

Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig

%description
nnfw is a high-performance, on-device neural network framework for Tizen

%{!?build_type: %define build_type Release}

%package devel
Summary: NNFW Devel Package
Requires: nnfw

%description devel
NNFW devel package.

%package test
Summary: NNFW Test
Requires: nnfw

%description test
NNFW test rpm. It does not depends on nnfw rpm since it contains nnfw runtime.

%define test_install_prefix /opt/usr/nnfw-test

%ifarch %{arm}
%define target_arch armv7l
%endif
%ifarch x86_64
%define target_arch x86_64
%endif
%ifarch aarch64
%define target_arch aarch64
%endif

# Execute gbs with --define "test_build 1" in case that you need to test with environment variable
%{!?test_build: %define test_build 0}
%{!?coverage_build: %define coverage_build 0}
%if %{coverage_build} == 1
%define build_options COVERAGE_BUILD=1 OBS_BUILD=1 BUILD_TYPE=Debug TARGET_ARCH=%{target_arch} TARGET_OS=tizen TFLITE_MAJOR_VER=1 TFLITE_MINOR_VER=13 OPTIONS=-DENVVAR_NEURUN_CONFIG=ON
%else
%if %{test_build} == 1
%define build_options OBS_BUILD=1 BUILD_TYPE=%{build_type} INSTALL_PATH=%{buildroot}%{_prefix} TARGET_ARCH=%{target_arch} TARGET_OS=tizen TFLITE_MAJOR_VER=1 TFLITE_MINOR_VER=13 OPTIONS=-DENVVAR_NEURUN_CONFIG=ON
%else
%define build_options OBS_BUILD=1 BUILD_TYPE=%{build_type} INSTALL_PATH=%{buildroot}%{_prefix} TARGET_ARCH=%{target_arch} TARGET_OS=tizen TFLITE_MAJOR_VER=1 TFLITE_MINOR_VER=13
%endif
%endif

%prep
%setup -q
cp %{SOURCE1} .
mkdir ./externals
cp %{SOURCE1001} ./externals/.
cd ./externals
tar -xf %{SOURCE1001}

%build
%ifarch arm armv7l aarch64
cp -v Makefile.template Makefile
chmod +x ./nnfw
chmod +x ./tests/nnapi/nnapi_test_generator/android-p/test_generator.py
%{build_options} make %{?jobs:-j%jobs} all
%endif

%install
%ifarch arm armv7l aarch64
%{build_options} make install

# copy header's for devel
mkdir -p %{buildroot}%{_includedir}
cp -rf runtimes/include/* %{buildroot}%{_includedir}

%ifarch aarch64
mv %{buildroot}%{_prefix}/lib %{buildroot}%{_libdir}
%endif

%if %{coverage_build} == 0
# nnfw-test rpm(like test-suite on cross build)
## install Product
mkdir -p %{buildroot}%{test_install_prefix}/Product/out
mv %{buildroot}%{_prefix}/unittest %{buildroot}%{test_install_prefix}/Product/out
mv %{buildroot}%{_prefix}/bin %{buildroot}%{test_install_prefix}/Product/out
cp -rf %{buildroot}%{_libdir} %{buildroot}%{test_install_prefix}/Product/out
rm -rf %{buildroot}%{_libdir}/pureacl
## install tests
mkdir -p %{buildroot}%{test_install_prefix}/tests
cp -rf ./tests/framework %{buildroot}%{test_install_prefix}/tests
## install tools
mkdir -p %{buildroot}%{test_install_prefix}/tools
cp -rf ./tests/scripts %{buildroot}%{test_install_prefix}/tests
## install infra
mkdir -p %{buildroot}%{test_install_prefix}/infra
cp -rf ./infra/scripts/ %{buildroot}%{test_install_prefix}/infra
%else
%{build_options}  make build_coverage_suite
mkdir -p %{buildroot}%{test_install_prefix}
cp -rf Product/out/coverage-suite.tar.gz %{buildroot}%{test_install_prefix}/.
tar -zxf %{buildroot}%{test_install_prefix}/coverage-suite.tar.gz -C %{buildroot}%{test_install_prefix}
rm -rf %{buildroot}%{test_install_prefix}/coverage-suite.tar.gz
%endif
%endif

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%manifest %{name}.manifest
%defattr(-,root,root,-)
%ifarch arm armv7l aarch64
%{_libdir}/*
%exclude %{_prefix}/bin/*
%exclude %{_prefix}/unittest/*
%exclude %{_libdir}/debug
%endif

%files devel
%manifest %{name}.manifest
%defattr(-,root,root,-)
%ifarch arm armv7l aarch64
%{_includedir}/*
%endif

%files test
%manifest %{name}.manifest
%defattr(-,root,root,-)
%ifarch arm armv7l aarch64
%{test_install_prefix}/*
%exclude %{_libdir}/debug
%endif

%changelog
* Thu Mar 15 2018 Chunseok Lee <chunseok.lee@samsung.com>
- Initial spec file for nnfw