Use explicit unittest filename
[platform/core/uifw/capi-ui-sticker.git] / packaging / capi-ui-sticker.spec
1 Name:       capi-ui-sticker
2 Summary:    Sticker client library and daemon
3 Version:    1.2.6
4 Release:    1
5 Group:      Graphics & UI Framework/Input
6 License:    Apache-2.0
7 Source0:    %{name}-%{version}.tar.gz
8 Source1:    capi-ui-sticker.service
9 Source2:    org.tizen.sticker.server.service
10 Source3:    capi-ui-sticker.conf
11 BuildRequires:  cmake, coreutils
12 BuildRequires:  pkgconfig(capi-appfw-app-common)
13 BuildRequires:  pkgconfig(capi-appfw-package-manager)
14 BuildRequires:  pkgconfig(capi-appfw-event)
15 BuildRequires:  pkgconfig(capi-system-info)
16 BuildRequires:  pkgconfig(cynara-client)
17 BuildRequires:  pkgconfig(cynara-session)
18 BuildRequires:  pkgconfig(dbus-1)
19 BuildRequires:  pkgconfig(dlog)
20 BuildRequires:  pkgconfig(gio-2.0)
21 BuildRequires:  pkgconfig(gio-unix-2.0)
22 BuildRequires:  pkgconfig(glib-2.0)
23 BuildRequires:  pkgconfig(json-glib-1.0)
24 BuildRequires:  pkgconfig(libtzplatform-config)
25 BuildRequires:  pkgconfig(pkgmgr-info)
26 BuildRequires:  pkgconfig(sqlite3)
27 BuildRequires:  pkgconfig(gmock)
28
29 %if 0%{?sec_product_feature_profile_wearable}
30 BuildRequires:  pkgconfig(capi-base-common)
31 BuildRequires:  pkgconfig(capi-appfw-service-application)
32 BuildRequires:  pkgconfig(capi-appfw-preference)
33 BuildRequires:  pkgconfig(capi-system-device)
34 BuildRequires:  pkgconfig(sap-client-stub-api)
35 BuildRequires:  pkgconfig(vconf)
36 BuildRequires:  pkgconfig(capi-media-thumbnail-util)
37 BuildRequires:  pkgconfig(ecore)
38 BuildRequires:  hash-signer
39
40 Requires(post): signing-client
41 Requires:       org.tizen.sticker-receiver
42 %endif
43
44 Requires:       security-config
45 Requires(post): /sbin/ldconfig
46 Requires(post): dbus
47 Requires(postun): /sbin/ldconfig
48
49 %if 0%{?gcov:1}
50 BuildRequires:  lcov
51 BuildRequires:  zip
52 %endif
53
54 %description
55 Sticker client library and daemon
56
57 %package devel
58 Summary:    Sticker client library and daemon (Development)
59 Group:      Graphics & UI Framework/Input
60 Requires:   %{name} = %{version}-%{release}
61
62 %if 0%{?sec_product_feature_profile_wearable}
63 %define _companion_app_name org.tizen.sticker-receiver
64
65 %package -n %{_companion_app_name}
66 Summary:    Sticker companion service
67 Group:      Graphics & UI Framework/Input
68 Requires:   %{name} = %{version}-%{release}
69 %endif
70
71
72 %description devel
73 Sticker client library and daemon (Development)
74
75 %if 0%{?sec_product_feature_profile_wearable}
76 %description -n %{_companion_app_name}
77 Sticker companion service
78 %endif
79
80 %if 0%{?gcov:1}
81 %package gcov
82 Summary:  Sticker client library and daemon (gcov)
83 Group:      Graphics & UI Framework/Input
84 %description gcov
85 Sticker client library and daemon (gcov)
86 %endif
87
88 %package unittests
89 Summary:    Sticker tests
90 Group:      Development/Libraries
91 Requires:   %{name} = %{version}-%{release}
92
93 %description unittests
94 GTest for sticker
95
96 %prep
97 %setup -q -n %{name}-%{version}
98 cp %{SOURCE2} .
99
100 %build
101 %if 0%{?gcov:1}
102 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
103 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
104 export FFLAGS+=" -fprofile-arcs -ftest-coverage"
105 export LDFLAGS+=" -lgcov"
106 %endif
107
108 export CFLAGS+=" -DTIZEN_DEBUG_ENABLE -fvisibility=hidden -Werror"
109 export CXXFLAGS+=" -DTIZEN_DEBUG_ENABLE -fvisibility=hidden -Werror"
110 export FFLAGS+=" -DTIZEN_DEBUG_ENABLE -fvisibility=hidden"
111
112 %cmake . \
113 %if 0%{?sec_product_feature_profile_wearable}
114         -DCOMPANION_MODE=true \
115 %endif
116          -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DBINDIR=%{_bindir} -DINCLUDEDIR=%{_includedir} \
117          -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE -DTZ_SYS_BIN=%TZ_SYS_BIN -DTZ_USER_SHARE=%TZ_USER_SHARE \
118          -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP -DTZ_SYS_RO_PACKAGES=%TZ_SYS_RO_PACKAGES
119
120 make %{?jobs:-j%jobs}
121
122
123 %install
124 rm -rf %{buildroot}
125 %make_install
126
127 %if 0%{?gcov:1}
128 builddir=$(basename $PWD)
129 gcno_obj_dir=%{buildroot}%{_datadir}/gcov/obj/%{name}/"$builddir"
130 mkdir -p "$gcno_obj_dir"
131 find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';'
132 %endif
133
134 cat << EOF > run-unittest.sh
135 #!/bin/sh
136 setup() {
137         echo "setup start"
138 }
139
140 test_main() {
141         echo "test_main start"
142         /usr/bin/capi-ui-sticker-unittest
143 }
144
145 teardown() {
146         echo "teardown start"
147 }
148
149 main() {
150         setup
151         test_main
152         teardown
153 }
154
155 main "\$*"
156 EOF
157
158 mkdir -p %{buildroot}%{_bindir}/tizen-unittests/%{name}
159 install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}
160
161 mkdir -p %{buildroot}/%{TZ_SYS_ETC}/dump.d/module.d
162 cp -af dump/sticker_log_dump.sh %{buildroot}/%{TZ_SYS_ETC}/dump.d/module.d
163
164 mkdir -p %{buildroot}%{_prefix}/lib/systemd/system
165 install -m 0644 %SOURCE1 %{buildroot}%{_unitdir}/capi-ui-sticker.service
166
167 mkdir -p %{buildroot}%{_datadir}/dbus-1/system-services
168 install -m 0644 %SOURCE2 %{buildroot}%{_datadir}/dbus-1/system-services/org.tizen.sticker.server.service
169
170 mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d
171 install -m 0644 %SOURCE3 %{buildroot}%{_sysconfdir}/dbus-1/system.d/capi-ui-sticker.conf
172
173 %if 0%{?sec_product_feature_profile_wearable}
174 %define tizen_sign 1
175 %define tizen_sign_base %{TZ_SYS_RO_APP}/%{_companion_app_name}
176 %define tizen_sign_level public
177 %define tizen_author_sign 1
178 %define tizen_dist_sign 1
179 %endif
180
181 %check
182 %if 0%{?gcov:1}
183 ctest --output-on-failure %{?_smp_mflags}
184 lcov -c --ignore-errors graph --no-external -q -d . -o capi-ui-sticker.info
185 genhtml capi-ui-sticker.info -o capi-ui-sticker.out
186 zip -r capi-ui-sticker.zip capi-ui-sticker.out capi-ui-sticker.info
187 install -m 0644 capi-ui-sticker.zip %{buildroot}%{_datadir}/gcov
188 %endif
189
190 %post
191 /sbin/ldconfig
192
193 mkdir -p -m 0775 /opt/usr/share/sticker-data
194 chown -R ui_fw:ui_fw /opt/usr/share/sticker-data
195 chsmack -t /opt/usr/share/sticker-data
196 chsmack -a "User::App::Shared" /opt/usr/share/sticker-data
197
198 %postun -p /sbin/ldconfig
199
200 %files
201 %manifest %{name}.manifest
202 %license LICENSE
203 %{_libdir}/lib*.so
204 %attr(0755,ui_fw,ui_fw) %{_bindir}/sticker-server
205 %attr(0644,root,root) %{_unitdir}/capi-ui-sticker.service
206 %attr(0644,root,root) %{_datadir}/dbus-1/system-services/org.tizen.sticker.server.service
207 %config %{_sysconfdir}/dbus-1/system.d/capi-ui-sticker.conf
208 %{TZ_SYS_RO_SHARE}/parser-plugins/capi-ui-sticker.info
209 %{TZ_SYS_RO_ETC}/package-manager/parserlib/category/libcapi-ui-sticker-parser.so*
210 %{TZ_SYS_RO_ETC}/package-manager/parserlib/metadata/libcapi-ui-sticker-parser.so*
211 %{TZ_SYS_ETC}/dump.d/module.d/*
212
213 %files devel
214 %manifest %{name}-devel.manifest
215 %defattr(-,root,root,-)
216 %{_libdir}/lib*.so
217 %{_libdir}/pkgconfig/capi-ui-sticker-consumer.pc
218 %{_libdir}/pkgconfig/capi-ui-sticker-provider.pc
219 %{_includedir}/sticker_error.h
220 %{_includedir}/sticker_data.h
221 %{_includedir}/sticker_consumer.h
222 %{_includedir}/sticker_provider.h
223
224 %if 0%{?sec_product_feature_profile_wearable}
225 %post -n %{_companion_app_name}
226 /usr/bin/signing-client/hash-signer-client.sh -a -d -p platform %{TZ_SYS_RO_APP}/%{_companion_app_name}
227
228 %files -n %{_companion_app_name}
229 %manifest receiver/%{_companion_app_name}.manifest
230 %license LICENSE
231 %{TZ_SYS_RO_PACKAGES}/%{_companion_app_name}.xml
232 %{TZ_SYS_RO_APP}/%{_companion_app_name}/*
233 %endif
234
235 %files unittests
236 %license LICENSE
237 %{_bindir}/capi-ui-sticker-unittest
238 %{_bindir}/tizen-unittests/%{name}/run-unittest.sh
239
240 %if 0%{?gcov:1}
241 %files gcov
242 %{_datadir}/gcov/*
243 %endif