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