ae3d02d847df047c6e06a0826689d996b08deb90
[platform/core/connectivity/stc-iptables.git] / packaging / stc-iptables.spec
1 Name:       stc-iptables
2 Summary:    STC(Smart Traffic Control) iptables
3 Version:    0.0.11
4 Release:    0
5 Group:      Network & Connectivity/Other
6 License:    GPL-2.0+
7 Source0:    %{name}-%{version}.tar.gz
8
9 BuildRequires:  cmake
10 BuildRequires:  pkgconfig(glib-2.0)
11 BuildRequires:  pkgconfig(gio-2.0)
12 BuildRequires:  pkgconfig(gio-unix-2.0)
13 BuildRequires:  pkgconfig(libiptc)
14 BuildRequires:  pkgconfig(libip6tc)
15
16 %if 0%{?gtests:1}
17 BuildRequires:  pkgconfig(dlog)
18 BuildRequires:  pkgconfig(gmock)
19 %endif
20
21 %description
22 A smart traffic control iptables to manage iptables rules using libiptc
23
24 %package test
25 Summary:   STC iptables test binaries
26
27 %description test
28 Test Application for STC Iptables
29
30 %prep
31 %setup -q
32 chmod 644 %{SOURCE0}
33
34 %build
35
36 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE -D_GNU_SOURCE"
37 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE -D_GNU_SOURCE"
38 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
39
40 %cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
41         -DBIN_DIR=%{_bindir} \
42         -DLIB_PATH=%{_lib} \
43         -DBUILD_GTESTS=%{?gtests:1}%{!?gtests:0} \
44         -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0}
45
46 make %{?_smp_mflags}
47
48 %install
49 rm -rf %{buildroot}
50
51 %make_install
52
53 #Systemd iptables service file
54 mkdir -p %{buildroot}%{_libdir}/systemd/system/
55 cp resources/systemd/stc-iptables.service %{buildroot}%{_libdir}/systemd/system/stc-iptables.service
56
57 mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/
58 ln -s ../stc-iptables.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/stc-iptables.service
59
60 #DBus DAC (stc-iptables.manifest enables DBus SMACK)
61 mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d
62 cp resources/dbus/stc-iptables.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/stc-iptables.conf
63
64 %post
65 #Logs
66 mkdir -p /opt/usr/data/network
67 chmod 755 /opt/usr/data/network
68 chown network_fw:network_fw /opt/usr/data/network
69
70 %files
71 %manifest %{name}.manifest
72 %license LICENSE
73 %license COPYING
74 %defattr(-,root,root,-)
75 %attr(500,root,root) %{_bindir}/stc-iptables
76
77 %attr(644,root,root) %{_libdir}/systemd/system/stc-iptables.service
78 %attr(644,root,root) %{_libdir}/systemd/system/multi-user.target.wants/stc-iptables.service
79
80 #DBus DAC
81 %attr(644,root,root) %{_sysconfdir}/dbus-1/system.d/stc-iptables.conf
82
83 #Test
84 %{_bindir}/stc_ipt_test
85 %attr(755,root,root) %{_bindir}/stc_ipt_test
86
87 %if 0%{?gtests:1}
88 %{_bindir}/gtest*
89 %endif