blob: 1807aa7c96d53fd91eca74d327917411e4ed15f6 [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 Bishopd7bf8c12018-02-25 22:55:05 -05009DEPENDS = "udev dbus-glib glib-2.0 libcheck"
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 \
25"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026PACKAGECONFIG[obex-profiles] = "--enable-obex,--disable-obex,libical"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050027PACKAGECONFIG[readline] = "--enable-client,--disable-client,readline,"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050028PACKAGECONFIG[testing] = "--enable-testing,--disable-testing"
29PACKAGECONFIG[midi] = "--enable-midi,--disable-midi,alsa-lib"
30PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd"
31PACKAGECONFIG[cups] = "--enable-cups,--disable-cups,,cups"
32PACKAGECONFIG[nfc] = "--enable-nfc,--disable-nfc"
33PACKAGECONFIG[sap-profiles] = "--enable-sap,--disable-sap"
34PACKAGECONFIG[a2dp-profiles] = "--enable-a2dp,--disable-a2dp"
35PACKAGECONFIG[avrcp-profiles] = "--enable-avrcp,--disable-avrcp"
36PACKAGECONFIG[network-profiles] = "--enable-network,--disable-network"
37PACKAGECONFIG[hid-profiles] = "--enable-hid,--disable-hid"
38PACKAGECONFIG[hog-profiles] = "--enable-hog,--disable-hog"
39PACKAGECONFIG[health-profiles] = "--enable-health,--disable-health"
40PACKAGECONFIG[sixaxis] = "--enable-sixaxis,--disable-sixaxis"
41PACKAGECONFIG[tools] = "--enable-tools,--disable-tools"
42PACKAGECONFIG[threads] = "--enable-threads,--disable-threads"
43PACKAGECONFIG[deprecated] = "--enable-deprecated,--disable-deprecated"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050044
45SRC_URI = "\
46 ${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060047 file://out-of-tree.patch \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050048 file://init \
49 file://run-ptest \
50 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'file://0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch', d)} \
51 file://0001-tests-add-a-target-for-building-tests-without-runnin.patch \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050052 file://0001-hciattach-bcm43xx-fix-the-delay-timer-for-firmware-d.patch \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050053 file://cve-2017-1000250.patch \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054"
55S = "${WORKDIR}/bluez-${PV}"
56
Brad Bishop6e60e8b2018-02-01 10:27:11 -050057CVE_PRODUCT = "bluez"
58
Patrick Williamsc0f7c042017-02-23 20:41:17 -060059inherit autotools pkgconfig systemd update-rc.d distro_features_check ptest
Patrick Williamsc124f4f2015-09-15 14:41:29 -050060
61EXTRA_OECONF = "\
Patrick Williamsc124f4f2015-09-15 14:41:29 -050062 --enable-test \
63 --enable-datafiles \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050064 --enable-library \
65"
66
67# bluez5 builds a large number of useful utilities but does not
68# install them. Specify which ones we want put into ${PN}-noinst-tools.
69NOINST_TOOLS_READLINE ??= ""
Brad Bishopd7bf8c12018-02-25 22:55:05 -050070NOINST_TOOLS_TESTING ??= ""
71NOINST_TOOLS_BT ??= ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -050072NOINST_TOOLS = " \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050073 ${@bb.utils.contains('PACKAGECONFIG', 'readline', '${NOINST_TOOLS_READLINE}', '', d)} \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050074 ${@bb.utils.contains('PACKAGECONFIG', 'testing', '${NOINST_TOOLS_TESTING}', '', d)} \
75 ${@bb.utils.contains('PACKAGECONFIG', 'tools', '${NOINST_TOOLS_BT}', '', d)} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050076"
77
78do_install_append() {
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050079 install -d ${D}${INIT_D_DIR}
80 install -m 0755 ${WORKDIR}/init ${D}${INIT_D_DIR}/bluetooth
81
Patrick Williamsc124f4f2015-09-15 14:41:29 -050082 install -d ${D}${sysconfdir}/bluetooth/
Patrick Williamsc124f4f2015-09-15 14:41:29 -050083 if [ -f ${S}/profiles/network/network.conf ]; then
Brad Bishopd7bf8c12018-02-25 22:55:05 -050084 install -m 0644 ${S}/profiles/network/network.conf ${D}/${sysconfdir}/bluetooth/
Patrick Williamsc124f4f2015-09-15 14:41:29 -050085 fi
86 if [ -f ${S}/profiles/input/input.conf ]; then
Brad Bishopd7bf8c12018-02-25 22:55:05 -050087 install -m 0644 ${S}/profiles/input/input.conf ${D}/${sysconfdir}/bluetooth/
Patrick Williamsc124f4f2015-09-15 14:41:29 -050088 fi
Patrick Williamsf1e5d692016-03-30 15:21:19 -050089
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
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500106FILES_${PN} += " \
107 ${libdir}/bluetooth/plugins/*.so \
108 ${systemd_unitdir}/ ${datadir}/dbus-1 \
109 ${libdir}/cups \
110"
111FILES_${PN}-dev += " \
112 ${libdir}/bluetooth/plugins/*.la \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500113"
114
115FILES_${PN}-obex = "${libexecdir}/bluetooth/obexd \
116 ${exec_prefix}/lib/systemd/user/obex.service \
117 ${datadir}/dbus-1/services/org.bluez.obex.service \
118 "
119SYSTEMD_SERVICE_${PN}-obex = "obex.service"
120
121FILES_${PN}-testtools = "${libdir}/bluez/test/*"
122
123def get_noinst_tools_paths (d, bb, tools):
124 s = list()
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500125 bindir = d.getVar("bindir")
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500126 for bdp in tools.split():
127 f = os.path.basename(bdp)
128 s.append("%s/%s" % (bindir, f))
129 return "\n".join(s)
130
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500131FILES_${PN}-noinst-tools = "${@get_noinst_tools_paths(d, bb, d.getVar('NOINST_TOOLS'))}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500132
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600133RDEPENDS_${PN}-testtools += "python3 python3-dbus python3-pygobject"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500134
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500135SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'bluetooth.service', '', d)}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500136INITSCRIPT_PACKAGES = "${PN}"
137INITSCRIPT_NAME_${PN} = "bluetooth"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500138
139EXCLUDE_FROM_WORLD = "1"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500140
141do_compile_ptest() {
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500142 oe_runmake buildtests
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500143}
144
145do_install_ptest() {
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500146 cp -r ${B}/unit/ ${D}${PTEST_PATH}
147 rm -f ${D}${PTEST_PATH}/unit/*.o
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500148}