blob: eb42e62f4595ff326087c06d96639ce3b210a383 [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001DESCRIPTION = "Blueman is a GTK+ Bluetooth Manager"
2LICENSE = "GPL-3.0-only"
3LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
4
5DEPENDS = "gtk+3 glib-2.0 bluez5 python3-pygobject python3-cython-native"
6
Patrick Williams864cc432023-02-09 14:54:44 -06007inherit meson gettext systemd gsettings pkgconfig python3native gtk-icon-cache useradd
Andrew Geissler517393d2023-01-13 08:55:19 -06008
9SRC_URI = " \
10 git://github.com/blueman-project/blueman.git;protocol=https;branch=2-3-stable \
11 file://0001-Search-for-cython3.patch \
12 file://0002-fix-fail-to-enable-bluetooth.patch \
13 file://0001-meson-add-pythoninstalldir-option.patch \
14"
15S = "${WORKDIR}/git"
16SRCREV = "c85e7afb8d6547d4c35b7b639124de8e999c3650"
17
18EXTRA_OEMESON = "-Druntime_deps_check=false -Dpythoninstalldir=${@noprefix('PYTHON_SITEPACKAGES_DIR', d)}"
19
20SYSTEMD_SERVICE:${PN} = "${BPN}-mechanism.service"
21SYSTEMD_AUTO_ENABLE:${PN} = "disable"
22
23RRECOMMENDS:${PN} += "adwaita-icon-theme"
24RDEPENDS:${PN} += " \
25 python3-core \
Patrick Williams864cc432023-02-09 14:54:44 -060026 python3-ctypes \
Andrew Geissler517393d2023-01-13 08:55:19 -060027 python3-dbus \
28 python3-pygobject \
29 python3-terminal \
30 python3-fcntl \
31 packagegroup-tools-bluetooth \
32"
33
34PACKAGECONFIG ??= " \
35 ${@bb.utils.filter('DISTRO_FEATURES', 'polkit pulseaudio ', d)} \
36 thunar \
37"
38PACKAGECONFIG[thunar] = "-Dthunar-sendto=true,-Dthunar-sendto=false"
39PACKAGECONFIG[pulseaudio] = "-Dpulseaudio=true,-Dpulseaudio=false"
40PACKAGECONFIG[polkit] = "-Dpolicykit=true,-Dpolicykit=false"
41
42FILES:${PN} += " \
43 ${datadir} \
44 ${systemd_user_unitdir} \
45 ${PYTHON_SITEPACKAGES_DIR} \
46"
47
48# In code, path to python is a variable that is replaced with path to native version of it
49# during the configure stage, e.g ../recipe-sysroot-native/usr/bin/python3-native/python3.
50# Replace it with #!/usr/bin/env python3
51do_install:append() {
52 sed -i "1s/.*/#!\/usr\/bin\/env python3/" ${D}${prefix}/libexec/blueman-rfcomm-watcher \
53 ${D}${prefix}/libexec/blueman-mechanism \
54 ${D}${bindir}/blueman-adapters \
55 ${D}${bindir}/blueman-applet \
56 ${D}${bindir}/blueman-manager \
57 ${D}${bindir}/blueman-sendto \
58 ${D}${bindir}/blueman-services \
59 ${D}${bindir}/blueman-tray
60}
61
Patrick Williams864cc432023-02-09 14:54:44 -060062do_install:append() {
63 install -d ${D}${datadir}/polkit-1/rules.d
64 cat >${D}${datadir}/polkit-1/rules.d/51-blueman.rules <<EOF
65/* Allow users in wheel group to use blueman feature requiring root without authentication */
66polkit.addRule(function(action, subject) {
67 if ((action.id == "org.blueman.network.setup" ||
68 action.id == "org.blueman.dhcp.client" ||
69 action.id == "org.blueman.rfkill.setstate" ||
70 action.id == "org.blueman.pppd.pppconnect") &&
71 subject.isInGroup("wheel")) {
72
73 return polkit.Result.YES;
74 }
75});
76EOF
77}
78
79USERADD_PACKAGES = "${PN}"
80USERADD_PARAM:${PN} = "--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 --shell /bin/nologin polkitd"
81
82do_install:append() {
83 # Fix up permissions on polkit rules.d to work with rpm4 constraints
84 chmod 700 ${D}/${datadir}/polkit-1/rules.d
85 chown polkitd:root ${D}/${datadir}/polkit-1/rules.d
86}