diff options
author | Pacho Ramos <pacho@gentoo.org> | 2022-12-04 14:15:35 +0100 |
---|---|---|
committer | Pacho Ramos <pacho@gentoo.org> | 2022-12-04 15:49:17 +0100 |
commit | 590842a7dae0db6d1d945376c84003c7a2235d03 (patch) | |
tree | 396f7bef12c220fee2b704cefb8e3bb5ae98604f /net-wireless | |
parent | net-misc/r8168: drop 8.049.02-r1 (diff) | |
download | gentoo-590842a7dae0db6d1d945376c84003c7a2235d03.tar.gz gentoo-590842a7dae0db6d1d945376c84003c7a2235d03.tar.bz2 gentoo-590842a7dae0db6d1d945376c84003c7a2235d03.zip |
net-wireless/bluez: add 5.66
Signed-off-by: Pacho Ramos <pacho@gentoo.org>
Diffstat (limited to 'net-wireless')
-rw-r--r-- | net-wireless/bluez/Manifest | 1 | ||||
-rw-r--r-- | net-wireless/bluez/bluez-5.66.ebuild | 300 | ||||
-rw-r--r-- | net-wireless/bluez/files/bluez-5.66-power-state-adapter-property.patch | 28 | ||||
-rw-r--r-- | net-wireless/bluez/files/bluez-5.66-transient-hostname-fix.patch | 185 |
4 files changed, 514 insertions, 0 deletions
diff --git a/net-wireless/bluez/Manifest b/net-wireless/bluez/Manifest index 710de1c38b68..ff11cd002cac 100644 --- a/net-wireless/bluez/Manifest +++ b/net-wireless/bluez/Manifest @@ -1,3 +1,4 @@ DIST bluez-5.64.tar.xz 2175148 BLAKE2B 828c620330d1993d5c5c2a865f2d27a29425e3583aac01a1a782290a805ee0fd6456b6832c804ad323dd8714fa9329487b2616ed08f1f491ea29403ee05dba2d SHA512 f11f9974b29c5c6fce3890d7e42425c1cb02e42c1b8f49c5cc4b249234e67b64317d0e5e82721e2fbf1b53269c8569a9c869d59ce42b5e927f6622f0753e53cd DIST bluez-5.65.tar.xz 2208100 BLAKE2B 9d2937e2e14d8d8945183c6436921d9d16a6d3bcb5dbe3e2493554fbc4972bb4c006aabc793c9fb8eae47a7e9f29ae9fdf47551dfc0a238e86f5a76ce7436ae2 SHA512 c20c09a1a75053c77d73b3ce15ac7fd321eb6df5ca1646d57c6848b87c0c9957908bc17dd928da4ef2aacfc8667877cbc7511c1ba43db839bfa9bf1fb8269907 +DIST bluez-5.66.tar.xz 2257288 BLAKE2B af1911cf590461a874daa16bedb8a021a3b2c2af3254360c035d2180e0f355372651bd41da342c26e6d9631d726dd08e0d6a83a22069333b94b6fce6d546718c SHA512 ed0994932687eacf27207867366671b323671f5d5199daf36ea5eff8f254f2bc99ef989ef7df9883b35c06f2af60452be8bad0a06109428a4717cf2b247b4865 DIST power-state-adapter-property.patch 22488 BLAKE2B a46173c0ebe4f4822c67c2f8f2f3e67dab261753f64204f1a61665c3bba1d7a10e0f8511b38ce273d986490ffd262a737bee82694909683df7386b2015301607 SHA512 b039a578454681f291dc3b04079c8d0151b13a84b4b013e290aa3c28aba1538cef2d9e9aadfe88a0dbfb8e4cea1c251cb5043f4175fb32d53526f7b82de0451a diff --git a/net-wireless/bluez/bluez-5.66.ebuild b/net-wireless/bluez/bluez-5.66.ebuild new file mode 100644 index 000000000000..8a2a8ed1bcee --- /dev/null +++ b/net-wireless/bluez/bluez-5.66.ebuild @@ -0,0 +1,300 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +PYTHON_COMPAT=( python3_{8..11} ) + +inherit autotools linux-info python-single-r1 readme.gentoo-r1 systemd udev multilib-minimal + +DESCRIPTION="Bluetooth Tools and System Daemons for Linux" +HOMEPAGE="http://www.bluez.org" +SRC_URI="https://www.kernel.org/pub/linux/bluetooth/${P}.tar.xz" + +LICENSE="GPL-2+ LGPL-2.1+" +SLOT="0/3" +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~x86" +IUSE="btpclient cups doc debug deprecated extra-tools experimental +mesh midi +obex +readline selinux systemd test test-programs +udev" + +# Since this release all remaining extra-tools need readline support, but this could +# change in the future, hence, this REQUIRED_USE constraint could be dropped +# again in the future. +# btpclient needs mesh, bug #790587 +REQUIRED_USE=" + btpclient? ( mesh ) + extra-tools? ( deprecated readline ) + test? ( ${PYTHON_REQUIRED_USE} ) + test-programs? ( ${PYTHON_REQUIRED_USE} ) +" + +TEST_DEPS="${PYTHON_DEPS} + $(python_gen_cond_dep ' + >=dev-python/dbus-python-1[${PYTHON_USEDEP}] + dev-python/pygobject:3[${PYTHON_USEDEP}] + ') +" +BDEPEND=" + dev-python/docutils + virtual/pkgconfig + test? ( ${TEST_DEPS} ) +" +DEPEND=" + >=dev-libs/glib-2.28:2[${MULTILIB_USEDEP}] + btpclient? ( >=dev-libs/ell-0.39 ) + cups? ( net-print/cups:= ) + mesh? ( + >=dev-libs/ell-0.39 + >=dev-libs/json-c-0.13:= + sys-libs/readline:0= + ) + midi? ( media-libs/alsa-lib ) + obex? ( dev-libs/libical:= ) + readline? ( sys-libs/readline:0= ) + systemd? ( sys-apps/systemd ) + >=sys-apps/dbus-1.6:= + udev? ( >=virtual/udev-172 ) +" +RDEPEND="${DEPEND} + selinux? ( sec-policy/selinux-bluetooth ) + test-programs? ( ${TEST_DEPS} ) +" + +RESTRICT="!test? ( test )" + +PATCHES=( + # Try both udevadm paths to cover udev/systemd vs. eudev locations (#539844) + # http://www.spinics.net/lists/linux-bluetooth/msg58739.html + # https://bugs.gentoo.org/539844 + # https://github.com/bluez/bluez/issues/268 + "${FILESDIR}"/${PN}-udevadm-path-r1.patch + + # Fedora patches + # http://www.spinics.net/lists/linux-bluetooth/msg40136.html + "${FILESDIR}"/0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch + + # https://lore.kernel.org/linux-bluetooth/20220901110719.176944-1-hadess@hadess.net/T/#m9c08d004cd5422783ee1d93154f42303bba9169f + "${FILESDIR}"/${PN}-5.66-power-state-adapter-property.patch + + # Fixed in next release + "${FILESDIR}"/${P}-transient-hostname-fix.patch +) + +pkg_setup() { + # From http://www.linuxfromscratch.org/blfs/view/svn/general/bluez.html + # to prevent bugs like: + # https://bugzilla.kernel.org/show_bug.cgi?id=196621 + CONFIG_CHECK="~NET ~BT ~BT_RFCOMM ~BT_RFCOMM_TTY ~BT_BNEP ~BT_BNEP_MC_FILTER + ~BT_BNEP_PROTO_FILTER ~BT_HIDP ~CRYPTO_USER_API_HASH ~CRYPTO_USER_API_SKCIPHER ~RFKILL" + # https://bugzilla.kernel.org/show_bug.cgi?id=196621 + # https://bugzilla.kernel.org/show_bug.cgi?id=206815 + if use mesh || use test; then + CONFIG_CHECK="${CONFIG_CHECK} ~CRYPTO_USER + ~CRYPTO_USER_API ~CRYPTO_USER_API_AEAD ~CRYPTO_AES ~CRYPTO_CCM ~CRYPTO_AEAD ~CRYPTO_CMAC + ~CRYPTO_MD5 ~CRYPTO_SHA1 ~KEY_DH_OPERATIONS" + fi + linux-info_pkg_setup + + if use test || use test-programs; then + python-single-r1_pkg_setup + fi + + if ! use udev; then + ewarn + ewarn "You are installing ${PN} with USE=-udev. This means various bluetooth" + ewarn "devices and adapters from Apple, Dell, Logitech etc. will not work," + ewarn "and hid2hci will not be available." + ewarn + fi +} + +src_prepare() { + default + + # http://www.spinics.net/lists/linux-bluetooth/msg38490.html + if ! use systemd; then + eapply "${FILESDIR}"/0001-Allow-using-obexd-without-systemd-in-the-user-session-r2.patch + fi + + eautoreconf + + if use cups; then + # Only not .am to not need to run eautoreconf only because of this + sed -i \ + -e "s:cupsdir = \$(libdir)/cups:cupsdir = $(cups-config --serverbin):" \ + Makefile.{in,tools} || die + fi + + multilib_copy_sources +} + +multilib_src_configure() { + local myconf=( + # readline is automagic when client is enabled + # --enable-client always needs readline, bug #504038 + # --enable-mesh is handled in the same way + ac_cv_header_readline_readline_h=$(multilib_native_usex readline) + ac_cv_header_readline_readline_h=$(multilib_native_usex mesh) + ) + + if ! multilib_is_native_abi; then + myconf+=( + # deps not used for the library + {DBUS,GLIB}_{CFLAGS,LIBS}=' ' + ) + fi + + econf \ + --localstatedir=/var \ + --disable-android \ + --enable-datafiles \ + --enable-optimization \ + $(use_enable debug) \ + --enable-pie \ + --enable-threads \ + --enable-library \ + --enable-tools \ + --enable-manpages \ + --enable-monitor \ + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)" \ + --with-systemduserunitdir="$(systemd_get_userunitdir)" \ + $(multilib_native_use_enable btpclient) \ + $(multilib_native_use_enable btpclient external-ell) \ + $(multilib_native_use_enable cups) \ + $(multilib_native_use_enable deprecated) \ + $(multilib_native_use_enable experimental) \ + $(multilib_native_use_enable mesh) \ + $(multilib_native_use_enable mesh external-ell) \ + $(multilib_native_use_enable midi) \ + $(multilib_native_use_enable obex) \ + $(multilib_native_use_enable readline client) \ + $(multilib_native_use_enable systemd) \ + $(multilib_native_use_enable test-programs test) \ + $(multilib_native_use_enable udev) \ + $(multilib_native_use_enable udev hid2hci) \ + $(multilib_native_use_enable udev sixaxis) +} + +multilib_src_compile() { + if multilib_is_native_abi; then + default + else + emake -f Makefile -f - libs \ + <<<'libs: $(lib_LTLIBRARIES)' + fi +} + +multilib_src_test() { + multilib_is_native_abi && default +} + +multilib_src_install() { + if multilib_is_native_abi; then + emake DESTDIR="${D}" install + + # Only install extra-tools when relevant USE flag is enabled + if use extra-tools; then + ewarn "Upstream doesn't support using this tools and their bugs are" + ewarn "likely to be ignored forever, also they can break without" + ewarn "previous announcement." + ewarn "Upstream also states all this tools are not really needed," + ewarn "then, if you still need to rely on them, you must ask them" + ewarn "to either install that tool by default or add the needed" + ewarn "functionality to the existing 'official' tools." + ewarn "Please report this issues to:" + ewarn "http://www.bluez.org/development/lists/" + + # Upstream doesn't install this, bug #524640 + # http://permalink.gmane.org/gmane.linux.bluez.kernel/53115 + # http://comments.gmane.org/gmane.linux.bluez.kernel/54564 + dobin tools/btmgmt + # gatttool is only built with readline, bug #530776 + # https://bugzilla.redhat.com/show_bug.cgi?id=1141909 + # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=720486 + # https://bugs.archlinux.org/task/37686 + dobin attrib/gatttool + # https://bugzilla.redhat.com/show_bug.cgi?id=1699680 + dobin tools/avinfo + fi + + # Not installed by default after being built, bug #666756 + use btpclient && dobin tools/btpclient + + # Unittests are not that useful once installed, so make them optional + if use test-programs; then + # Drop python2 only test tools + # https://bugzilla.kernel.org/show_bug.cgi?id=206819 + rm "${ED}"/usr/$(get_libdir)/bluez/test/simple-player || die + # https://bugzilla.kernel.org/show_bug.cgi?id=206821 + rm "${ED}"/usr/$(get_libdir)/bluez/test/test-hfp || die + # https://bugzilla.kernel.org/show_bug.cgi?id=206823 + rm "${ED}"/usr/$(get_libdir)/bluez/test/test-sap-server || die + + python_fix_shebang "${ED}"/usr/$(get_libdir)/bluez/test + + for i in $(find "${ED}"/usr/$(get_libdir)/bluez/test -maxdepth 1 -type f ! -name "*.*"); do + dosym "${i}" /usr/bin/bluez-"${i##*/}" + done + fi + else + emake DESTDIR="${D}" \ + install-pkgincludeHEADERS \ + install-libLTLIBRARIES \ + install-pkgconfigDATA + fi +} + +multilib_src_install_all() { + # We need to ensure obexd can be spawned automatically by systemd + # when user-session is enabled: + # http://marc.info/?l=linux-bluetooth&m=148096094716386&w=2 + # https://bugs.gentoo.org/show_bug.cgi?id=577842 + # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=804908 + # https://bugs.archlinux.org/task/45816 + # https://bugzilla.redhat.com/show_bug.cgi?id=1318441 + # https://bugzilla.redhat.com/show_bug.cgi?id=1389347 + if use systemd; then + dosym obex.service /usr/lib/systemd/user/dbus-org.bluez.obex.service + fi + + find "${D}" -name '*.la' -type f -delete || die + + keepdir /var/lib/bluetooth + + # Upstream don't want people to play with them + # But we keep installing them due to 'historical' reasons + insinto /etc/bluetooth + local d + for d in input network; do + doins profiles/${d}/${d}.conf + done + # Setup auto enable as Fedora does for allowing to use + # keyboards/mouse as soon as possible + sed -i 's/#\[Policy\]$/\[Policy\]/; s/#AutoEnable=false/AutoEnable=true/' src/main.conf || die + doins src/main.conf + + newinitd "${FILESDIR}"/bluetooth-init.d-r5 bluetooth + newconfd "${FILESDIR}"/bluetooth-conf.d bluetooth + + einstalldocs + use doc && dodoc doc/*.txt + # Upstream dropped the example files + # Install .json files as examples to be used by meshctl + #if use mesh; then + #dodoc tools/mesh-gatt/*.json + # local DOC_CONTENTS="Some example .json files were installed into + # /usr/share/doc/${PF} to be used with meshctl. Feel free to + # uncompress and copy them to ~/.config/meshctl to use them." + # readme.gentoo_create_doc + #fi +} + +pkg_postinst() { + use udev && udev_reload + systemd_reenable bluetooth.service + + has_version net-dialup/ppp || elog "To use dial up networking you must install net-dialup/ppp" + #use mesh && readme.gentoo_print_elog +} + +pkg_postrm() { + use udev && udev_reload +} diff --git a/net-wireless/bluez/files/bluez-5.66-power-state-adapter-property.patch b/net-wireless/bluez/files/bluez-5.66-power-state-adapter-property.patch new file mode 100644 index 000000000000..566d7c08b591 --- /dev/null +++ b/net-wireless/bluez/files/bluez-5.66-power-state-adapter-property.patch @@ -0,0 +1,28 @@ +From 70309219acd4c81e3a9e2b3652d2d93eb08b0aee Mon Sep 17 00:00:00 2001 +From: Bastien Nocera <hadess@hadess.net> +Date: Wed, 31 Aug 2022 11:16:34 +0200 +Subject: [PATCH 6/6] adapter: Remove experimental flag for PowerState + +Now that the feature has been tested, that the API is deemed adequate +and the reliability sufficient. +--- + src/adapter.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/adapter.c b/src/adapter.c +index 8fb2acdc8..841096d7f 100644 +--- a/src/adapter.c ++++ b/src/adapter.c +@@ -3864,8 +3864,7 @@ static const GDBusPropertyTable adapter_properties[] = { + { "Alias", "s", property_get_alias, property_set_alias }, + { "Class", "u", property_get_class }, + { "Powered", "b", property_get_powered, property_set_powered }, +- { "PowerState", "s", property_get_power_state, NULL, NULL, +- G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, ++ { "PowerState", "s", property_get_power_state }, + { "Discoverable", "b", property_get_discoverable, + property_set_discoverable }, + { "DiscoverableTimeout", "u", property_get_discoverable_timeout, +-- +2.37.2 + diff --git a/net-wireless/bluez/files/bluez-5.66-transient-hostname-fix.patch b/net-wireless/bluez/files/bluez-5.66-transient-hostname-fix.patch new file mode 100644 index 000000000000..fef2776f7a0e --- /dev/null +++ b/net-wireless/bluez/files/bluez-5.66-transient-hostname-fix.patch @@ -0,0 +1,185 @@ +From e515f4b6e25c971c47ab79e9cbdfa17119bbde23 Mon Sep 17 00:00:00 2001 +From: Bastien Nocera <hadess@hadess.net> +Date: Wed, 9 Nov 2022 16:17:55 +0100 +Subject: [PATCH 1/2] hostname: Add '' around printed strings + +Otherwise we can't see whether the string is nul, or empty. +--- + plugins/hostname.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/plugins/hostname.c b/plugins/hostname.c +index 1a9513adb..14b6450b5 100644 +--- a/plugins/hostname.c ++++ b/plugins/hostname.c +@@ -128,7 +128,7 @@ static void property_changed(GDBusProxy *proxy, const char *name, + + dbus_message_iter_get_basic(iter, &str); + +- DBG("pretty hostname: %s", str); ++ DBG("pretty hostname: '%s'", str); + + g_free(pretty_hostname); + pretty_hostname = g_strdup(str); +@@ -146,7 +146,7 @@ static void property_changed(GDBusProxy *proxy, const char *name, + + dbus_message_iter_get_basic(iter, &str); + +- DBG("static hostname: %s", str); ++ DBG("static hostname: '%s'", str); + + g_free(static_hostname); + static_hostname = g_strdup(str); +@@ -165,7 +165,7 @@ static void property_changed(GDBusProxy *proxy, const char *name, + + dbus_message_iter_get_basic(iter, &str); + +- DBG("chassis: %s", str); ++ DBG("chassis: '%s'", str); + + for (i = 0; chassis_table[i].chassis; i++) { + if (strcmp(chassis_table[i].chassis, str)) +-- +2.37.3 + + +From e2b2b1675f310023862319ea10ffd205a75cc0cb Mon Sep 17 00:00:00 2001 +From: Bastien Nocera <hadess@hadess.net> +Date: Wed, 9 Nov 2022 16:17:56 +0100 +Subject: [PATCH 2/2] hostname: Fallback to transient hostname + +After pretty hostname, and static hostname, also support transient +hostname as a last resort before 'BlueZ X.XX'. + +This happens on Fedora's Workstation installation as it calls +"hostnamectl set-hostname" on startup. In Fedora Silverblue, the default +hostname is set as fedora in /etc/os-release. + +In both cases, we should fall back to that transient hostname, as bad as +it could be. + +Note that the transient hostname needs to be monitored through the +kernel directly, as explained in: +https://www.freedesktop.org/software/systemd/man/org.freedesktop.hostname1.html +--- + plugins/hostname.c | 57 ++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 55 insertions(+), 2 deletions(-) + +diff --git a/plugins/hostname.c b/plugins/hostname.c +index 14b6450b5..51707f07d 100644 +--- a/plugins/hostname.c ++++ b/plugins/hostname.c +@@ -16,6 +16,8 @@ + #include <stdint.h> + #include <stdlib.h> + #include <string.h> ++#include <fcntl.h> ++#include <sys/utsname.h> + + #include "lib/bluetooth.h" + #include "lib/sdp.h" +@@ -44,8 +46,10 @@ + static uint8_t major_class = MAJOR_CLASS_MISCELLANEOUS; + static uint8_t minor_class = MINOR_CLASS_UNCATEGORIZED; + +-static char *pretty_hostname = NULL; +-static char *static_hostname = NULL; ++static char *pretty_hostname = NULL; ++static char *static_hostname = NULL; ++static char *transient_hostname = NULL; ++static guint hostname_id = 0; + + /* + * Fallback to static hostname only if empty pretty hostname was already +@@ -60,6 +64,10 @@ static const char *get_hostname(void) + if (static_hostname && + g_str_equal(static_hostname, "") == FALSE) + return static_hostname; ++ ++ if (transient_hostname && ++ g_str_equal(transient_hostname, "") == FALSE) ++ return transient_hostname; + } + + return NULL; +@@ -181,6 +189,32 @@ static void property_changed(GDBusProxy *proxy, const char *name, + } + } + ++static void read_transient_hostname(void) ++{ ++ struct utsname u; ++ ++ if (uname(&u) != 0) { ++ g_free(transient_hostname); ++ transient_hostname = NULL; ++ DBG("failed to read transient hostname"); ++ return; ++ } ++ ++ g_free(transient_hostname); ++ transient_hostname = g_strdup(u.nodename); ++ ++ DBG("read transient hostname: '%s'", transient_hostname); ++} ++ ++static gboolean hostname_cb(GIOChannel *io, GIOCondition cond, ++ gpointer user_data) ++{ ++ DBG("transient hostname changed"); ++ read_transient_hostname(); ++ adapter_foreach(update_class, NULL); ++ return TRUE; ++} ++ + static int hostname_probe(struct btd_adapter *adapter) + { + DBG(""); +@@ -261,9 +295,11 @@ static GDBusProxy *hostname_proxy = NULL; + static int hostname_init(void) + { + DBusConnection *conn = btd_get_dbus_connection(); ++ int fd; + int err; + + read_dmi_fallback(); ++ read_transient_hostname(); + + hostname_client = g_dbus_client_new(conn, "org.freedesktop.hostname1", + "/org/freedesktop/hostname1"); +@@ -289,6 +325,17 @@ static int hostname_init(void) + hostname_client = NULL; + } + ++ fd = open("/proc/sys/kernel/hostname", O_RDONLY); ++ if (fd < 0) { ++ error("open(/proc/sys/kernel/hostname): %s (%d)", ++ strerror(errno), errno); ++ } else { ++ GIOChannel *io = g_io_channel_unix_new(fd); ++ ++ hostname_id = g_io_add_watch(io, G_IO_ERR, hostname_cb, NULL); ++ g_io_channel_unref(io); ++ } ++ + return err; + } + +@@ -306,8 +353,14 @@ static void hostname_exit(void) + hostname_client = NULL; + } + ++ if (hostname_id != 0) { ++ g_source_remove(hostname_id); ++ hostname_id = 0; ++ } ++ + g_free(pretty_hostname); + g_free(static_hostname); ++ g_free(transient_hostname); + } + + BLUETOOTH_PLUGIN_DEFINE(hostname, VERSION, BLUETOOTH_PLUGIN_PRIORITY_DEFAULT, +-- +2.37.3 + |