2 Summary: STC(Smart Traffic Control) manager
5 Group: Network & Connectivity/Other
7 Source0: %{name}-%{version}.tar.gz
9 %define enable_database YES
10 %define enable_statistics YES
11 %define enable_restriction YES
12 %define database_full_path %{TZ_SYS_GLOBALUSER_DB}/.stc-manager-datausage.db
13 %define database_backup_path %{TZ_SYS_RO_SHARE}/stc/.stc-manager-datausage.db
14 %define upgrade_script_filename 500.stc-manager_upgrade.sh
15 %define upgrade_script_path %{TZ_SYS_RO_SHARE}/upgrade/scripts
18 BuildRequires: pkgconfig(glib-2.0)
19 BuildRequires: pkgconfig(gio-2.0)
20 BuildRequires: pkgconfig(gobject-2.0)
21 BuildRequires: pkgconfig(gio-unix-2.0)
22 BuildRequires: pkgconfig(dlog)
23 BuildRequires: pkgconfig(libtzplatform-config)
24 BuildRequires: pkgconfig(vconf)
25 BuildRequires: pkgconfig(capi-system-info)
26 BuildRequires: pkgconfig(openssl1.1)
28 %if %{?enable_database} == YES
29 BuildRequires: pkgconfig(sqlite3)
33 BuildRequires: python-xml
36 BuildRequires: pkgconfig(gmock)
40 A smart traffic control manager to manage traffic counting and bandwidth limitation
42 %package plugin-appstatus
43 Summary: STC manager application status plugin
44 BuildRequires: pkgconfig(bundle)
45 BuildRequires: pkgconfig(syspopup-caller)
46 Requires: stc-manager-plugin-monitor
48 %description plugin-appstatus
49 A smart traffic control manager extension for application status plugin
51 %package plugin-exception
52 Summary: STC manager exception list plugin
53 BuildRequires: pkgconfig(pkgmgr-info)
54 Requires: stc-manager-plugin-monitor
56 %description plugin-exception
57 A smart traffic control manager extension for exception list plugin
59 %package plugin-procfs
60 Summary: STC manager exception proc file system plugin
61 Requires: stc-manager-plugin-monitor
63 %description plugin-procfs
64 A smart traffic control manager extension for proc file system plugin
67 Summary: STC manager exception packet capture plugin
68 BuildRequires: libpcap-devel
70 %description plugin-pcap
71 A smart traffic control manager extension for packet capture plugin
73 %package plugin-tether
74 Summary: Tethering plugin for data usage of tethering clients
75 Requires: stc-manager-plugin-monitor
77 %description plugin-tether
78 A smart traffic control manager extension for tethering client data usage plugin
80 %package plugin-monitor
81 Summary: Monitor plugin for data usage of clients
82 BuildRequires: pkgconfig(bundle)
83 BuildRequires: pkgconfig(syspopup-caller)
85 %description plugin-monitor
86 A smart traffic control manager extension for monitoring client data usage plugin
88 %package plugin-firewall
89 Summary: Firewall plugin for managing firewall rules
91 %description plugin-firewall
92 A smart traffic control manager extension for firewall plugin
100 export CFLAGS="$CFLAGS -D_GNU_SOURCE"
101 export CXXFLAGS="$CXXFLAGS -D_GNU_SOURCE"
103 %if "%{tizen_profile_name}" == "tv"
104 CFLAGS+=" -DTIZEN_TV_EXT"
107 %cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
108 -DBIN_DIR=%{_bindir} \
110 -DENABLE_DATABASE=%{enable_database} \
111 -DDATABASE_FULL_PATH=%{database_full_path} \
112 -DDATABASE_BACKUP_PATH=%{database_backup_path} \
113 -DENABLE_STATISTICS=%{enable_statistics} \
114 -DENABLE_RESTRICTION=%{enable_restriction} \
115 -DBUILD_GTESTS=%{?gtests:1}%{!?gtests:0} \
116 -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0}
125 #database initialization
126 %if %{?enable_database} == YES
127 mkdir -p %{buildroot}%{TZ_SYS_GLOBALUSER_DB}
128 sqlite3 %{buildroot}%{database_full_path} < %{buildroot}/usr/share/traffic_db.sql
129 sqlite3 %{buildroot}%{database_full_path} < %{buildroot}/usr/share/firewall_db.sql
130 mkdir -p %{buildroot}%{TZ_SYS_RO_SHARE}/stc
131 cp %{buildroot}%{database_full_path} %{buildroot}%{database_backup_path}
132 rm %{buildroot}/usr/share/traffic_db.sql
133 rm %{buildroot}/usr/share/firewall_db.sql
137 mkdir -p %{buildroot}/%{_localstatedir}/lib/stc
138 cp data/exceptions %{buildroot}/%{_localstatedir}/lib/stc/exceptions
140 #Systemd service file
141 mkdir -p %{buildroot}%{_libdir}/systemd/system/
142 cp resources/systemd/stc-manager.service %{buildroot}%{_libdir}/systemd/system/stc-manager.service
144 mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/
145 ln -s ../stc-manager.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/stc-manager.service
147 #DBus DAC (stc-manager.manifest enables DBus SMACK)
148 mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d
149 cp resources/dbus/stc-manager.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/stc-manager.conf
151 mkdir -p %{buildroot}%{_datadir}/dbus-1/system-services/
152 cp resources/dbus/net.stc-manager.service %{buildroot}%{_datadir}/dbus-1/system-services/net.stc-manager.service
155 mkdir -p %{buildroot}%{upgrade_script_path}
156 cp -f scripts/%{upgrade_script_filename} %{buildroot}%{upgrade_script_path}
159 %manifest %{name}.manifest
161 %defattr(-,root,root,-)
162 %attr(500,root,root) %{_bindir}/*
164 %attr(644,root,root) %{_libdir}/systemd/system/stc-manager.service
165 %attr(644,root,root) %{_libdir}/systemd/system/multi-user.target.wants/stc-manager.service
167 %attr(755,network_fw,network_fw) /%{_localstatedir}/lib/stc
168 %attr(600,root,root) /%{_localstatedir}/lib/stc/exceptions
171 %attr(644,root,root) %{_sysconfdir}/dbus-1/system.d/*
172 %attr(644,root,root) %{_datadir}/dbus-1/system-services/*
174 %if %{?enable_database} == YES
175 %config(noreplace) %attr(660, root, root) %{database_full_path}
176 %config(noreplace) %attr(660, root, root) %{database_full_path}-journal
177 %config(noreplace) %attr(660, root, root) %{database_backup_path}
184 %{upgrade_script_path}/%{upgrade_script_filename}
186 %files plugin-appstatus
187 %manifest %{name}.manifest
188 %attr(644, -,-) %{_datadir}/icons/*.png
189 %attr(500,root,root) %{_libdir}/stc-plugin-appstatus.so
191 %files plugin-exception
192 %manifest %{name}.manifest
193 %attr(500,root,root) %{_libdir}/stc-plugin-exception.so
196 %manifest %{name}.manifest
197 %attr(500,root,root) %{_libdir}/stc-plugin-procfs.so
200 %manifest %{name}.manifest
201 %attr(500,root,root) %{_libdir}/stc-plugin-pcap.so
204 %manifest %{name}.manifest
205 %attr(500,root,root) %{_libdir}/stc-plugin-tether.so
207 %files plugin-monitor
208 %manifest %{name}.manifest
209 %attr(500,root,root) %{_libdir}/stc-plugin-monitor.so
211 %files plugin-firewall
212 %manifest %{name}.manifest
213 %attr(500,root,root) %{_libdir}/stc-plugin-firewall.so