xref: /openbmc/openbmc/poky/meta/recipes-connectivity/bluez5/bluez5.inc (revision 8460358c3d24c71d9d38fd126c745854a6301564)
1SUMMARY = "Linux Bluetooth Stack Userland V5"
2DESCRIPTION = "Linux Bluetooth stack V5 userland components.  These include a system configurations, daemons, tools and system libraries."
3HOMEPAGE = "http://www.bluez.org"
4SECTION = "libs"
5LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later"
6LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \
7                    file://COPYING.LIB;md5=fb504b67c50331fc78734fed90fb0e09 \
8                    file://src/main.c;beginline=1;endline=24;md5=0ad83ca0dc37ab08af448777c581e7ac"
9DEPENDS = "dbus glib-2.0"
10RDEPENDS:${PN} += "dbus"
11PROVIDES += "bluez-hcidump"
12RPROVIDES:${PN} += "bluez-hcidump"
13
14RCONFLICTS:${PN} = "bluez4"
15
16PACKAGECONFIG ??= "obex-profiles \
17    readline \
18    ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
19    a2dp-profiles \
20    avrcp-profiles \
21    bap-profiles \
22    bass-profiles \
23    mcp-profiles \
24    ccp-profiles \
25    vcp-profiles \
26    micp-profiles \
27    csip-profiles \
28    asha-profiles \
29    network-profiles \
30    hid-profiles \
31    hog-profiles \
32    tools \
33    deprecated \
34    udev \
35"
36PACKAGECONFIG[obex-profiles] = "--enable-obex,--disable-obex,libical"
37PACKAGECONFIG[readline] = "--enable-client,--disable-client,readline,"
38PACKAGECONFIG[testing] = "--enable-testing,--disable-testing"
39PACKAGECONFIG[midi] = "--enable-midi,--disable-midi,alsa-lib"
40PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd"
41PACKAGECONFIG[cups] = "--enable-cups,--disable-cups,,cups"
42PACKAGECONFIG[nfc] = "--enable-nfc,--disable-nfc"
43PACKAGECONFIG[sap-profiles] = "--enable-sap,--disable-sap"
44PACKAGECONFIG[a2dp-profiles] = "--enable-a2dp,--disable-a2dp"
45PACKAGECONFIG[avrcp-profiles] = "--enable-avrcp,--disable-avrcp"
46PACKAGECONFIG[network-profiles] = "--enable-network,--disable-network"
47PACKAGECONFIG[hid-profiles] = "--enable-hid,--disable-hid"
48PACKAGECONFIG[hog-profiles] = "--enable-hog,--disable-hog"
49PACKAGECONFIG[health-profiles] = "--enable-health,--disable-health"
50PACKAGECONFIG[bap-profiles] = "--enable-bap,--disable-bap"
51PACKAGECONFIG[bass-profiles] = "--enable-bass,--disable-bass"
52PACKAGECONFIG[mcp-profiles] = "--enable-mcp,--disable-mcp"
53PACKAGECONFIG[ccp-profiles] = "--enable-ccp,--disable-ccp"
54PACKAGECONFIG[vcp-profiles] = "--enable-vcp,--disable-vcp"
55PACKAGECONFIG[micp-profiles] = "--enable-micp,--disable-micp"
56PACKAGECONFIG[csip-profiles] = "--enable-csip,--disable-csip"
57PACKAGECONFIG[asha-profiles] = "--enable-asha,--disable-asha"
58PACKAGECONFIG[sixaxis] = "--enable-sixaxis,--disable-sixaxis"
59PACKAGECONFIG[tools] = "--enable-tools,--disable-tools"
60PACKAGECONFIG[threads] = "--enable-threads,--disable-threads"
61PACKAGECONFIG[deprecated] = "--enable-deprecated,--disable-deprecated"
62PACKAGECONFIG[mesh] = "--enable-mesh --enable-external-ell,--disable-mesh, json-c ell"
63PACKAGECONFIG[btpclient] = "--enable-btpclient --enable-external-ell,--disable-btpclient, ell"
64PACKAGECONFIG[udev] = "--enable-udev,--disable-udev,udev"
65PACKAGECONFIG[manpages] = "--enable-manpages,--disable-manpages,python3-docutils-native"
66
67SRC_URI = "${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \
68           file://init \
69           file://run-ptest \
70           file://0001-tests-add-a-target-for-building-tests-without-runnin.patch \
71           file://0001-test-gatt-Fix-hung-issue.patch \
72           file://0001-gdbus-define-MAX_INPUT-for-musl.patch \
73           "
74S = "${WORKDIR}/bluez-${PV}"
75
76CVE_PRODUCT = "bluez"
77
78inherit autotools pkgconfig systemd update-rc.d ptest gobject-introspection-data
79
80EXTRA_OECONF = "\
81  --enable-test \
82  --enable-datafiles \
83  --enable-library \
84  --enable-pie  \
85  --without-zsh-completion-dir \
86"
87
88CFLAGS += "-DFIRMWARE_DIR=\\"${nonarch_base_libdir}/firmware\\""
89
90# bluez5 builds a large number of useful utilities but does not
91# install them.  Specify which ones we want put into ${PN}-noinst-tools.
92NOINST_TOOLS_READLINE ??= ""
93NOINST_TOOLS_TESTING ??= ""
94NOINST_TOOLS_BT ??= ""
95NOINST_TOOLS = " \
96    ${@bb.utils.contains('PACKAGECONFIG', 'readline', '${NOINST_TOOLS_READLINE}', '', d)} \
97    ${@bb.utils.contains('PACKAGECONFIG', 'testing', '${NOINST_TOOLS_TESTING}', '', d)} \
98    ${@bb.utils.contains('PACKAGECONFIG', 'tools', '${NOINST_TOOLS_BT}', '', d)} \
99"
100
101do_install:append() {
102	install -d ${D}${INIT_D_DIR}
103	install -m 0755 ${UNPACKDIR}/init ${D}${INIT_D_DIR}/bluetooth
104
105	if [ -f ${D}${sysconfdir}/init.d/bluetooth ]; then
106		sed -i -e 's#@LIBEXECDIR@#${libexecdir}#g' ${D}${sysconfdir}/init.d/bluetooth
107	fi
108
109	# Install desired tools that upstream leaves in build area
110	for f in ${NOINST_TOOLS} ; do
111		install -m 755 ${B}/$f ${D}${bindir}
112	done
113
114	# Fix the /etc/bluetooth directory permissions when systemd is disabled
115	if ${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'false', 'true', d)}; then
116		chmod 0755 ${D}${sysconfdir}/bluetooth
117	fi
118}
119
120PACKAGES =+ "${PN}-testtools ${PN}-obex ${PN}-noinst-tools"
121
122FILES:${PN} += " \
123    ${libdir}/bluetooth/plugins/*.so \
124    ${systemd_unitdir}/ ${datadir}/dbus-1 \
125    ${libdir}/cups \
126"
127FILES:${PN}-dev += " \
128    ${libdir}/bluetooth/plugins/*.la \
129"
130
131FILES:${PN}-obex = "${libexecdir}/bluetooth/obexd \
132                    ${exec_prefix}/lib/systemd/user/obex.service \
133                    ${systemd_system_unitdir}/obex.service \
134                    ${sysconfdir}/systemd/system/multi-user.target.wants/obex.service \
135                    ${datadir}/dbus-1/services/org.bluez.obex.service \
136                    ${sysconfdir}/dbus-1/system.d/obexd.conf \
137                   "
138SYSTEMD_SERVICE:${PN}-obex = "obex.service"
139
140FILES:${PN}-testtools = "${libdir}/bluez/test/*"
141
142def get_noinst_tools_paths (d, bb, tools):
143    s = list()
144    bindir = d.getVar("bindir")
145    for bdp in tools.split():
146        f = os.path.basename(bdp)
147        s.append("%s/%s" % (bindir, f))
148    return "\n".join(s)
149
150FILES:${PN}-noinst-tools = "${@get_noinst_tools_paths(d, bb, d.getVar('NOINST_TOOLS'))}"
151
152RDEPENDS:${PN}-testtools += "python3-core python3-dbus"
153RDEPENDS:${PN}-testtools += "${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'python3-pygobject', '', d)}"
154
155SYSTEMD_SERVICE:${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'bluetooth.service', '', d)}"
156INITSCRIPT_PACKAGES = "${PN}"
157INITSCRIPT_NAME:${PN} = "bluetooth"
158
159do_compile_ptest() {
160	oe_runmake buildtests
161}
162
163do_install_ptest() {
164	cp -r ${B}/unit/ ${D}${PTEST_PATH}
165	rm -f ${D}${PTEST_PATH}/unit/*.o
166}
167
168RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-gconv-utf-16"
169