xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-connectivity/connman/connman.inc (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1SUMMARY = "A daemon for managing internet connections within embedded devices"
2DESCRIPTION = "The ConnMan project provides a daemon for managing \
3internet connections within embedded devices running the Linux \
4operating system.  The Connection Manager is designed to be slim and \
5to use as few resources as possible, so it can be easily integrated. \
6It is a fully modular system that can be extended, through plug-ins, \
7to support all kinds of wired or wireless technologies. Also, \
8configuration methods, like DHCP and domain name resolving, are \
9implemented using plug-ins."
10HOMEPAGE = "http://connman.net/"
11BUGTRACKER = "https://01.org/jira/browse/CM"
12LICENSE  = "GPL-2.0-only"
13LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \
14                    file://src/main.c;beginline=1;endline=20;md5=486a279a6ab0c8d152bcda3a5b5edc36"
15
16inherit autotools pkgconfig systemd update-rc.d update-alternatives
17
18CVE_PRODUCT = "connman connection_manager"
19
20DEPENDS  = "dbus glib-2.0 ppp"
21
22EXTRA_OECONF += "\
23    ac_cv_path_WPASUPPLICANT=${sbindir}/wpa_supplicant \
24    ac_cv_path_PPPD=${sbindir}/pppd \
25    --enable-debug \
26    --enable-loopback \
27    --enable-ethernet \
28    --enable-tools \
29    --disable-polkit \
30"
31
32PACKAGECONFIG ??= "wispr iptables client\
33                   ${@bb.utils.filter('DISTRO_FEATURES', '3g systemd wifi', d)} \
34                   ${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} \
35"
36
37# If you want ConnMan to support VPN, add following statement into
38# local.conf or distro config
39# PACKAGECONFIG:append:pn-connman = " openvpn vpnc l2tp pptp"
40
41PACKAGECONFIG[systemd] = "--with-systemdunitdir=${systemd_system_unitdir}/ --with-tmpfilesdir=${sysconfdir}/tmpfiles.d/,--with-systemdunitdir='' --with-tmpfilesdir=''"
42PACKAGECONFIG[wifi] = "--enable-wifi, --disable-wifi, wpa-supplicant, wpa-supplicant"
43PACKAGECONFIG[bluez] = "--enable-bluetooth, --disable-bluetooth, bluez5, bluez5"
44PACKAGECONFIG[3g] = "--enable-ofono, --disable-ofono, ofono, ofono"
45PACKAGECONFIG[tist] = "--enable-tist,--disable-tist,"
46PACKAGECONFIG[openvpn] = "--enable-openvpn --with-openvpn=${sbindir}/openvpn,--disable-openvpn,,openvpn"
47PACKAGECONFIG[vpnc] = "--enable-vpnc --with-vpnc=${sbindir}/vpnc,--disable-vpnc,,vpnc"
48PACKAGECONFIG[l2tp] = "--enable-l2tp --with-l2tp=${sbindir}/xl2tpd,--disable-l2tp,,xl2tpd"
49PACKAGECONFIG[pptp] = "--enable-pptp --with-pptp=${sbindir}/pptp,--disable-pptp,,pptp-linux"
50# WISPr support for logging into hotspots, requires TLS
51PACKAGECONFIG[wispr] = "--enable-wispr,--disable-wispr,gnutls,"
52PACKAGECONFIG[nftables] = "--with-firewall=nftables ,,libmnl libnftnl,,kernel-module-nf-tables kernel-module-nft-chain-nat-ipv4 kernel-module-nft-chain-route-ipv4 kernel-module-nft-masq-ipv4 kernel-module-nft-nat"
53PACKAGECONFIG[iptables] = "--with-firewall=iptables ,,iptables,iptables"
54PACKAGECONFIG[nfc] = "--enable-neard, --disable-neard, neard, neard"
55PACKAGECONFIG[client] = "--enable-client,--disable-client,readline"
56PACKAGECONFIG[wireguard] = "--enable-wireguard,--disable-wireguard,libmnl"
57
58INITSCRIPT_NAME = "connman"
59INITSCRIPT_PARAMS = "start 05 5 2 3 . stop 22 0 1 6 ."
60
61python __anonymous () {
62    systemd_packages = "${PN} ${PN}-wait-online"
63    pkgconfig = d.getVar('PACKAGECONFIG')
64    if ('openvpn' or 'vpnc' or 'l2tp' or 'pptp') in pkgconfig.split():
65        systemd_packages += " ${PN}-vpn"
66    d.setVar('SYSTEMD_PACKAGES', systemd_packages)
67}
68
69SYSTEMD_SERVICE:${PN} = "connman.service"
70SYSTEMD_SERVICE:${PN}-vpn = "connman-vpn.service"
71SYSTEMD_SERVICE:${PN}-wait-online = "connman-wait-online.service"
72
73ALTERNATIVE_PRIORITY = "100"
74ALTERNATIVE:${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','resolv-conf','',d)}"
75ALTERNATIVE_TARGET[resolv-conf] = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${sysconfdir}/resolv-conf.connman','',d)}"
76ALTERNATIVE_LINK_NAME[resolv-conf] = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${sysconfdir}/resolv.conf','',d)}"
77
78do_install:append() {
79	if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
80		install -d ${D}${sysconfdir}/init.d
81		install -m 0755 ${WORKDIR}/connman ${D}${sysconfdir}/init.d/connman
82		sed -i s%@DATADIR@%${datadir}% ${D}${sysconfdir}/init.d/connman
83	fi
84
85	install -d ${D}${bindir}
86	install -m 0755 ${B}/tools/*-test ${D}${bindir}
87	if [ -e ${B}/tools/wispr ]; then
88		install -m 0755 ${B}/tools/wispr ${D}${bindir}
89	fi
90
91	# We don't need to package an empty directory
92	rmdir --ignore-fail-on-non-empty ${D}${libdir}/connman/scripts
93
94	# Automake 1.12 won't install empty directories, but we need the
95	# plugins directory to be present for ownership
96	mkdir -p ${D}${libdir}/connman/plugins
97
98    # For read-only filesystem, do not create links during bootup
99    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
100        ln -sf ../run/connman/resolv.conf ${D}${sysconfdir}/resolv-conf.connman
101    fi
102}
103
104# These used to be plugins, but now they are core
105RPROVIDES:${PN} = "\
106	connman-plugin-loopback \
107	connman-plugin-ethernet \
108	${@bb.utils.contains('PACKAGECONFIG', 'bluetooth','connman-plugin-bluetooth', '', d)} \
109	${@bb.utils.contains('PACKAGECONFIG', 'wifi','connman-plugin-wifi', '', d)} \
110	${@bb.utils.contains('PACKAGECONFIG', '3g','connman-plugin-ofono', '', d)} \
111	"
112
113RDEPENDS:${PN} = "\
114	dbus \
115	"
116
117PACKAGES_DYNAMIC += "^${PN}-plugin-.*"
118
119def add_rdepends(bb, d, file, pkg, depmap, multilib_prefix, add_insane_skip):
120    plugintype = pkg.split( '-' )[-1]
121    if plugintype in depmap:
122        rdepends = map(lambda x: multilib_prefix + x, \
123                       depmap[plugintype].split())
124        d.setVar("RDEPENDS:%s" % pkg, " ".join(rdepends))
125    if add_insane_skip:
126        d.appendVar("INSANE_SKIP:%s" % pkg, "dev-so")
127
128python populate_packages:prepend() {
129    depmap = dict(pppd="ppp")
130    multilib_prefix = (d.getVar("MLPREFIX") or "")
131
132    hook = lambda file,pkg,x,y,z: \
133        add_rdepends(bb, d, file, pkg, depmap, multilib_prefix, False)
134    plugin_dir = d.expand('${libdir}/connman/plugins/')
135    plugin_name = d.expand('${PN}-plugin-%s')
136    do_split_packages(d, plugin_dir, r'^(.*).so$', plugin_name, \
137        '${PN} plugin for %s', extra_depends='', hook=hook, prepend=True )
138
139    hook = lambda file,pkg,x,y,z: \
140        add_rdepends(bb, d, file, pkg, depmap, multilib_prefix, True)
141    plugin_dir = d.expand('${libdir}/connman/plugins-vpn/')
142    plugin_name = d.expand('${PN}-plugin-vpn-%s')
143    do_split_packages(d, plugin_dir, r'^(.*).so$', plugin_name, \
144        '${PN} VPN plugin for %s', extra_depends='', hook=hook, prepend=True )
145}
146
147PACKAGES =+ "${PN}-tools ${PN}-tests ${PN}-client"
148
149FILES:${PN}-tools = "${bindir}/wispr"
150RDEPENDS:${PN}-tools ="${PN}"
151
152FILES:${PN}-tests = "${bindir}/*-test"
153
154FILES:${PN}-client = "${bindir}/connmanctl"
155RDEPENDS:${PN}-client ="${PN}"
156
157FILES:${PN} = "${bindir}/* ${sbindir}/* ${libexecdir}/* ${libdir}/lib*.so.* \
158            ${libdir}/connman/plugins \
159            ${sysconfdir} ${sharedstatedir} ${localstatedir} ${datadir} \
160            ${base_bindir}/* ${base_sbindir}/* ${base_libdir}/*.so* ${datadir}/${PN} \
161            ${datadir}/dbus-1/system-services/* \
162            ${sysconfdir}/tmpfiles.d/connman_resolvconf.conf"
163
164FILES:${PN}-dev += "${libdir}/connman/*/*.la"
165
166PACKAGES =+ "${PN}-vpn ${PN}-wait-online"
167
168SUMMARY:${PN}-vpn = "A daemon for managing VPN connections within embedded devices"
169DESCRIPTION:${PN}-vpn = "The ConnMan VPN provides a daemon for \
170managing VPN connections within embedded devices running the Linux \
171operating system.  The connman-vpnd handles all the VPN connections \
172and starts/stops VPN client processes when necessary. The connman-vpnd \
173provides a DBus API for managing VPN connections. All the different \
174VPN technogies are implemented using plug-ins."
175FILES:${PN}-vpn += "${sbindir}/connman-vpnd \
176                    ${sysconfdir}/dbus-1/system.d/connman-vpn-dbus.conf \
177                    ${datadir}/dbus-1/system-services/net.connman.vpn.service \
178                    ${systemd_system_unitdir}/connman-vpn.service"
179
180SUMMARY:${PN}-wait-online = "A program that will return once ConnMan has connected to a network"
181DESCRIPTION:${PN}-wait-online = "A service that can be enabled so that \
182the system waits until a network connection is established."
183FILES:${PN}-wait-online += "${sbindir}/connmand-wait-online \
184                            ${systemd_system_unitdir}/connman-wait-online.service"
185
186SUMMARY:${PN}-plugin-vpn-openvpn = "An OpenVPN plugin for ConnMan VPN"
187DESCRIPTION:${PN}-plugin-vpn-openvpn = "The ConnMan OpenVPN plugin uses openvpn client \
188to create a VPN connection to OpenVPN server."
189FILES:${PN}-plugin-vpn-openvpn += "${libdir}/connman/scripts/openvpn-script \
190                                   ${libdir}/connman/plugins-vpn/openvpn.so"
191RDEPENDS:${PN}-plugin-vpn-openvpn += "${PN}-vpn"
192RRECOMMENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG','openvpn','${PN}-plugin-vpn-openvpn', '', d)}"
193
194SUMMARY:${PN}-plugin-vpn-vpnc = "A vpnc plugin for ConnMan VPN"
195DESCRIPTION:${PN}-plugin-vpn-vpnc = "The ConnMan vpnc plugin uses vpnc client \
196to create a VPN connection to Cisco3000 VPN Concentrator."
197FILES:${PN}-plugin-vpn-vpnc += "${libdir}/connman/scripts/openconnect-script \
198                                ${libdir}/connman/plugins-vpn/vpnc.so \
199                                ${libdir}/connman/scripts/vpn-script"
200RDEPENDS:${PN}-plugin-vpn-vpnc += "${PN}-vpn"
201RRECOMMENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG','vpnc','${PN}-plugin-vpn-vpnc', '', d)}"
202
203SUMMARY:${PN}-plugin-vpn-l2tp = "A L2TP plugin for ConnMan VPN"
204DESCRIPTION:${PN}-plugin-vpn-l2tp = "The ConnMan L2TP plugin uses xl2tpd daemon \
205to create a VPN connection to L2TP server."
206FILES:${PN}-plugin-vpn-l2tp += "${libdir}/connman/scripts/libppp-plugin.so* \
207                                ${libdir}/connman/plugins-vpn/l2tp.so"
208RDEPENDS:${PN}-plugin-vpn-l2tp += "${PN}-vpn"
209RRECOMMENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG','l2tp','${PN}-plugin-vpn-l2tp', '', d)}"
210
211SUMMARY:${PN}-plugin-vpn-pptp = "A PPTP plugin for ConnMan VPN"
212DESCRIPTION:${PN}-plugin-vpn-pptp = "The ConnMan PPTP plugin uses pptp-linux client \
213to create a VPN connection to PPTP server."
214FILES:${PN}-plugin-vpn-pptp += "${libdir}/connman/scripts/libppp-plugin.so* \
215                                ${libdir}/connman/plugins-vpn/pptp.so"
216RDEPENDS:${PN}-plugin-vpn-pptp += "${PN}-vpn"
217RRECOMMENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG','pptp','${PN}-plugin-vpn-pptp', '', d)}"
218