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