ec6a4573ad325f7a617822ed3b5cb4e5120f3971
[platform/upstream/connman.git] / packaging / connman.spec
1 %bcond_with     connman_openconnect
2 %bcond_without  connman_openvpn
3 %bcond_without  connman_vpnd
4
5 Name:           connman
6 Version:        1.29
7 Release:        19
8 License:        GPL-2.0+
9 Summary:        Connection Manager
10 Url:            http://connman.net
11 Group:          Network & Connectivity/Connection Management
12 Source0:        %{name}-%{version}.tar.gz
13 BuildRequires:  systemd-devel
14 BuildRequires:  pkgconfig(dbus-1)
15 BuildRequires:  pkgconfig(glib-2.0)
16 BuildRequires:  pkgconfig(libiptc)
17 BuildRequires:  pkgconfig(xtables)
18 BuildRequires:  pkgconfig(libsmack)
19 BuildRequires:  pkgconfig(tpkp-gnutls)
20 BuildRequires:  pkgconfig(libsystemd-daemon)
21 %if %{with connman_openconnect}
22 BuildRequires:  openconnect
23 %endif
24 %if %{with connman_openvpn}
25 BuildRequires:  openvpn
26 %endif
27 BuildRequires:  ca-certificates-devel
28 BuildRequires:  readline-devel
29 #%systemd_requires
30 Requires:       iptables
31 Requires:         systemd
32 Requires(post):   systemd
33 Requires(preun):  systemd
34 Requires(postun): systemd
35 Requires:         net-config
36
37 %define upgrade_script_filename 500.connman_upgrade.sh
38 %define upgrade_script_path /usr/share/upgrade/scripts
39
40 %description
41 Connection Manager provides a daemon for managing Internet connections
42 within embedded devices running the Linux operating system.
43
44 %if %{with connman_openconnect}
45 %package plugin-openconnect
46 Summary:        Openconnect Support for Connman
47 Requires:       %{name} = %{version}
48 Requires:       openconnect
49
50 %description plugin-openconnect
51 Openconnect Support for Connman.
52 %endif
53
54 %if %{with connman_openvpn}
55 %package plugin-openvpn
56 Summary:        Openvpn Support for Connman
57 Requires:       %{name} = %{version}
58 Requires:       openvpn
59
60 %description plugin-openvpn
61 OpenVPN support for Connman.
62 %endif
63
64 %if %{with connman_vpnd}
65 %package connman-vpnd
66 Summary:        VPN Support for Connman
67 #BuildRequires:  %{name} = %{version}
68 Requires:       %{name} = %{version}
69
70 %description connman-vpnd
71 Provides VPN support for Connman
72 %endif
73
74 %package test
75 Summary:        Test Scripts for Connection Manager
76 Group:          Development/Tools
77 Requires:       %{name} = %{version}
78 Requires:       dbus-python
79 Requires:       pygobject
80 Requires:       python-xml
81
82 %description test
83 Scripts for testing Connman and its functionality
84
85 %package devel
86 Summary:        Development Files for connman
87 Group:          Development/Tools
88 Requires:       %{name} = %{version}
89
90 %description devel
91 Header files and development files for connman.
92
93 %prep
94 %setup -q
95
96
97 %build
98 CFLAGS+=" -DTIZEN_EXT -lsmack -Werror"
99 CFLAGS+=" -DTIZEN_SYS_CA_BUNDLE=\"%TZ_SYS_RO_CA_BUNDLE\""
100 %if "%{profile}" == "tv"
101 CFLAGS+=" -DTIZEN_TV_EXT"
102 %endif
103
104 %if %{with connman_vpnd}
105 VPN_CFLAGS+=" -DTIZEN_EXT -lsmack -Werror"
106 %endif
107
108 chmod +x bootstrap
109 ./bootstrap
110 %configure \
111             --sysconfdir=/etc \
112             --enable-client \
113             --enable-pacrunner \
114             --enable-wifi=builtin \
115 %if %{with connman_openconnect}
116             --enable-openconnect \
117 %endif
118 %if %{with connman_openvpn}
119             --enable-openvpn \
120 %endif
121 %if 0%{?enable_connman_features}
122             %connman_features \
123 %endif
124             --disable-ofono \
125             --enable-telephony=builtin \
126             --enable-test \
127                         --enable-loopback \
128                         --enable-ethernet \
129             --with-systemdunitdir=%{_libdir}/systemd/system \
130             --enable-pie \
131                         --disable-wispr
132
133 make %{?_smp_mflags}
134
135 %install
136 %make_install
137
138 #Systemd service file
139 mkdir -p %{buildroot}%{_libdir}/systemd/system/
140 %if "%{?_lib}" == "lib64"
141 mkdir -p %{buildroot}%{_unitdir}
142 %endif
143
144 %if "%{profile}" == "tv"
145 cp src/connman_tv.service %{buildroot}%{_libdir}/systemd/system/connman.service
146 %if "%{?_lib}" == "lib64"
147 cp src/connman_tv.service %{buildroot}%{_unitdir}/connman.service
148 cp vpn/connman-vpn.service %{buildroot}%{_unitdir}/connman-vpn.service
149 %endif
150 %else
151 %if "%{?_lib}" == "lib64"
152 cp src/connman.service %{buildroot}%{_unitdir}/connman.service
153 cp vpn/connman-vpn.service %{buildroot}%{_unitdir}/connman-vpn.service
154 %endif
155 %endif
156
157 mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants
158 ln -s ../connman.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/connman.service
159 %if "%{?_lib}" == "lib64"
160 mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
161 ln -s ../connman.service %{buildroot}%{_unitdir}/multi-user.target.wants/connman.service
162 %endif
163
164 #Systemd socket file for DNS proxy
165 %if "%{?_lib}" == "lib64"
166 cp src/connman.socket %{buildroot}%{_unitdir}/connman.socket
167 mkdir -p %{buildroot}%{_unitdir}/sockets.target.wants
168 ln -s ../connman.socket %{buildroot}%{_unitdir}/sockets.target.wants/connman.socket
169 %else
170 cp src/connman.socket %{buildroot}%{_libdir}/systemd/system/connman.socket
171 mkdir -p %{buildroot}%{_libdir}/systemd/system/sockets.target.wants
172 ln -s ../connman.socket %{buildroot}%{_libdir}/systemd/system/sockets.target.wants/connman.socket
173 %endif
174
175 mkdir -p %{buildroot}/%{_localstatedir}/lib/connman
176 cp resources/var/lib/connman/settings %{buildroot}/%{_localstatedir}/lib/connman/settings
177 mkdir -p %{buildroot}%{_datadir}/dbus-1/system-services
178 cp resources/usr/share/dbus-1/system-services/net.connman.service %{buildroot}%{_datadir}/dbus-1/system-services/net.connman.service
179 mkdir -p %{buildroot}/etc/connman
180
181 %if "%{profile}" == "ivi"
182 cp src/main_ivi.conf %{buildroot}/etc/connman/main.conf
183 %else
184 cp src/main.conf %{buildroot}/etc/connman/main.conf
185 %endif
186
187 rm %{buildroot}%{_sysconfdir}/dbus-1/system.d/*.conf
188 mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d/
189 cp src/connman.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/
190
191 #License
192 mkdir -p %{buildroot}%{_datadir}/license
193 cp COPYING %{buildroot}%{_datadir}/license/connman
194
195 %if %{with connman_vpnd}
196 cp vpn/vpn-dbus.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/connman-vpn-dbus.conf
197 %endif
198
199 #OS Upgrade
200 mkdir -p %{buildroot}%{upgrade_script_path}
201 cp -f scripts/%{upgrade_script_filename} %{buildroot}%{upgrade_script_path}
202
203 %post
204 chsmack -a 'System' /%{_localstatedir}/lib/connman
205 chsmack -a 'System' /%{_localstatedir}/lib/connman/settings
206
207 %preun
208
209 %postun
210 systemctl daemon-reload
211
212 %docs_package
213
214 %files
215 %manifest connman.manifest
216 %attr(500,root,root) %{_sbindir}/*
217 %attr(500,root,root) %{_bindir}/connmanctl
218 %attr(600,root,root) /%{_localstatedir}/lib/connman/settings
219 #%{_libdir}/connman/plugins/*.so
220 %attr(644,root,root) %{_datadir}/dbus-1/system-services/*
221 #%{_datadir}/dbus-1/services/*
222 %{_sysconfdir}/dbus-1/system.d/*
223 %attr(644,root,root) %{_sysconfdir}/connman/main.conf
224 %{_sysconfdir}/dbus-1/system.d/*.conf
225 %attr(644,root,root) %{_libdir}/systemd/system/connman.service
226 %attr(644,root,root) %{_libdir}/systemd/system/multi-user.target.wants/connman.service
227 %attr(644,root,root) %{_libdir}/systemd/system/connman-vpn.service
228 %if "%{?_lib}" == "lib64"
229 %attr(644,root,root) %{_unitdir}/connman.service
230 %attr(644,root,root) %{_unitdir}/multi-user.target.wants/connman.service
231 %attr(644,root,root) %{_unitdir}/connman-vpn.service
232 %attr(644,root,root) %{_unitdir}/connman.socket
233 %attr(644,root,root) %{_unitdir}/sockets.target.wants/connman.socket
234 %else
235 %attr(644,root,root) %{_libdir}/systemd/system/connman.socket
236 %attr(644,root,root) %{_libdir}/systemd/system/sockets.target.wants/connman.socket
237 %endif
238 %{_datadir}/license/connman
239 %{upgrade_script_path}/%{upgrade_script_filename}
240
241 %files test
242 %manifest connman.manifest
243 %{_libdir}/%{name}/test/*
244
245 %files devel
246 %manifest connman.manifest
247 %{_includedir}/*
248 %{_libdir}/pkgconfig/*.pc
249
250 %if %{with connman_openconnect}
251 %files plugin-openconnect
252 %manifest %{name}.manifest
253 %{_libdir}/connman/plugins-vpn/openconnect.so
254 %{_libdir}/connman/scripts/openconnect-script
255 %{_datadir}/dbus-1/system-services/net.connman.vpn.service
256 %endif
257
258 %if %{with connman_openvpn}
259 %files plugin-openvpn
260 %manifest %{name}.manifest
261 %{_libdir}/%{name}/plugins-vpn/openvpn.so
262 %{_libdir}/%{name}/scripts/openvpn-script
263 %{_datadir}/dbus-1/system-services/net.connman.vpn.service
264 %endif
265
266 %if %{with connman_vpnd}
267 %files connman-vpnd
268 %manifest %{name}.manifest
269 #%{_sbindir}/connman-vpnd
270 %dir %{_libdir}/%{name}
271 %dir %{_libdir}/%{name}/scripts
272 %dir %{_libdir}/%{name}/plugins-vpn
273 %config %{_sysconfdir}/dbus-1/system.d/connman-vpn-dbus.conf
274 %{_datadir}/dbus-1/system-services/net.connman.vpn.service
275 %endif
276
277