blob: a31d7076ba801c1062941e25ec32fd3511aac917 [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"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00005LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05006LIC_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 Williams2390b1b2022-11-03 13:47:49 -050010RDEPENDS:${PN} += "dbus"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050011PROVIDES += "bluez-hcidump"
Patrick Williams213cb262021-08-07 19:21:33 -050012RPROVIDES:${PN} += "bluez-hcidump"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050013
Patrick Williams213cb262021-08-07 19:21:33 -050014RCONFLICTS:${PN} = "bluez4"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050015
Brad Bishopd7bf8c12018-02-25 22:55:05 -050016PACKAGECONFIG ??= "obex-profiles \
17 readline \
18 ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
19 a2dp-profiles \
20 avrcp-profiles \
21 network-profiles \
22 hid-profiles \
23 hog-profiles \
24 tools \
25 deprecated \
Brad Bishop15ae2502019-06-18 21:44:24 -040026 udev \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050027"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028PACKAGECONFIG[obex-profiles] = "--enable-obex,--disable-obex,libical"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050029PACKAGECONFIG[readline] = "--enable-client,--disable-client,readline,"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050030PACKAGECONFIG[testing] = "--enable-testing,--disable-testing"
31PACKAGECONFIG[midi] = "--enable-midi,--disable-midi,alsa-lib"
32PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd"
33PACKAGECONFIG[cups] = "--enable-cups,--disable-cups,,cups"
34PACKAGECONFIG[nfc] = "--enable-nfc,--disable-nfc"
35PACKAGECONFIG[sap-profiles] = "--enable-sap,--disable-sap"
36PACKAGECONFIG[a2dp-profiles] = "--enable-a2dp,--disable-a2dp"
37PACKAGECONFIG[avrcp-profiles] = "--enable-avrcp,--disable-avrcp"
38PACKAGECONFIG[network-profiles] = "--enable-network,--disable-network"
39PACKAGECONFIG[hid-profiles] = "--enable-hid,--disable-hid"
40PACKAGECONFIG[hog-profiles] = "--enable-hog,--disable-hog"
41PACKAGECONFIG[health-profiles] = "--enable-health,--disable-health"
42PACKAGECONFIG[sixaxis] = "--enable-sixaxis,--disable-sixaxis"
43PACKAGECONFIG[tools] = "--enable-tools,--disable-tools"
44PACKAGECONFIG[threads] = "--enable-threads,--disable-threads"
45PACKAGECONFIG[deprecated] = "--enable-deprecated,--disable-deprecated"
Andrew Geisslerc9f78652020-09-18 14:11:35 -050046PACKAGECONFIG[mesh] = "--enable-mesh --enable-external-ell,--disable-mesh, json-c ell"
47PACKAGECONFIG[btpclient] = "--enable-btpclient --enable-external-ell,--disable-btpclient, ell"
Brad Bishop15ae2502019-06-18 21:44:24 -040048PACKAGECONFIG[udev] = "--enable-udev,--disable-udev,udev"
Andrew Geissler5f350902021-07-23 13:09:54 -040049PACKAGECONFIG[manpages] = "--enable-manpages,--disable-manpages,python3-docutils-native"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050050
Andrew Geissler82c905d2020-04-13 13:39:40 -050051SRC_URI = "${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \
52 file://init \
53 file://run-ptest \
54 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'file://0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch', d)} \
55 file://0001-tests-add-a-target-for-building-tests-without-runnin.patch \
56 file://0001-test-gatt-Fix-hung-issue.patch \
Andrew Geissler517393d2023-01-13 08:55:19 -060057 file://0004-src-shared-util.c-include-linux-limits.h.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050058 "
Patrick Williamsc124f4f2015-09-15 14:41:29 -050059S = "${WORKDIR}/bluez-${PV}"
60
Brad Bishop6e60e8b2018-02-01 10:27:11 -050061CVE_PRODUCT = "bluez"
62
Andrew Geissler5a43b432020-06-13 10:46:56 -050063inherit autotools pkgconfig systemd update-rc.d ptest gobject-introspection-data
Patrick Williamsc124f4f2015-09-15 14:41:29 -050064
65EXTRA_OECONF = "\
Patrick Williamsc124f4f2015-09-15 14:41:29 -050066 --enable-test \
67 --enable-datafiles \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050068 --enable-library \
Andrew Geissler517393d2023-01-13 08:55:19 -060069 --enable-pie \
Andrew Geissler82c905d2020-04-13 13:39:40 -050070 --without-zsh-completion-dir \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050071"
72
Patrick Williams2390b1b2022-11-03 13:47:49 -050073CFLAGS += "-DFIRMWARE_DIR=\\"${nonarch_base_libdir}/firmware\\""
74
Patrick Williamsc124f4f2015-09-15 14:41:29 -050075# bluez5 builds a large number of useful utilities but does not
76# install them. Specify which ones we want put into ${PN}-noinst-tools.
77NOINST_TOOLS_READLINE ??= ""
Brad Bishopd7bf8c12018-02-25 22:55:05 -050078NOINST_TOOLS_TESTING ??= ""
79NOINST_TOOLS_BT ??= ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -050080NOINST_TOOLS = " \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050081 ${@bb.utils.contains('PACKAGECONFIG', 'readline', '${NOINST_TOOLS_READLINE}', '', d)} \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050082 ${@bb.utils.contains('PACKAGECONFIG', 'testing', '${NOINST_TOOLS_TESTING}', '', d)} \
83 ${@bb.utils.contains('PACKAGECONFIG', 'tools', '${NOINST_TOOLS_BT}', '', d)} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050084"
85
Patrick Williams213cb262021-08-07 19:21:33 -050086do_install:append() {
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050087 install -d ${D}${INIT_D_DIR}
88 install -m 0755 ${WORKDIR}/init ${D}${INIT_D_DIR}/bluetooth
89
Brad Bishopd7bf8c12018-02-25 22:55:05 -050090 if [ -f ${D}/${sysconfdir}/init.d/bluetooth ]; then
91 sed -i -e 's#@LIBEXECDIR@#${libexecdir}#g' ${D}/${sysconfdir}/init.d/bluetooth
92 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -060093
Patrick Williamsc124f4f2015-09-15 14:41:29 -050094 # Install desired tools that upstream leaves in build area
Brad Bishopd7bf8c12018-02-25 22:55:05 -050095 for f in ${NOINST_TOOLS} ; do
96 install -m 755 ${B}/$f ${D}/${bindir}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050097 done
Patrick Williamsc0f7c042017-02-23 20:41:17 -060098
Brad Bishopd7bf8c12018-02-25 22:55:05 -050099 # Patch python tools to use Python 3; they should be source compatible, but
100 # still refer to Python 2 in the shebang
101 sed -i -e '1s,#!.*python.*,#!${bindir}/python3,' ${D}${libdir}/bluez/test/*
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500102}
103
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500104PACKAGES =+ "${PN}-testtools ${PN}-obex ${PN}-noinst-tools"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500105
Patrick Williams213cb262021-08-07 19:21:33 -0500106FILES:${PN} += " \
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500107 ${libdir}/bluetooth/plugins/*.so \
108 ${systemd_unitdir}/ ${datadir}/dbus-1 \
109 ${libdir}/cups \
110"
Patrick Williams213cb262021-08-07 19:21:33 -0500111FILES:${PN}-dev += " \
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500112 ${libdir}/bluetooth/plugins/*.la \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500113"
114
Patrick Williams213cb262021-08-07 19:21:33 -0500115FILES:${PN}-obex = "${libexecdir}/bluetooth/obexd \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500116 ${exec_prefix}/lib/systemd/user/obex.service \
Brad Bishop15ae2502019-06-18 21:44:24 -0400117 ${systemd_system_unitdir}/obex.service \
118 ${sysconfdir}/systemd/system/multi-user.target.wants/obex.service \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500119 ${datadir}/dbus-1/services/org.bluez.obex.service \
Brad Bishop15ae2502019-06-18 21:44:24 -0400120 ${sysconfdir}/dbus-1/system.d/obexd.conf \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500121 "
Patrick Williams213cb262021-08-07 19:21:33 -0500122SYSTEMD_SERVICE:${PN}-obex = "obex.service"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500123
Patrick Williams213cb262021-08-07 19:21:33 -0500124FILES:${PN}-testtools = "${libdir}/bluez/test/*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500125
126def get_noinst_tools_paths (d, bb, tools):
127 s = list()
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500128 bindir = d.getVar("bindir")
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500129 for bdp in tools.split():
130 f = os.path.basename(bdp)
131 s.append("%s/%s" % (bindir, f))
132 return "\n".join(s)
133
Patrick Williams213cb262021-08-07 19:21:33 -0500134FILES:${PN}-noinst-tools = "${@get_noinst_tools_paths(d, bb, d.getVar('NOINST_TOOLS'))}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500135
Patrick Williams213cb262021-08-07 19:21:33 -0500136RDEPENDS:${PN}-testtools += "python3-core python3-dbus"
137RDEPENDS:${PN}-testtools += "${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'python3-pygobject', '', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500138
Patrick Williams213cb262021-08-07 19:21:33 -0500139SYSTEMD_SERVICE:${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'bluetooth.service', '', d)}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500140INITSCRIPT_PACKAGES = "${PN}"
Patrick Williams213cb262021-08-07 19:21:33 -0500141INITSCRIPT_NAME:${PN} = "bluetooth"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500142
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500143do_compile_ptest() {
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500144 oe_runmake buildtests
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500145}
146
147do_install_ptest() {
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500148 cp -r ${B}/unit/ ${D}${PTEST_PATH}
149 rm -f ${D}${PTEST_PATH}/unit/*.o
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500150}
Brad Bishopf3f93bb2019-10-16 14:33:32 -0400151
Patrick Williams213cb262021-08-07 19:21:33 -0500152RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-gconv-utf-16"