summaryrefslogtreecommitdiff
path: root/recipes-connectivity/bluez/bluez5_%.bbappend
blob: 530bd3ea589bda1e0196bc930076661d21bdcc9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# m3/m4 is at hash 1d6cfb8e625a944010956714c1802bc1e1fc6c4f
PR = "m4"

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

# enable-debug appears to be critical to prevent hangs.
EXTRA_OECONF += "--enable-deprecated --enable-experimental --enable-debug"

RDEPENDS_${PN}-pand += "bash python3-dbus python3-logging python3-syslog"
RDEPENDS_${PN}-rfcomm += "bash python3-pygobject python3-syslog python3-logging python3-dbus python3-pybluez python3-mmap" 
RDEPENDS_bluez5 += "bash"

SRC_URI += "\
    file://init \
    file://default \
    file://main.conf \
    file://bt-pan/init \
    file://bt-pan/default \
    file://bt-pan/bt-pan \
    file://rfcomm/rfcomm.py \
    file://rfcomm/init \
    file://rfcomm/default \
    file://BT-Name \
"

#    This patch is found in master. If the source does not have it, we must
#    include it.
#    file://bluez-device-Fix-not-removing-connected-device.patch
PACKAGES =+ "${PN}-mlinit ${PN}-bt-name libasound-module-bluez ${PN}-pand ${PN}-rfcomm"

DBTEXEC = "${D}${libexecdir}/bluetooth/"


do_install_append() {
    echo "sysconfdir is ${D}${sysconfdir}"
    install -m 0755 ${WORKDIR}/bt-pan/init ${D}${INIT_D_DIR}/bt-pan
    install -m 0755 ${WORKDIR}/rfcomm/init ${D}${INIT_D_DIR}/rfcomm
    install -d ${DBTEXEC}
    install -m 0755 ${WORKDIR}/bt-pan/bt-pan ${DBTEXEC}
    install -m 0755 ${WORKDIR}/rfcomm/rfcomm.py ${DBTEXEC}/rfcomm
    install -d ${D}${sysconfdir}/default

    install -m 0644 ${WORKDIR}/default ${D}${sysconfdir}/default/bluetooth
    install -m 0644 ${WORKDIR}/bt-pan/default ${D}${sysconfdir}/default/bt-pan
    install -m 0644 ${WORKDIR}/rfcomm/default ${D}${sysconfdir}/default/rfcomm
    install -m 0644 ${WORKDIR}/main.conf ${D}${sysconfdir}/bluetooth/

    install -d ${D}/usr/share/bluez5
    install -m 0444 ${WORKDIR}/BT-Name ${D}/usr/share/bluez5/BT-Name.patch

    if [ -f ${D}/${sysconfdir}/init.d/bluetooth ]; then
        sed -i -e 's#@LIBEXECDIR@#${libexecdir}#g' ${D}/${sysconfdir}/init.d/bluetooth
    fi

    install -d ${D}/usr/share/bluez5
    install -m 0444 ${WORKDIR}/BT-Name ${D}/usr/share/bluez5/BT-Name.patch
}

CONFFILES_${PN} += "${sysconfdir}/bluetooth/main.conf ${sysconfdir}/bluetooth/input.conf ${sysconfdir}/bluetooth/network.conf"

FILES_${PN}-pand = "${libexecdir}/bluetooth/bt-pan ${sysconfdir}/default/bt-pan ${sysconfdir}/init.d/bt-pan"
FILES_${PN}-rfcomm =  "${libexecdir}/bluetooth/rfcomm ${sysconfdir}/default/rfcomm ${sysconfdir}/init.d/rfcomm"
FILES_${PN}-bt-name = "/usr/share/bluez5/*"
CONFFILES_${PN}-mlinit += "${sysconfdir}/default/bluetooth"
FILES_${PN}-mlinit = "${sysconfdir}/init.d/bluetooth ${sysconfdir}/default/bluetooth"

CONFFILES_${PN}-pand = "${sysconfdir}/default/bt-pan"
CONFFILES_${PN}-rfcomm = "${sysconfdir}/default/rfcomm"

INITSCRIPT_PACKAGES = "${PN}-mlinit ${PN}-pand ${PN}-rfcomm"

INITSCRIPT_NAME_${PN}-pand = "bt-pan"
INITSCRIPT_NAME_${PN}-rfcomm = "rfcomm"
INITSCRIPT_PARAMS_${PN} = "defaults 20 20"
INITSCRIPT_PARAMS_${PN}-pand = "defaults 22 22"
INITSCRIPT_PARAMS_${PN}-rfcomm = "defaults 22 22"

INITSCRIPT_NAME_${PN}-mlinit = "bluetooth"
pkg_postinst_${PN}-bt-name() {
	cd /$D
    if patch --dry-run -p1 < $D/usr/share/bluez5/BT-Name.patch ; then
        patch -p1 < $D/usr/share/bluez5/BT-Name.patch
    fi
}

pkg_prerm_${PN}-bt-name() {
	cd /$D
	patch -Rp1 < $D/usr/share/bluez5/BT-Name.patch
}