Remove conditional statements for Moible/Wearable profile
[platform/core/base/bundle.git] / packaging / bundle.spec
1 Name:       bundle
2 Summary:    String key-val dictionary ADT
3 Version:    0.13.6
4 Release:    0
5 Group:      System/Libraries
6 License:    Apache-2.0
7 Source0:        bundle-%{version}.tar.gz
8 Source1001:     bundle.manifest
9 Source1002:     parcel.manifest
10 BuildRequires:  cmake
11 BuildRequires:  pkgconfig(glib-2.0)
12 BuildRequires:  pkgconfig(dlog)
13 BuildRequires:  pkgconfig(capi-base-common)
14 BuildRequires:  pkgconfig(json-glib-1.0)
15 BuildRequires:  pkgconfig(sqlite3)
16 BuildRequires:  pkgconfig(gmock)
17
18 %if 0%{?gcov:1}
19 BuildRequires:  lcov
20 BuildRequires:  zip
21 %endif
22
23 %description
24 Simple string key-val dictionary ADT
25
26 %package devel
27 Summary:    String key-val dictionary ADT (devel)
28 Group:      Development/Libraries
29 Requires:   %{name} = %{version}-%{release}
30
31 %description devel
32 Simple string key-val dictionary ADT (devel)
33
34 #################################################
35 # unittests
36 #################################################
37 %package unittests
38 Summary:    GTest for bundle
39 Group:      Development/Libraries
40
41 %description unittests
42 GTest for bundle
43
44 #################################################
45 # gcov
46 #################################################
47 %if 0%{?gcov:1}
48 %package gcov
49 Summary:    Simple string key-val dictionary ADT (gcov)
50 Group:      Application Framework/Testing
51
52 %description gcov
53 Simple string key-val dictionary ADT gcov objects
54 %endif
55
56 #################################################
57 ## parcel
58 #################################################
59 %package -n parcel
60 Summary:    Parcel Library
61 Group:      Development/Libraries
62
63 %description -n parcel
64 Parcel Library
65
66 %package -n parcel-devel
67 Summary:    Parcel Library (devel)
68 Group:      Development/Libraries
69 Requires:   parcel = %{version}-%{release}
70
71 %description -n parcel-devel
72 Parcel Library (devel)
73
74 #################################################
75 # parcel-unittests
76 #################################################
77 %package -n parcel-unittests
78 Summary:    GTest for parcel
79 Group:      Development/Libraries
80
81 %description -n parcel-unittests
82 GTest for parcel
83
84 #################################################
85 ## tizen-database-devel
86 #################################################
87 %package -n tizen-database-devel
88 Summary:    Tizen-database Library (devel)
89 Group:      Development/Libraries
90
91 %description -n tizen-database-devel
92 Tizen-database Library (devel)
93
94 #################################################
95 # tizen-database-unittests
96 #################################################
97 %package -n tizen-database-unittests
98 Summary:    GTest for tizen-database
99 Group:      Development/Libraries
100
101 %description -n tizen-database-unittests
102 GTest for tizen-database
103
104 #################################################
105 ## tizen-shared-queue-devel
106 #################################################
107 %package -n tizen-shared-queue-devel
108 Summary:    Tizen-shared-queue Library (devel)
109 Group:      Development/Libraries
110
111 %description -n tizen-shared-queue-devel
112 Tizen-Shared-Queue Library (devel)
113
114 #################################################
115 # tizen-shared-queue-unittests
116 #################################################
117 %package -n tizen-shared-queue-unittests
118 Summary:    GTest for tizen-shared-queue
119 Group:      Development/Libraries
120
121 %description -n tizen-shared-queue-unittests
122 GTest for tizen-shared-queue
123
124 %prep
125 %setup -q -n %{name}-%{version}
126 cp %{SOURCE1001} .
127 cp %{SOURCE1002} .
128
129 %build
130 %if 0%{?gcov:1}
131 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
132 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
133 export FFLAGS+=" -fprofile-arcs -ftest-coverage"
134 export LDFLAGS+=" -lgcov"
135 %endif
136
137 %cmake -DVERSION=%{version} .
138 %__make %{?_smp_mflags}
139
140 %check
141 ctest --verbose %{?_smp_mflags}
142 %if 0%{?gcov:1}
143 lcov -c --ignore-errors graph --no-external -b . -d . -o %{name}.info
144 genhtml %{name}.info -o out --legend --show-details
145 %endif
146
147 %install
148 %make_install
149
150 %if 0%{?gcov:1}
151 builddir=$(basename $PWD)
152 gcno_obj_dir=%{buildroot}%{_datadir}/gcov/obj/%{name}/"$builddir"
153 mkdir -p "$gcno_obj_dir"
154 find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';'
155 %endif
156
157 cat << EOF > run-unittest.sh
158 #!/bin/sh
159 GCOV_PATH="/tmp/home/abuild/rpmbuild/BUILD"
160 PAKCAGE="<NAME>-%{version}"
161
162 set_perm() {
163     ## Sets the permission for applications
164     /usr/bin/find /tmp/home/ -print | /usr/bin/xargs -n1 /usr/bin/chsmack -a "System::Run" &> /dev/null
165     /usr/bin/find /tmp/home/ -print | /usr/bin/xargs -n1 /usr/bin/chsmack -a "System::Run" -t &> /dev/null
166     /usr/bin/chmod -R 777 /tmp/home/
167 }
168
169 setup() {
170     echo "setup start"
171     /usr/bin/mkdir -p "${GCOV_PATH}/${PACKAGE}"
172     set_perm
173 }
174
175 test_main() {
176     echo "test_main start"
177     export "GCOV_PREFIX=/tmp"
178     /usr/bin/<NAME>_unittests
179 }
180
181 teardown() {
182     echo "teardown start"
183     set_perm
184 }
185
186 main() {
187     setup
188     test_main
189     teardown
190 }
191
192 main "\$*"
193 EOF
194
195 mkdir -p %{buildroot}%{_bindir}/tizen-unittests/%{name}
196 install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}/
197 sed -i -e 's/<NAME>/bundle/g' %{buildroot}%{_bindir}/tizen-unittests/%{name}/run-unittest.sh
198
199 mkdir -p %{buildroot}%{_bindir}/tizen-unittests/parcel
200 install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/parcel/
201 sed -i -e 's/<NAME>/parcel/g' %{buildroot}%{_bindir}/tizen-unittests/parcel/run-unittest.sh
202
203 mkdir -p %{buildroot}%{_bindir}/tizen-unittests/tizen-database
204 install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/tizen-database/
205 sed -i -e 's/<NAME>/tizen-database/g' %{buildroot}%{_bindir}/tizen-unittests/tizen-database/run-unittest.sh
206
207 mkdir -p %{buildroot}%{_bindir}/tizen-unittests/tizen-shared-queue
208 install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/tizen-shared-queue/
209 sed -i -e 's/<NAME>/tizen-shared-queue/g' %{buildroot}%{_bindir}/tizen-unittests/tizen-shared-queue/run-unittest.sh
210
211 %post -p /sbin/ldconfig
212
213 %postun -p /sbin/ldconfig
214
215 %post -n parcel
216 /sbin/ldconfig
217
218 %postun -n parcel
219 /sbin/ldconfig
220
221 %post unittests
222 %if 0%{?gcov:1}
223 %{_bindir}/bundle_unittests
224 %endif
225
226 %files
227 %manifest %{name}.manifest
228 %defattr(-,root,root,-)
229 %{_libdir}/libbundle.so.*
230 %license LICENSE
231
232 %files devel
233 %manifest %{name}.manifest
234 %defattr(-,root,root,-)
235 %{_includedir}/*.h
236 %{_libdir}/pkgconfig/bundle.pc
237 %{_libdir}/libbundle.so
238
239 #################################################
240 # unittests
241 #################################################
242 %files unittests
243 %{_bindir}/bundle_unittests
244 %{_bindir}/tizen-unittests/%{name}/run-unittest.sh
245
246 #################################################
247 # bundle-gcov
248 #################################################
249 %if 0%{?gcov:1}
250 %files gcov
251 %{_datadir}/gcov/obj/*
252 %endif
253
254 #################################################
255 # parcel
256 #################################################
257 %files -n parcel
258 %manifest parcel.manifest
259 %license LICENSE
260 %{_libdir}/libparcel.so.*
261
262 %files -n parcel-devel
263 %manifest parcel.manifest
264 %{_includedir}/*
265 %{_libdir}/pkgconfig/parcel.pc
266 %{_libdir}/libparcel.so
267
268 %files -n parcel-unittests
269 %{_bindir}/parcel_unittests
270 %{_bindir}/tizen-unittests/parcel/run-unittest.sh
271
272 #################################################
273 # tizen-database-devel
274 #################################################
275 %files -n tizen-database-devel
276 %{_includedir}/tizen-database/*
277 %{_libdir}/pkgconfig/tizen-database.pc
278
279 %files -n tizen-database-unittests
280 %{_bindir}/tizen-database_unittests
281 %{_bindir}/tizen-unittests/tizen-database/run-unittest.sh
282
283 #################################################
284 # tizen-shared-queue-devel
285 #################################################
286 %files -n tizen-shared-queue-devel
287 %{_includedir}/tizen-shared-queue/*
288 %{_libdir}/pkgconfig/tizen-shared-queue.pc
289
290 %files -n tizen-shared-queue-unittests
291 %{_bindir}/tizen-shared-queue_unittests
292 %{_bindir}/tizen-unittests/tizen-shared-queue/run-unittest.sh