Release version 0.14.0
[platform/core/base/bundle.git] / packaging / bundle.spec
1 Name:       bundle
2 Summary:    String key-val dictionary ADT
3 Version:    0.14.0
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 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
138 %cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
139 %__make %{?_smp_mflags}
140
141 %check
142 export LD_LIBRARY_PATH="../../src/bundle:../../src/parcel"
143 ctest --verbose %{?_smp_mflags}
144 %if 0%{?gcov:1}
145 lcov -c --ignore-errors mismatch,graph,unused --no-external -b . -d . -o %{name}.info
146 genhtml %{name}.info -o out --legend --show-details
147 %endif
148
149 %install
150 %make_install
151
152 %if 0%{?gcov:1}
153 builddir=$(basename $PWD)
154 gcno_obj_dir=%{buildroot}%{_datadir}/gcov/obj/%{name}/"$builddir"
155 mkdir -p "$gcno_obj_dir"
156 find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';'
157 %endif
158
159 cat << EOF > run-unittest.sh
160 #!/bin/sh
161 GCOV_PATH="/tmp/home/abuild/rpmbuild/BUILD"
162 PAKCAGE="<NAME>-%{version}"
163
164 set_perm() {
165     ## Sets the permission for applications
166     /usr/bin/find /tmp/home/ -print | /usr/bin/xargs -n1 /usr/bin/chsmack -a "System::Run" &> /dev/null
167     /usr/bin/find /tmp/home/ -print | /usr/bin/xargs -n1 /usr/bin/chsmack -a "System::Run" -t &> /dev/null
168     /usr/bin/chmod -R 777 /tmp/home/
169 }
170
171 setup() {
172     echo "setup start"
173     /usr/bin/mkdir -p "${GCOV_PATH}/${PACKAGE}"
174     set_perm
175 }
176
177 test_main() {
178     echo "test_main start"
179     export "GCOV_PREFIX=/tmp"
180     /usr/bin/<NAME>_unittests
181 }
182
183 teardown() {
184     echo "teardown start"
185     set_perm
186 }
187
188 main() {
189     setup
190     test_main
191     teardown
192 }
193
194 main "\$*"
195 EOF
196
197 mkdir -p %{buildroot}%{_bindir}/tizen-unittests/%{name}
198 install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}/
199 sed -i -e 's/<NAME>/bundle/g' %{buildroot}%{_bindir}/tizen-unittests/%{name}/run-unittest.sh
200
201 mkdir -p %{buildroot}%{_bindir}/tizen-unittests/parcel
202 install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/parcel/
203 sed -i -e 's/<NAME>/parcel/g' %{buildroot}%{_bindir}/tizen-unittests/parcel/run-unittest.sh
204
205 mkdir -p %{buildroot}%{_bindir}/tizen-unittests/tizen-database
206 install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/tizen-database/
207 sed -i -e 's/<NAME>/tizen-database/g' %{buildroot}%{_bindir}/tizen-unittests/tizen-database/run-unittest.sh
208
209 mkdir -p %{buildroot}%{_bindir}/tizen-unittests/tizen-shared-queue
210 install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/tizen-shared-queue/
211 sed -i -e 's/<NAME>/tizen-shared-queue/g' %{buildroot}%{_bindir}/tizen-unittests/tizen-shared-queue/run-unittest.sh
212
213 %post -p /sbin/ldconfig
214
215 %postun -p /sbin/ldconfig
216
217 %post -n parcel
218 /sbin/ldconfig
219
220 %postun -n parcel
221 /sbin/ldconfig
222
223 %post unittests
224 %if 0%{?gcov:1}
225 %{_bindir}/bundle_unittests
226 %endif
227
228 %files
229 %manifest %{name}.manifest
230 %defattr(-,root,root,-)
231 %{_libdir}/libbundle.so.*
232 %license LICENSE
233
234 %files devel
235 %manifest %{name}.manifest
236 %defattr(-,root,root,-)
237 %{_includedir}/*.h
238 %{_libdir}/pkgconfig/bundle.pc
239 %{_libdir}/libbundle.so
240
241 #################################################
242 # unittests
243 #################################################
244 %files unittests
245 %{_bindir}/bundle_unittests
246 %{_bindir}/tizen-unittests/%{name}/run-unittest.sh
247
248 #################################################
249 # bundle-gcov
250 #################################################
251 %if 0%{?gcov:1}
252 %files gcov
253 %{_datadir}/gcov/obj/*
254 %endif
255
256 #################################################
257 # parcel
258 #################################################
259 %files -n parcel
260 %manifest parcel.manifest
261 %license LICENSE
262 %{_libdir}/libparcel.so.*
263
264 %files -n parcel-devel
265 %manifest parcel.manifest
266 %{_includedir}/parcel/*
267 %{_libdir}/pkgconfig/parcel.pc
268 %{_libdir}/libparcel.so
269
270 %files -n parcel-unittests
271 %{_bindir}/parcel_unittests
272 %{_bindir}/tizen-unittests/parcel/run-unittest.sh
273
274 #################################################
275 # tizen-database-devel
276 #################################################
277 %files -n tizen-database-devel
278 %{_includedir}/tizen-database/*
279 %{_libdir}/pkgconfig/tizen-database.pc
280
281 %files -n tizen-database-unittests
282 %{_bindir}/tizen-database_unittests
283 %{_bindir}/tizen-unittests/tizen-database/run-unittest.sh
284
285 #################################################
286 # tizen-shared-queue-devel
287 #################################################
288 %files -n tizen-shared-queue-devel
289 %{_includedir}/tizen-shared-queue/*
290 %{_libdir}/pkgconfig/tizen-shared-queue.pc
291
292 %files -n tizen-shared-queue-unittests
293 %{_bindir}/tizen-shared-queue_unittests
294 %{_bindir}/tizen-unittests/tizen-shared-queue/run-unittest.sh