blob: 68f3b586b82b7bab1a052a2cab4b581283d482c9 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "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 = "GPLv2+ & LGPLv2.1+"
6LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \
7 file://COPYING.LIB;md5=fb504b67c50331fc78734fed90fb0e09 \
Andrew Geissler90fd73c2021-03-05 15:25:55 -06008 file://src/main.c;beginline=1;endline=24;md5=0ad83ca0dc37ab08af448777c581e7ac"
Brad Bishop96ff1982019-08-19 13:50:42 -04009DEPENDS = "dbus glib-2.0"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010PROVIDES += "bluez-hcidump"
Patrick Williams213cb262021-08-07 19:21:33 -050011RPROVIDES:${PN} += "bluez-hcidump"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050012
Patrick Williams213cb262021-08-07 19:21:33 -050013RCONFLICTS:${PN} = "bluez4"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050014
Brad Bishopd7bf8c12018-02-25 22:55:05 -050015PACKAGECONFIG ??= "obex-profiles \
16 readline \
17 ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
18 a2dp-profiles \
19 avrcp-profiles \
20 network-profiles \
21 hid-profiles \
22 hog-profiles \
23 tools \
24 deprecated \
Brad Bishop15ae2502019-06-18 21:44:24 -040025 udev \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050026"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050027PACKAGECONFIG[obex-profiles] = "--enable-obex,--disable-obex,libical"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050028PACKAGECONFIG[readline] = "--enable-client,--disable-client,readline,"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050029PACKAGECONFIG[testing] = "--enable-testing,--disable-testing"
30PACKAGECONFIG[midi] = "--enable-midi,--disable-midi,alsa-lib"
31PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd"
32PACKAGECONFIG[cups] = "--enable-cups,--disable-cups,,cups"
33PACKAGECONFIG[nfc] = "--enable-nfc,--disable-nfc"
34PACKAGECONFIG[sap-profiles] = "--enable-sap,--disable-sap"
35PACKAGECONFIG[a2dp-profiles] = "--enable-a2dp,--disable-a2dp"
36PACKAGECONFIG[avrcp-profiles] = "--enable-avrcp,--disable-avrcp"
37PACKAGECONFIG[network-profiles] = "--enable-network,--disable-network"
38PACKAGECONFIG[hid-profiles] = "--enable-hid,--disable-hid"
39PACKAGECONFIG[hog-profiles] = "--enable-hog,--disable-hog"
40PACKAGECONFIG[health-profiles] = "--enable-health,--disable-health"
41PACKAGECONFIG[sixaxis] = "--enable-sixaxis,--disable-sixaxis"
42PACKAGECONFIG[tools] = "--enable-tools,--disable-tools"
43PACKAGECONFIG[threads] = "--enable-threads,--disable-threads"
44PACKAGECONFIG[deprecated] = "--enable-deprecated,--disable-deprecated"
Andrew Geisslerc9f78652020-09-18 14:11:35 -050045PACKAGECONFIG[mesh] = "--enable-mesh --enable-external-ell,--disable-mesh, json-c ell"
46PACKAGECONFIG[btpclient] = "--enable-btpclient --enable-external-ell,--disable-btpclient, ell"
Brad Bishop15ae2502019-06-18 21:44:24 -040047PACKAGECONFIG[udev] = "--enable-udev,--disable-udev,udev"
Andrew Geissler5f350902021-07-23 13:09:54 -040048PACKAGECONFIG[manpages] = "--enable-manpages,--disable-manpages,python3-docutils-native"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050049
Andrew Geissler82c905d2020-04-13 13:39:40 -050050SRC_URI = "${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \
51 file://init \
52 file://run-ptest \
53 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'file://0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch', d)} \
54 file://0001-tests-add-a-target-for-building-tests-without-runnin.patch \
55 file://0001-test-gatt-Fix-hung-issue.patch \
Andrew Geisslerc926e172021-05-07 16:11:35 -050056 file://0001-audio-Rename-pause-funciton-to-avoid-shadowing-glibc.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050057 "
Patrick Williamsc124f4f2015-09-15 14:41:29 -050058S = "${WORKDIR}/bluez-${PV}"
59
Brad Bishop6e60e8b2018-02-01 10:27:11 -050060CVE_PRODUCT = "bluez"
61
Andrew Geissler5a43b432020-06-13 10:46:56 -050062inherit autotools pkgconfig systemd update-rc.d ptest gobject-introspection-data
Patrick Williamsc124f4f2015-09-15 14:41:29 -050063
64EXTRA_OECONF = "\
Patrick Williamsc124f4f2015-09-15 14:41:29 -050065 --enable-test \
66 --enable-datafiles \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050067 --enable-library \
Andrew Geissler82c905d2020-04-13 13:39:40 -050068 --without-zsh-completion-dir \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050069"
70
71# bluez5 builds a large number of useful utilities but does not
72# install them. Specify which ones we want put into ${PN}-noinst-tools.
73NOINST_TOOLS_READLINE ??= ""
Brad Bishopd7bf8c12018-02-25 22:55:05 -050074NOINST_TOOLS_TESTING ??= ""
75NOINST_TOOLS_BT ??= ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -050076NOINST_TOOLS = " \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050077 ${@bb.utils.contains('PACKAGECONFIG', 'readline', '${NOINST_TOOLS_READLINE}', '', d)} \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050078 ${@bb.utils.contains('PACKAGECONFIG', 'testing', '${NOINST_TOOLS_TESTING}', '', d)} \
79 ${@bb.utils.contains('PACKAGECONFIG', 'tools', '${NOINST_TOOLS_BT}', '', d)} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050080"
81
Patrick Williams213cb262021-08-07 19:21:33 -050082do_install:append() {
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050083 install -d ${D}${INIT_D_DIR}
84 install -m 0755 ${WORKDIR}/init ${D}${INIT_D_DIR}/bluetooth
85
Patrick Williamsc124f4f2015-09-15 14:41:29 -050086 install -d ${D}${sysconfdir}/bluetooth/
Patrick Williamsc124f4f2015-09-15 14:41:29 -050087 if [ -f ${S}/profiles/network/network.conf ]; then
Brad Bishopd7bf8c12018-02-25 22:55:05 -050088 install -m 0644 ${S}/profiles/network/network.conf ${D}/${sysconfdir}/bluetooth/
Patrick Williamsc124f4f2015-09-15 14:41:29 -050089 fi
90 if [ -f ${S}/profiles/input/input.conf ]; then
Brad Bishopd7bf8c12018-02-25 22:55:05 -050091 install -m 0644 ${S}/profiles/input/input.conf ${D}/${sysconfdir}/bluetooth/
Patrick Williamsc124f4f2015-09-15 14:41:29 -050092 fi
Patrick Williamsf1e5d692016-03-30 15:21:19 -050093
Brad Bishopd7bf8c12018-02-25 22:55:05 -050094 if [ -f ${D}/${sysconfdir}/init.d/bluetooth ]; then
95 sed -i -e 's#@LIBEXECDIR@#${libexecdir}#g' ${D}/${sysconfdir}/init.d/bluetooth
96 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -060097
Patrick Williamsc124f4f2015-09-15 14:41:29 -050098 # Install desired tools that upstream leaves in build area
Brad Bishopd7bf8c12018-02-25 22:55:05 -050099 for f in ${NOINST_TOOLS} ; do
100 install -m 755 ${B}/$f ${D}/${bindir}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500101 done
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600102
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500103 # Patch python tools to use Python 3; they should be source compatible, but
104 # still refer to Python 2 in the shebang
105 sed -i -e '1s,#!.*python.*,#!${bindir}/python3,' ${D}${libdir}/bluez/test/*
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500106}
107
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500108PACKAGES =+ "${PN}-testtools ${PN}-obex ${PN}-noinst-tools"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500109
Patrick Williams213cb262021-08-07 19:21:33 -0500110FILES:${PN} += " \
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500111 ${libdir}/bluetooth/plugins/*.so \
112 ${systemd_unitdir}/ ${datadir}/dbus-1 \
113 ${libdir}/cups \
114"
Patrick Williams213cb262021-08-07 19:21:33 -0500115FILES:${PN}-dev += " \
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500116 ${libdir}/bluetooth/plugins/*.la \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500117"
118
Patrick Williams213cb262021-08-07 19:21:33 -0500119FILES:${PN}-obex = "${libexecdir}/bluetooth/obexd \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500120 ${exec_prefix}/lib/systemd/user/obex.service \
Brad Bishop15ae2502019-06-18 21:44:24 -0400121 ${systemd_system_unitdir}/obex.service \
122 ${sysconfdir}/systemd/system/multi-user.target.wants/obex.service \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500123 ${datadir}/dbus-1/services/org.bluez.obex.service \
Brad Bishop15ae2502019-06-18 21:44:24 -0400124 ${sysconfdir}/dbus-1/system.d/obexd.conf \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500125 "
Patrick Williams213cb262021-08-07 19:21:33 -0500126SYSTEMD_SERVICE:${PN}-obex = "obex.service"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500127
Patrick Williams213cb262021-08-07 19:21:33 -0500128FILES:${PN}-testtools = "${libdir}/bluez/test/*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500129
130def get_noinst_tools_paths (d, bb, tools):
131 s = list()
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500132 bindir = d.getVar("bindir")
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500133 for bdp in tools.split():
134 f = os.path.basename(bdp)
135 s.append("%s/%s" % (bindir, f))
136 return "\n".join(s)
137
Patrick Williams213cb262021-08-07 19:21:33 -0500138FILES:${PN}-noinst-tools = "${@get_noinst_tools_paths(d, bb, d.getVar('NOINST_TOOLS'))}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500139
Patrick Williams213cb262021-08-07 19:21:33 -0500140RDEPENDS:${PN}-testtools += "python3-core python3-dbus"
141RDEPENDS:${PN}-testtools += "${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'python3-pygobject', '', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500142
Patrick Williams213cb262021-08-07 19:21:33 -0500143SYSTEMD_SERVICE:${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'bluetooth.service', '', d)}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500144INITSCRIPT_PACKAGES = "${PN}"
Patrick Williams213cb262021-08-07 19:21:33 -0500145INITSCRIPT_NAME:${PN} = "bluetooth"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500146
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500147do_compile_ptest() {
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500148 oe_runmake buildtests
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500149}
150
151do_install_ptest() {
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500152 cp -r ${B}/unit/ ${D}${PTEST_PATH}
153 rm -f ${D}${PTEST_PATH}/unit/*.o
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500154}
Brad Bishopf3f93bb2019-10-16 14:33:32 -0400155
Patrick Williams213cb262021-08-07 19:21:33 -0500156RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-gconv-utf-16"