2 Summary: System Resource Information
5 VCS: magnolia/kernel/api/system-resource#submit/master/20131010.041510-19-gcf6121a4bcce9c122d4ea05fa9974ec7bac227d8
6 Group: System/Libraries
7 License: Apache License, Version 2.0
8 Source0: %{name}-%{version}.tar.gz
9 Source1: resourced.service
10 Source2: resourced-zram.service
11 Source5: resourced_swapoff.service
12 Source6: resourced-cpucgroup.service
13 Source8: resourced-logging.service
15 %define powertop_state OFF
17 %define vip_agent_module ON
18 %define timer_slack ON
19 %define logging_module OFF
20 %define logging_memory OFF
21 %define logging_cpu OFF
22 %define memory_module ON
23 %define memory_cgroup OFF
25 %if "%{?tizen_profile_name}" == "mobile"
26 %define swap_module OFF
27 %define network_state ON
28 %define network_service OFF
29 %define telephony_feature OFF
30 %define tethering_feature OFF
34 %if "%{?tizen_profile_name}" == "wearable"
35 %define swap_module OFF
36 %define network_state ON
37 %define network_service OFF
38 %define telephony_feature OFF
42 %if 0%{?tizen_build_binary_release_type_eng}
45 %define memory_eng OFF
48 %define exclude_list_file_name resourced_proc_exclude.ini
49 %define exclude_list_full_path /usr/etc/%{exclude_list_file_name}
50 %define exclude_list_opt_full_path /opt/usr/etc/%{exclude_list_file_name}
51 %define database_full_path /opt/usr/dbspace/.resourced-datausage.db
54 BuildRequires: pkgconfig(glib-2.0)
55 BuildRequires: pkgconfig(dlog)
56 BuildRequires: pkgconfig(sqlite3)
57 BuildRequires: pkgconfig(vconf)
58 BuildRequires: pkgconfig(vconf-internal-keys)
59 BuildRequires: pkgconfig(ecore)
60 BuildRequires: pkgconfig(ecore-file)
61 BuildRequires: pkgconfig(eina)
62 BuildRequires: pkgconfig(edbus)
63 BuildRequires: pkgconfig(capi-network-connection)
64 BuildRequires: pkgconfig(libsystemd-daemon)
65 BuildRequires: pkgconfig(journal)
67 Requires(post): /sbin/ldconfig
68 Requires(postun): /sbin/ldconfig
69 Requires: system-resource-resourced = %{version}-%{release}
70 Requires: libresourced = %{version}-%{release}
72 %if %{?logging_module} == ON
73 BuildRequires: pkgconfig(libsystemd-journal)
79 Summary: Resource Daemon
80 Group: System/Libraries
81 Requires: %{name} = %{version}-%{release}
83 %description resourced
86 %package -n libresourced
87 Summary: Resource Daemon Library
88 Group: System/Libraries
89 Requires: %{name} = %{version}-%{release}
91 %description -n libresourced
92 Resource Daemon Library
94 %package -n libresourced-devel
95 Summary: Resource Daemon Library (Development)
96 Group: System/Libraries
97 Requires: %{name} = %{version}-%{release}
99 %description -n libresourced-devel
100 Resource Daemon Library (Development)
106 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
107 MINORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $2}'`
108 PATCHVER=`echo %{version} | awk 'BEGIN {FS="."}{print $3}'`
110 /* That file was generated automaticaly. Don't edit it */
111 #define MINOR_VERSION ${MINORVER}
112 #define MAJOR_VERSION ${MAJORVER}
113 #define PATCH_VERSION ${PATCHVER}" > src/common/version.h
115 %if 0%{?tizen_build_binary_release_type_eng}
116 CFLAGS+=" -DTIZEN_ENGINEER_MODE"
119 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
120 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
121 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
123 cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DCMAKE_BUILD_TYPE=Release \
124 -DEXCLUDE_LIST_FILE_NAME=%{exclude_list_file_name} \
125 -DEXCLUDE_LIST_FULL_PATH=%{exclude_list_full_path} -DDATABASE_FULL_PATH=%{database_full_path} \
126 -DEXCLUDE_LIST_OPT_FULL_PATH=%{exclude_list_opt_full_path} -DNETWORK_MODULE=%{network_state} -DNETWORK_SERVICE=%{network_service} \
127 -DSWAP_MODULE=%{swap_module} -DPOWERTOP_MODULE=%{powertop_state} -DCPU_MODULE=%{cpu_module}\
128 -DMEMORY_ENG=%{memory_eng} -DVIP_AGENT=%{vip_agent_module} -DTELEPHONY_FEATURE=%{telephony_feature} \
129 -DTIMER_SLACK=%{timer_slack} -DLOGGING_MODULE=%{logging_module} -DLOGGING_MEMORY=%{logging_memory} \
130 -DLOGGING_CPU=%{logging_cpu} -DDATAUSAGE_TYPE=NFACCT -DMEMORY_MODULE=%{memory_module} -DMEMORY_CGROUP=%{memory_cgroup} \
131 -DTETHERING_FEATURE=%{tethering_feature}
133 make %{?jobs:-j%jobs}
137 mkdir -p %{buildroot}/usr/share/license
138 cp -f LICENSE %{buildroot}/usr/share/license/%{name}
139 cp -f LICENSE %{buildroot}/usr/share/license/%{name}-resourced
140 cp -f LICENSE %{buildroot}/usr/share/license/libresourced
144 %if %{?network_state} == ON
145 mkdir -p %{buildroot}/opt/usr/dbspace
146 sqlite3 %{buildroot}%{database_full_path} < %{buildroot}/usr/share/traffic_db.sql
147 rm %{buildroot}/usr/share/traffic_db.sql
150 mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants
151 %if %{?swap_module} == ON
152 install -m 0644 %SOURCE1 %{buildroot}%{_libdir}/systemd/system/resourced.service
153 ln -s ../resourced.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/resourced.service
155 mkdir -p %{buildroot}%{_libdir}/systemd/system/graphical.target.wants
156 install -m 0644 %SOURCE2 %{buildroot}%{_libdir}/systemd/system/resourced-zram.service
157 ln -s ../resourced-zram.service %{buildroot}%{_libdir}/systemd/system/graphical.target.wants/resourced-zram.service
159 install -m 0644 %SOURCE5 %{buildroot}%{_libdir}/systemd/system/resourced.service
160 ln -s ../resourced.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/resourced.service
163 %if %{?cpu_module} == OFF
164 mkdir -p %{buildroot}%{_libdir}/systemd/system/graphical.target.wants
165 install -m 0644 %SOURCE6 %{buildroot}%{_libdir}/systemd/system/resourced-cpucgroup.service
166 ln -s ../resourced-cpucgroup.service %{buildroot}%{_libdir}/systemd/system/graphical.target.wants/resourced-cpucgroup.service
169 #powertop-wrapper part
170 %if %{?powertop_state} == ON
171 mkdir -p %{buildroot}/usr/share/powertop-wrapper/
172 cp -p %_builddir/%name-%version/src/powertop-wrapper/header.html %{buildroot}/usr/share/powertop-wrapper
175 %if %{?logging_module} == ON
176 #logging service file
177 mkdir -p %{buildroot}%{_libdir}/systemd/system/graphical.target.wants
178 install -m 0644 %SOURCE8 %{buildroot}%{_libdir}/systemd/system/resourced-logging.service
179 ln -s ../resourced-logging.service %{buildroot}%{_libdir}/systemd/system/graphical.target.wants/resourced-logging.service
183 if [ "$1" = "2" ]; then # upgrade begins
184 systemctl stop resourced.service
187 %post -p /sbin/ldconfig
193 vconftool set -t bool db/private/resourced/wifi_statistics 1 -i -f -s resourced
194 vconftool set -t bool db/private/resourced/datacall 1 -i -f -s resourced
195 vconftool set -t bool db/private/resourced/datacall_logging 1 -i -f -s resourced
196 vconftool set -t int db/private/resourced/datausage_timer 60 -i -f -s resourced
197 vconftool set -t string db/private/resourced/new_limit "" -u 5000 -f -s resourced
198 vconftool set -t string db/private/resourced/delete_limit "" -u 5000 -f -s resourced
201 %if %{?network_state} == ON
204 #install init.d script
205 mkdir -p /opt/usr/etc
206 #make empty dynamic exclude list for first installation
207 touch %{exclude_list_opt_full_path}
209 if [ "$1" = "2" ]; then # upgrade begins
210 systemctl start resourced.service
213 %postun -p /sbin/ldconfig
216 /usr/share/license/%{name}
217 %manifest system-resource.manifest
219 /usr/share/license/%{name}-resourced
220 %attr(-,root, root) %{_bindir}/resourced
221 %if %{?network_state} == ON
222 %config(noreplace) %attr(660,root,app) %{database_full_path}
223 %config(noreplace) %attr(660,root,app) %{database_full_path}-journal
224 /usr/bin/datausagetool
225 %manifest resourced.manifest
227 %manifest resourced_nodb.manifest
229 %config %{_sysconfdir}/dbus-1/system.d/resourced.conf
230 %{_libdir}/systemd/system/resourced.service
231 %{_libdir}/systemd/system/multi-user.target.wants/resourced.service
232 /etc/resourced/memory.conf
233 %if %{?cpu_module} == ON
234 /etc/resourced/cpu.conf
236 %{_bindir}/resourced-cpucgroup.sh
237 %{_libdir}/systemd/system/resourced-cpucgroup.service
238 %{_libdir}/systemd/system/graphical.target.wants/resourced-cpucgroup.service
240 %if %{?swap_module} == ON
241 %{_libdir}/systemd/system/resourced-zram.service
242 %{_libdir}/systemd/system/graphical.target.wants/resourced-zram.service
243 %{_bindir}/resourced-zram.sh
245 %if %{?logging_module} == ON
246 %{_libdir}/systemd/system/resourced-logging.service
247 %{_libdir}/systemd/system/graphical.target.wants/resourced-logging.service
249 %if %{?vip_agent_module} == ON
250 /etc/resourced/vip-process.conf
251 %attr(-,root, root) %{_bindir}/vip-release-agent
253 %if %{?timer_slack} == ON
254 /etc/resourced/timer-slack.conf
256 %{exclude_list_full_path}
257 %if %{?powertop_state} == ON
258 /usr/share/powertop-wrapper/header.html
262 %attr(-,root, root) %{_bindir}/memps
264 %files -n libresourced
265 %manifest libresourced.manifest
266 %defattr(-,root,root,-)
267 /usr/share/license/libresourced
269 %{_libdir}/libproc-stat.so.*
271 %if %{?network_state} == ON
272 %{_libdir}/libresourced.so.*
273 %{_libdir}/librd-network.so.*
275 #powertop-wrapper part
276 %if %{?powertop_state} == ON
277 %{_libdir}/libpowertop-wrapper.so.*
280 %files -n libresourced-devel
281 %defattr(-,root,root,-)
282 %{_libdir}/pkgconfig/*.pc
283 %{_includedir}/system/resourced.h
285 %{_includedir}/system/proc_stat.h
286 %{_libdir}/libproc-stat.so
288 %if %{?network_state} != OFF
289 %{_includedir}/system/data_usage.h
290 %{_includedir}/system/rd-network.h
291 %{_libdir}/libresourced.so
292 %{_libdir}/librd-network.so
293 /etc/resourced/network.conf
295 #powertop-wrapper part
296 %if %{?powertop_state} == ON
297 %{_includedir}/system/powertop-dapi.h
298 %{_libdir}/libpowertop-wrapper.so