Release version 0.9.10
[platform/core/base/bundle.git] / packaging / bundle.spec
1 Name:       bundle
2 Summary:    String key-val dictionary ADT
3 Version:    0.9.10
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(gmock)
16
17 %if 0%{?gcov:1}
18 BuildRequires:  lcov
19 BuildRequires:  zip
20 %endif
21
22 %description
23 Simple string key-val dictionary ADT
24
25 %package devel
26 Summary:    String key-val dictionary ADT (devel)
27 Group:      Development/Libraries
28 Requires:   %{name} = %{version}-%{release}
29
30 %description devel
31 Simple string key-val dictionary ADT (devel)
32
33 #################################################
34 # unittests
35 #################################################
36 %package unittests
37 Summary:    GTest for bundle
38 Group:      Development/Libraries
39
40 %description unittests
41 GTest for bundle
42
43 #################################################
44 # gcov
45 #################################################
46 %if 0%{?gcov:1}
47 %package gcov
48 Summary:    Simple string key-val dictionary ADT (gcov)
49 Group:      Application Framework/Testing
50
51 %description gcov
52 Simple string key-val dictionary ADT gcov objects
53 %endif
54
55 #################################################
56 ## parcel
57 #################################################
58 %package -n parcel
59 Summary:    Parcel Library
60 Group:      Development/Libraries
61
62 %description -n parcel
63 Parcel Library
64
65 %package -n parcel-devel
66 Summary:    Parcel Library (devel)
67 Group:      Development/Libraries
68 Requires:   parcel = %{version}-%{release}
69
70 %description -n parcel-devel
71 Parcel Library (devel)
72
73 #################################################
74 # parcel-unittests
75 #################################################
76 %package -n parcel-unittests
77 Summary:    GTest for parcel
78 Group:      Development/Libraries
79
80 %description -n parcel-unittests
81 GTest for parcel
82
83 %prep
84 %setup -q -n %{name}-%{version}
85 cp %{SOURCE1001} .
86 cp %{SOURCE1002} .
87
88 %build
89 %if 0%{?gcov:1}
90 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
91 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
92 export FFLAGS+=" -fprofile-arcs -ftest-coverage"
93 export LDFLAGS+=" -lgcov"
94 %endif
95
96 %cmake -DVERSION=%{version} .
97 %__make %{?_smp_mflags}
98
99 %check
100 ctest --verbose %{?_smp_mflags}
101 %if 0%{?gcov:1}
102 lcov -c --ignore-errors graph --no-external -b . -d . -o %{name}.info
103 genhtml %{name}.info -o out --legend --show-details
104 %endif
105
106 %install
107 %make_install
108
109 %if 0%{?gcov:1}
110 builddir=$(basename $PWD)
111 gcno_obj_dir=%{buildroot}%{_datadir}/gcov/obj/%{name}/"$builddir"
112 mkdir -p "$gcno_obj_dir"
113 find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';'
114 %endif
115
116 cat << EOF > run-unittest.sh
117 #!/bin/sh
118 GCOV_PATH="/tmp/home/abuild/rpmbuild/BUILD"
119 PAKCAGE="%{name}-%{version}"
120
121 set_perm() {
122     ## Sets the permission for applications
123     /usr/bin/find /tmp/home/ -print | /usr/bin/xargs -n1 /usr/bin/chsmack -a "System::Run" &> /dev/null
124     /usr/bin/find /tmp/home/ -print | /usr/bin/xargs -n1 /usr/bin/chsmack -a "System::Run" -t &> /dev/null
125     /usr/bin/chmod -R 777 /tmp/home/
126 }
127
128 setup() {
129     echo "setup start"
130     /usr/bin/mkdir -p "${GCOV_PATH}/${PACKAGE}"
131     set_perm
132 }
133
134 test_main() {
135     echo "test_main start"
136     export "GCOV_PREFIX=/tmp"
137     /usr/bin/bundle_unittests
138 }
139
140 teardown() {
141     echo "teardown start"
142     set_perm
143 }
144
145 main() {
146     setup
147     test_main
148     teardown
149 }
150
151 main "\$*"
152 EOF
153
154 mkdir -p %{buildroot}%{_bindir}/tizen-unittests/%{name}
155 install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}/
156
157 cat << EOF > run-parcel-unittest.sh
158 #!/bin/sh
159 GCOV_PATH="/tmp/home/abuild/rpmbuild/BUILD"
160 PAKCAGE="parcel-%{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/parcel_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/parcel
196 install -m 0755 run-parcel-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/parcel/run-unittest.sh
197
198 %post -p /sbin/ldconfig
199
200 %postun -p /sbin/ldconfig
201
202 %post -n parcel
203 /sbin/ldconfig
204
205 %postun -n parcel
206 /sbin/ldconfig
207
208 %post unittests
209 %if 0%{?gcov:1}
210 %{_bindir}/bundle_unittests
211 %endif
212
213 %files
214 %manifest %{name}.manifest
215 %defattr(-,root,root,-)
216 %{_libdir}/libbundle.so.*
217 %license LICENSE
218
219 %files devel
220 %manifest %{name}.manifest
221 %defattr(-,root,root,-)
222 %{_includedir}/*.h
223 %{_libdir}/pkgconfig/bundle.pc
224 %{_libdir}/libbundle.so
225
226 #################################################
227 # unittests
228 #################################################
229 %files unittests
230 %{_bindir}/bundle_unittests
231 %{_bindir}/tizen-unittests/%{name}/run-unittest.sh
232
233 #################################################
234 # bundle-gcov
235 #################################################
236 %if 0%{?gcov:1}
237 %files gcov
238 %{_datadir}/gcov/obj/*
239 %endif
240
241 #################################################
242 # parcel
243 #################################################
244 %files -n parcel
245 %manifest parcel.manifest
246 %license LICENSE
247 %{_libdir}/libparcel.so.*
248
249 %files -n parcel-devel
250 %manifest parcel.manifest
251 %{_includedir}/*
252 %{_libdir}/pkgconfig/parcel.pc
253 %{_libdir}/libparcel.so
254
255 %files -n parcel-unittests
256 %{_bindir}/parcel_unittests
257 %{_bindir}/tizen-unittests/parcel/run-unittest.sh