blob: bffd174c0a0aa753253c689ebec2cabc7696118a [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 \
8 file://src/main.c;beginline=1;endline=24;md5=9bc54b93cd7e17bf03f52513f39f926e"
Brad Bishop96ff1982019-08-19 13:50:42 -04009DEPENDS = "dbus glib-2.0"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010PROVIDES += "bluez-hcidump"
11RPROVIDES_${PN} += "bluez-hcidump"
12
13RCONFLICTS_${PN} = "bluez4"
14
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"
Brad Bishop19323692019-04-05 15:28:33 -040045PACKAGECONFIG[mesh] = "--enable-mesh,--disable-mesh, json-c ell"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080046PACKAGECONFIG[btpclient] = "--enable-btpclient,--disable-btpclient, ell"
Brad Bishop15ae2502019-06-18 21:44:24 -040047PACKAGECONFIG[udev] = "--enable-udev,--disable-udev,udev"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050048
49SRC_URI = "\
50 ${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060051 file://out-of-tree.patch \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050052 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 \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080056 file://0001-test-gatt-Fix-hung-issue.patch \
Andrew Geissler99467da2019-02-25 18:54:23 -060057 file://0001-Makefile.am-Fix-a-race-issue-for-tools.patch \
Brad Bishop19323692019-04-05 15:28:33 -040058 file://CVE-2018-10910.patch \
Brad Bishop15ae2502019-06-18 21:44:24 -040059 file://gcc9-fixes.patch \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050060"
61S = "${WORKDIR}/bluez-${PV}"
62
Brad Bishop6e60e8b2018-02-01 10:27:11 -050063CVE_PRODUCT = "bluez"
64
Brad Bishop316dfdd2018-06-25 12:45:53 -040065inherit autotools pkgconfig systemd update-rc.d distro_features_check ptest gobject-introspection-data
Patrick Williamsc124f4f2015-09-15 14:41:29 -050066
67EXTRA_OECONF = "\
Patrick Williamsc124f4f2015-09-15 14:41:29 -050068 --enable-test \
69 --enable-datafiles \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050070 --enable-library \
71"
72
73# bluez5 builds a large number of useful utilities but does not
74# install them. Specify which ones we want put into ${PN}-noinst-tools.
75NOINST_TOOLS_READLINE ??= ""
Brad Bishopd7bf8c12018-02-25 22:55:05 -050076NOINST_TOOLS_TESTING ??= ""
77NOINST_TOOLS_BT ??= ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -050078NOINST_TOOLS = " \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050079 ${@bb.utils.contains('PACKAGECONFIG', 'readline', '${NOINST_TOOLS_READLINE}', '', d)} \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050080 ${@bb.utils.contains('PACKAGECONFIG', 'testing', '${NOINST_TOOLS_TESTING}', '', d)} \
81 ${@bb.utils.contains('PACKAGECONFIG', 'tools', '${NOINST_TOOLS_BT}', '', d)} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050082"
83
84do_install_append() {
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050085 install -d ${D}${INIT_D_DIR}
86 install -m 0755 ${WORKDIR}/init ${D}${INIT_D_DIR}/bluetooth
87
Patrick Williamsc124f4f2015-09-15 14:41:29 -050088 install -d ${D}${sysconfdir}/bluetooth/
Patrick Williamsc124f4f2015-09-15 14:41:29 -050089 if [ -f ${S}/profiles/network/network.conf ]; then
Brad Bishopd7bf8c12018-02-25 22:55:05 -050090 install -m 0644 ${S}/profiles/network/network.conf ${D}/${sysconfdir}/bluetooth/
Patrick Williamsc124f4f2015-09-15 14:41:29 -050091 fi
92 if [ -f ${S}/profiles/input/input.conf ]; then
Brad Bishopd7bf8c12018-02-25 22:55:05 -050093 install -m 0644 ${S}/profiles/input/input.conf ${D}/${sysconfdir}/bluetooth/
Patrick Williamsc124f4f2015-09-15 14:41:29 -050094 fi
Patrick Williamsf1e5d692016-03-30 15:21:19 -050095
Brad Bishopd7bf8c12018-02-25 22:55:05 -050096 if [ -f ${D}/${sysconfdir}/init.d/bluetooth ]; then
97 sed -i -e 's#@LIBEXECDIR@#${libexecdir}#g' ${D}/${sysconfdir}/init.d/bluetooth
98 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -060099
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500100 # Install desired tools that upstream leaves in build area
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500101 for f in ${NOINST_TOOLS} ; do
102 install -m 755 ${B}/$f ${D}/${bindir}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500103 done
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600104
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500105 # Patch python tools to use Python 3; they should be source compatible, but
106 # still refer to Python 2 in the shebang
107 sed -i -e '1s,#!.*python.*,#!${bindir}/python3,' ${D}${libdir}/bluez/test/*
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500108}
109
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500110PACKAGES =+ "${PN}-testtools ${PN}-obex ${PN}-noinst-tools"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500111
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500112FILES_${PN} += " \
113 ${libdir}/bluetooth/plugins/*.so \
114 ${systemd_unitdir}/ ${datadir}/dbus-1 \
115 ${libdir}/cups \
116"
117FILES_${PN}-dev += " \
118 ${libdir}/bluetooth/plugins/*.la \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500119"
120
121FILES_${PN}-obex = "${libexecdir}/bluetooth/obexd \
122 ${exec_prefix}/lib/systemd/user/obex.service \
Brad Bishop15ae2502019-06-18 21:44:24 -0400123 ${systemd_system_unitdir}/obex.service \
124 ${sysconfdir}/systemd/system/multi-user.target.wants/obex.service \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500125 ${datadir}/dbus-1/services/org.bluez.obex.service \
Brad Bishop15ae2502019-06-18 21:44:24 -0400126 ${sysconfdir}/dbus-1/system.d/obexd.conf \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500127 "
128SYSTEMD_SERVICE_${PN}-obex = "obex.service"
129
130FILES_${PN}-testtools = "${libdir}/bluez/test/*"
131
132def get_noinst_tools_paths (d, bb, tools):
133 s = list()
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500134 bindir = d.getVar("bindir")
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500135 for bdp in tools.split():
136 f = os.path.basename(bdp)
137 s.append("%s/%s" % (bindir, f))
138 return "\n".join(s)
139
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500140FILES_${PN}-noinst-tools = "${@get_noinst_tools_paths(d, bb, d.getVar('NOINST_TOOLS'))}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500141
Brad Bishop08902b02019-08-20 09:16:51 -0400142RDEPENDS_${PN}-testtools += "python3-core python3-dbus"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400143RDEPENDS_${PN}-testtools += "${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'python3-pygobject', '', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500144
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500145SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'bluetooth.service', '', d)}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500146INITSCRIPT_PACKAGES = "${PN}"
147INITSCRIPT_NAME_${PN} = "bluetooth"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500148
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500149do_compile_ptest() {
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500150 oe_runmake buildtests
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500151}
152
153do_install_ptest() {
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500154 cp -r ${B}/unit/ ${D}${PTEST_PATH}
155 rm -f ${D}${PTEST_PATH}/unit/*.o
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500156}