xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-connectivity/bluez5/bluez5.inc (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunSUMMARY = "Linux Bluetooth Stack Userland V5"
2*4882a593SmuzhiyunDESCRIPTION = "Linux Bluetooth stack V5 userland components.  These include a system configurations, daemons, tools and system libraries."
3*4882a593SmuzhiyunHOMEPAGE = "http://www.bluez.org"
4*4882a593SmuzhiyunSECTION = "libs"
5*4882a593SmuzhiyunLICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later"
6*4882a593SmuzhiyunLIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \
7*4882a593Smuzhiyun                    file://COPYING.LIB;md5=fb504b67c50331fc78734fed90fb0e09 \
8*4882a593Smuzhiyun                    file://src/main.c;beginline=1;endline=24;md5=0ad83ca0dc37ab08af448777c581e7ac"
9*4882a593SmuzhiyunDEPENDS = "dbus glib-2.0"
10*4882a593SmuzhiyunRDEPENDS:${PN} += "dbus"
11*4882a593SmuzhiyunPROVIDES += "bluez-hcidump"
12*4882a593SmuzhiyunRPROVIDES:${PN} += "bluez-hcidump"
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunRCONFLICTS:${PN} = "bluez4"
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunPACKAGECONFIG ??= "obex-profiles \
17*4882a593Smuzhiyun    readline \
18*4882a593Smuzhiyun    ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
19*4882a593Smuzhiyun    a2dp-profiles \
20*4882a593Smuzhiyun    avrcp-profiles \
21*4882a593Smuzhiyun    network-profiles \
22*4882a593Smuzhiyun    hid-profiles \
23*4882a593Smuzhiyun    hog-profiles \
24*4882a593Smuzhiyun    tools \
25*4882a593Smuzhiyun    deprecated \
26*4882a593Smuzhiyun    udev \
27*4882a593Smuzhiyun"
28*4882a593SmuzhiyunPACKAGECONFIG[obex-profiles] = "--enable-obex,--disable-obex,libical"
29*4882a593SmuzhiyunPACKAGECONFIG[readline] = "--enable-client,--disable-client,readline,"
30*4882a593SmuzhiyunPACKAGECONFIG[testing] = "--enable-testing,--disable-testing"
31*4882a593SmuzhiyunPACKAGECONFIG[midi] = "--enable-midi,--disable-midi,alsa-lib"
32*4882a593SmuzhiyunPACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd"
33*4882a593SmuzhiyunPACKAGECONFIG[cups] = "--enable-cups,--disable-cups,,cups"
34*4882a593SmuzhiyunPACKAGECONFIG[nfc] = "--enable-nfc,--disable-nfc"
35*4882a593SmuzhiyunPACKAGECONFIG[sap-profiles] = "--enable-sap,--disable-sap"
36*4882a593SmuzhiyunPACKAGECONFIG[a2dp-profiles] = "--enable-a2dp,--disable-a2dp"
37*4882a593SmuzhiyunPACKAGECONFIG[avrcp-profiles] = "--enable-avrcp,--disable-avrcp"
38*4882a593SmuzhiyunPACKAGECONFIG[network-profiles] = "--enable-network,--disable-network"
39*4882a593SmuzhiyunPACKAGECONFIG[hid-profiles] = "--enable-hid,--disable-hid"
40*4882a593SmuzhiyunPACKAGECONFIG[hog-profiles] = "--enable-hog,--disable-hog"
41*4882a593SmuzhiyunPACKAGECONFIG[health-profiles] = "--enable-health,--disable-health"
42*4882a593SmuzhiyunPACKAGECONFIG[sixaxis] = "--enable-sixaxis,--disable-sixaxis"
43*4882a593SmuzhiyunPACKAGECONFIG[tools] = "--enable-tools,--disable-tools"
44*4882a593SmuzhiyunPACKAGECONFIG[threads] = "--enable-threads,--disable-threads"
45*4882a593SmuzhiyunPACKAGECONFIG[deprecated] = "--enable-deprecated,--disable-deprecated"
46*4882a593SmuzhiyunPACKAGECONFIG[mesh] = "--enable-mesh --enable-external-ell,--disable-mesh, json-c ell"
47*4882a593SmuzhiyunPACKAGECONFIG[btpclient] = "--enable-btpclient --enable-external-ell,--disable-btpclient, ell"
48*4882a593SmuzhiyunPACKAGECONFIG[udev] = "--enable-udev,--disable-udev,udev"
49*4882a593SmuzhiyunPACKAGECONFIG[manpages] = "--enable-manpages,--disable-manpages,python3-docutils-native"
50*4882a593Smuzhiyun
51*4882a593SmuzhiyunSRC_URI = "${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \
52*4882a593Smuzhiyun           file://init \
53*4882a593Smuzhiyun           file://run-ptest \
54*4882a593Smuzhiyun           ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'file://0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch', d)} \
55*4882a593Smuzhiyun           file://0001-tests-add-a-target-for-building-tests-without-runnin.patch \
56*4882a593Smuzhiyun           file://0001-test-gatt-Fix-hung-issue.patch \
57*4882a593Smuzhiyun           "
58*4882a593SmuzhiyunS = "${WORKDIR}/bluez-${PV}"
59*4882a593Smuzhiyun
60*4882a593SmuzhiyunCVE_PRODUCT = "bluez"
61*4882a593Smuzhiyun
62*4882a593Smuzhiyuninherit autotools pkgconfig systemd update-rc.d ptest gobject-introspection-data
63*4882a593Smuzhiyun
64*4882a593SmuzhiyunEXTRA_OECONF = "\
65*4882a593Smuzhiyun  --enable-test \
66*4882a593Smuzhiyun  --enable-datafiles \
67*4882a593Smuzhiyun  --enable-library \
68*4882a593Smuzhiyun  --without-zsh-completion-dir \
69*4882a593Smuzhiyun"
70*4882a593Smuzhiyun
71*4882a593SmuzhiyunCFLAGS += "-DFIRMWARE_DIR=\\"${nonarch_base_libdir}/firmware\\""
72*4882a593Smuzhiyun
73*4882a593Smuzhiyun# bluez5 builds a large number of useful utilities but does not
74*4882a593Smuzhiyun# install them.  Specify which ones we want put into ${PN}-noinst-tools.
75*4882a593SmuzhiyunNOINST_TOOLS_READLINE ??= ""
76*4882a593SmuzhiyunNOINST_TOOLS_TESTING ??= ""
77*4882a593SmuzhiyunNOINST_TOOLS_BT ??= ""
78*4882a593SmuzhiyunNOINST_TOOLS = " \
79*4882a593Smuzhiyun    ${@bb.utils.contains('PACKAGECONFIG', 'readline', '${NOINST_TOOLS_READLINE}', '', d)} \
80*4882a593Smuzhiyun    ${@bb.utils.contains('PACKAGECONFIG', 'testing', '${NOINST_TOOLS_TESTING}', '', d)} \
81*4882a593Smuzhiyun    ${@bb.utils.contains('PACKAGECONFIG', 'tools', '${NOINST_TOOLS_BT}', '', d)} \
82*4882a593Smuzhiyun"
83*4882a593Smuzhiyun
84*4882a593Smuzhiyundo_install:append() {
85*4882a593Smuzhiyun	install -d ${D}${INIT_D_DIR}
86*4882a593Smuzhiyun	install -m 0755 ${WORKDIR}/init ${D}${INIT_D_DIR}/bluetooth
87*4882a593Smuzhiyun
88*4882a593Smuzhiyun	install -d ${D}${sysconfdir}/bluetooth/
89*4882a593Smuzhiyun	if [ -f ${S}/profiles/network/network.conf ]; then
90*4882a593Smuzhiyun		install -m 0644 ${S}/profiles/network/network.conf ${D}/${sysconfdir}/bluetooth/
91*4882a593Smuzhiyun	fi
92*4882a593Smuzhiyun	if [ -f ${S}/profiles/input/input.conf ]; then
93*4882a593Smuzhiyun		install -m 0644 ${S}/profiles/input/input.conf ${D}/${sysconfdir}/bluetooth/
94*4882a593Smuzhiyun	fi
95*4882a593Smuzhiyun
96*4882a593Smuzhiyun	if [ -f ${D}/${sysconfdir}/init.d/bluetooth ]; then
97*4882a593Smuzhiyun		sed -i -e 's#@LIBEXECDIR@#${libexecdir}#g' ${D}/${sysconfdir}/init.d/bluetooth
98*4882a593Smuzhiyun	fi
99*4882a593Smuzhiyun
100*4882a593Smuzhiyun	# Install desired tools that upstream leaves in build area
101*4882a593Smuzhiyun	for f in ${NOINST_TOOLS} ; do
102*4882a593Smuzhiyun		install -m 755 ${B}/$f ${D}/${bindir}
103*4882a593Smuzhiyun	done
104*4882a593Smuzhiyun
105*4882a593Smuzhiyun	# Patch python tools to use Python 3; they should be source compatible, but
106*4882a593Smuzhiyun	# still refer to Python 2 in the shebang
107*4882a593Smuzhiyun	sed -i -e '1s,#!.*python.*,#!${bindir}/python3,' ${D}${libdir}/bluez/test/*
108*4882a593Smuzhiyun}
109*4882a593Smuzhiyun
110*4882a593SmuzhiyunPACKAGES =+ "${PN}-testtools ${PN}-obex ${PN}-noinst-tools"
111*4882a593Smuzhiyun
112*4882a593SmuzhiyunFILES:${PN} += " \
113*4882a593Smuzhiyun    ${libdir}/bluetooth/plugins/*.so \
114*4882a593Smuzhiyun    ${systemd_unitdir}/ ${datadir}/dbus-1 \
115*4882a593Smuzhiyun    ${libdir}/cups \
116*4882a593Smuzhiyun"
117*4882a593SmuzhiyunFILES:${PN}-dev += " \
118*4882a593Smuzhiyun    ${libdir}/bluetooth/plugins/*.la \
119*4882a593Smuzhiyun"
120*4882a593Smuzhiyun
121*4882a593SmuzhiyunFILES:${PN}-obex = "${libexecdir}/bluetooth/obexd \
122*4882a593Smuzhiyun                    ${exec_prefix}/lib/systemd/user/obex.service \
123*4882a593Smuzhiyun                    ${systemd_system_unitdir}/obex.service \
124*4882a593Smuzhiyun                    ${sysconfdir}/systemd/system/multi-user.target.wants/obex.service \
125*4882a593Smuzhiyun                    ${datadir}/dbus-1/services/org.bluez.obex.service \
126*4882a593Smuzhiyun                    ${sysconfdir}/dbus-1/system.d/obexd.conf \
127*4882a593Smuzhiyun                   "
128*4882a593SmuzhiyunSYSTEMD_SERVICE:${PN}-obex = "obex.service"
129*4882a593Smuzhiyun
130*4882a593SmuzhiyunFILES:${PN}-testtools = "${libdir}/bluez/test/*"
131*4882a593Smuzhiyun
132*4882a593Smuzhiyundef get_noinst_tools_paths (d, bb, tools):
133*4882a593Smuzhiyun    s = list()
134*4882a593Smuzhiyun    bindir = d.getVar("bindir")
135*4882a593Smuzhiyun    for bdp in tools.split():
136*4882a593Smuzhiyun        f = os.path.basename(bdp)
137*4882a593Smuzhiyun        s.append("%s/%s" % (bindir, f))
138*4882a593Smuzhiyun    return "\n".join(s)
139*4882a593Smuzhiyun
140*4882a593SmuzhiyunFILES:${PN}-noinst-tools = "${@get_noinst_tools_paths(d, bb, d.getVar('NOINST_TOOLS'))}"
141*4882a593Smuzhiyun
142*4882a593SmuzhiyunRDEPENDS:${PN}-testtools += "python3-core python3-dbus"
143*4882a593SmuzhiyunRDEPENDS:${PN}-testtools += "${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'python3-pygobject', '', d)}"
144*4882a593Smuzhiyun
145*4882a593SmuzhiyunSYSTEMD_SERVICE:${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'bluetooth.service', '', d)}"
146*4882a593SmuzhiyunINITSCRIPT_PACKAGES = "${PN}"
147*4882a593SmuzhiyunINITSCRIPT_NAME:${PN} = "bluetooth"
148*4882a593Smuzhiyun
149*4882a593Smuzhiyundo_compile_ptest() {
150*4882a593Smuzhiyun	oe_runmake buildtests
151*4882a593Smuzhiyun}
152*4882a593Smuzhiyun
153*4882a593Smuzhiyundo_install_ptest() {
154*4882a593Smuzhiyun	cp -r ${B}/unit/ ${D}${PTEST_PATH}
155*4882a593Smuzhiyun	rm -f ${D}${PTEST_PATH}/unit/*.o
156*4882a593Smuzhiyun}
157*4882a593Smuzhiyun
158*4882a593SmuzhiyunRDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-gconv-utf-16"
159