Release version 1.1.3
[platform/core/appfw/tizen-theme-manager.git] / packaging / tizen-theme-manager.spec
1 Name:       tizen-theme-manager
2 Summary:    Tizen Theme Manager
3 Version:    1.1.3
4 Release:    1
5 Group:      Application Framework/Package Management
6 License:    Apache-2.0
7 Source0:    %{name}-%{version}.tar.gz
8 Source1001: %{name}.manifest
9 Source1002: %{name}.service
10 Source1003: %{name}.conf
11 Source1004: org.tizen.ThemeManager.service
12 BuildRequires:  cmake
13 BuildRequires:  hash-signer
14 BuildRequires:  pkgconfig(bundle)
15 BuildRequires:  pkgconfig(dlog)
16 BuildRequires:  pkgconfig(glib-2.0)
17 BuildRequires:  pkgconfig(gobject-2.0)
18 BuildRequires:  pkgconfig(gmock)
19 BuildRequires:  pkgconfig(jsoncpp)
20 BuildRequires:  pkgconfig(pkgmgr-parser)
21 BuildRequires:  pkgconfig(pkgmgr-info)
22 BuildRequires:  pkgconfig(pkgmgr-installer)
23 BuildRequires:  pkgconfig(sqlite3)
24 BuildRequires:  pkgconfig(tizen-database)
25
26 %if 0%{?gcov:1}
27 BuildRequires:  lcov
28 %endif
29
30 %description
31 Tizen Theme Manager
32
33 %package -n capi-appfw-tizen-theme
34 Summary:  Tizen Theme Manager API
35 Requires: %{name} = %{version}
36
37 %description -n capi-appfw-tizen-theme
38 The Tizen Theme Manager API provides functions to load theme info or
39 set current theme.
40
41 %package -n capi-appfw-tizen-theme-devel
42 Summary:  Tizen Theme Manager API (Development package)
43 Requires: %{name} = %{version}
44
45 %description -n capi-appfw-tizen-theme-devel
46 The Tizen Theme Manager API provides functions to load theme info or
47 set current theme.
48
49 %package unittests
50 Summary: %{name} unittests binary
51
52 %description unittests
53 unittests binary
54
55 %define default_dark_theme_pkgid org.tizen.default-dark-theme
56 %package -n %{default_dark_theme_pkgid}
57 Summary:  Default dark theme
58 Requires: %{name} = %{version}
59
60 %description -n %{default_dark_theme_pkgid}
61 Default dark theme package
62
63 %define default_light_theme_pkgid org.tizen.default-light-theme
64 %package -n %{default_light_theme_pkgid}
65 Summary:  Default light theme
66 Requires: %{name} = %{version}
67
68 %description -n %{default_light_theme_pkgid}
69 Default light theme package
70
71 %prep
72 %setup -q
73 cp %{SOURCE1001} .
74 cp %{SOURCE1002} .
75
76 %build
77 %if 0%{?gcov:1}
78 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
79 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
80 export FFLAGS+=" -fprofile-arcs -ftest-coverage"
81 export LDFLAGS+=" -lgcov"
82 %endif
83
84 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
85 %cmake . -DCMAKE_VERBOSE_MAKEFILE:BOOL=%{?verbose_make:ON}%{!?verbose_make:OFF} \
86          -DUNITDIR=%{_unitdir} \
87          -DFULLVER=%{version} \
88          -DMAJORVER=${MAJORVER} \
89          -DDEFAULT_DARK_THEME_PKGID=%{default_dark_theme_pkgid} \
90          -DDEFAULT_LIGHT_THEME_PKGID=%{default_light_theme_pkgid}
91
92 %__make %{?_smp_mflags}
93
94 %install
95 %make_install
96
97 %if 0%{?gcov:1}
98 builddir=$(basename $PWD)
99 gcno_obj_dir=%{buildroot}%{_datadir}/gcov/obj/%{name}/"$builddir"
100 mkdir -p "$gcno_obj_dir"
101 find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';'
102 %endif
103
104 #################################################
105 # generate unittest automation script
106 #################################################
107 cat << EOF > run-unittest.sh
108 #!/bin/bash
109 PATH=/bin:/usr/bin:/sbin:/usr/sbin
110 setup() {
111     echo "setup start"
112 }
113
114 test_main() {
115     echo "test_main start"
116     /usr/bin/tizen-theme-ut/tizen-theme-unit-test
117 }
118
119 teardown() {
120     echo "teardown start"
121 }
122
123 main() {
124     setup
125     test_main
126     teardown
127 }
128
129 main "\$*"
130 EOF
131
132 mkdir -p %{buildroot}%{_bindir}/tizen-unittests/%{name}
133 install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}
134 install -m 755 -d %{buildroot}%{_unitdir}
135 install -m 644 %{SOURCE1002} %{buildroot}%{_unitdir}
136 install -m 755 -d %{buildroot}%{_sysconfdir}/dbus-1/system.d
137 install -m 644 %{SOURCE1003} %{buildroot}%{_sysconfdir}/dbus-1/system.d
138 install -m 755 -d %{buildroot}%{_datadir}/dbus-1/system-services
139 install -m 644 %{SOURCE1004} %{buildroot}%{_datadir}/dbus-1/system-services
140
141 %check
142 export LD_LIBRARY_PATH=../../src/api:../../src/theme:../../src/theme_provider:../../src/theme_plugin
143 ctest -V
144 %if 0%{?gcov:1}
145 lcov -c --ignore-errors graph --no-external -b . -d . -o %{name}.info
146 genhtml %{name}.info -o out --legend --show-details
147 %endif
148
149 %post
150 /sbin/ldconfig
151 if [ $1 -eq 2 ]; then
152   systemctl daemon-reload
153 fi
154 systemctl restart %{name}
155
156 %preun
157 if [ $1 -eq 0 ]; then
158   systemctl stop %{name}
159 fi
160
161 %postun
162 /sbin/ldconfig
163 if [ $1 -eq 0 ]; then
164   systemctl daemon-reload
165 fi
166
167 %files
168 %defattr(-,root,root,-)
169 %manifest %{name}.manifest
170 %license LICENSE
171 %{_bindir}/*
172 %{_libdir}/libtizen-theme.so
173 %{_libdir}/libtizen-theme-provider.so
174 %{_sysconfdir}/package-manager/parserlib/metadata/libtizen-theme-plugin.so
175 %{_datarootdir}/parser-plugins/tizen-theme-plugin.info
176 %{_unitdir}/%{name}.service
177 %{_sysconfdir}/dbus-1/system.d/%{name}.conf
178 %{_datadir}/dbus-1/system-services/org.tizen.ThemeManager.service
179
180 %files -n capi-appfw-tizen-theme
181 %manifest %{name}.manifest
182 %{_libdir}/libcapi-appfw-tizen-theme.so.*
183
184 %files -n capi-appfw-tizen-theme-devel
185 %manifest %{name}.manifest
186 %{_libdir}/libcapi-appfw-tizen-theme.so
187 %{_includedir}/tizen-theme/*.h
188 %{_libdir}/pkgconfig/capi-appfw-tizen-theme.pc
189
190 #################################################
191 # tizen-theme-manager-gcov
192 #################################################
193 %if 0%{?gcov:1}
194 %package gcov
195 Summary:    Simple string key-val dictionary ADT (gcov)
196 Group:      Application Framework/Testing
197
198 %description gcov
199 Simple string key-val dictionary ADT gcov objects
200 %endif
201
202 %if 0%{?gcov:1}
203 %files gcov
204 %defattr(-,root,root,-)
205 %{_datadir}/gcov/obj/*
206 %endif
207
208 %files unittests
209 %{_bindir}/tizen-theme-ut/tizen-theme-unit-test
210 %{_bindir}/tizen-unittests/%{name}/run-unittest.sh
211
212 #Signing
213 %define tizen_sign_base %{_prefix}/apps/%{default_dark_theme_pkgid};%{_prefix}/apps/%{default_light_theme_pkgid}
214 %define tizen_sign 1
215 %define tizen_author_sign 1
216 %define tizen_dist_sign 1
217 %define tizen_sign_level platform
218
219 %files -n %{default_dark_theme_pkgid}
220 %defattr(-,root,root,-)
221 %manifest %{name}.manifest
222 %{_prefix}/apps/%{default_dark_theme_pkgid}/*
223 %{_datadir}/packages/%{default_dark_theme_pkgid}.xml
224
225 %files -n %{default_light_theme_pkgid}
226 %defattr(-,root,root,-)
227 %manifest %{name}.manifest
228 %{_prefix}/apps/%{default_light_theme_pkgid}/*
229 %{_datadir}/packages/%{default_light_theme_pkgid}.xml