Gentoo Archives: gentoo-commits

From: Jory Pratt <anarchy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/musl:master commit in: net-wireless/bluez/files/, net-wireless/bluez/
Date: Tue, 01 Oct 2019 20:48:48
Message-Id: 1569962913.850d98a79324a62678343dcb30b8e63be6773056.anarchy@gentoo
1 commit: 850d98a79324a62678343dcb30b8e63be6773056
2 Author: Jory Pratt <anarchy <AT> gentoo <DOT> org>
3 AuthorDate: Tue Oct 1 20:48:33 2019 +0000
4 Commit: Jory Pratt <anarchy <AT> gentoo <DOT> org>
5 CommitDate: Tue Oct 1 20:48:33 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=850d98a7
7
8 net-wireless/bluez: Fix missing include of limits.h in 5.51
9
10 Package-Manager: Portage-2.3.76, Repoman-2.3.17
11 Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org>
12
13 net-wireless/bluez/Manifest | 1 +
14 net-wireless/bluez/bluez-5.51.ebuild | 288 +++++++++++++++++++++
15 ...xd-without-systemd-in-the-user-session-r1.patch | 58 +++++
16 .../files/0001-Include-limits.h-for-PATH_MAX.patch | 64 +++++
17 ...-GLib-helper-function-to-manipulate-paths.patch | 38 +++
18 net-wireless/bluez/files/69-btattach-bcm.rules | 33 +++
19 net-wireless/bluez/files/bluetooth-init.d-r4 | 12 +
20 .../bluez/files/bluez-5.39-systemd-quote.patch | 38 +++
21 .../bluez/files/bluez-udevadm-path-r1.patch | 10 +
22 net-wireless/bluez/files/btattach-bcm-service.sh | 30 +++
23 net-wireless/bluez/files/btattach-bcm_at.service | 6 +
24 net-wireless/bluez/metadata.xml | 26 ++
25 12 files changed, 604 insertions(+)
26
27 diff --git a/net-wireless/bluez/Manifest b/net-wireless/bluez/Manifest
28 new file mode 100644
29 index 0000000..4f49136
30 --- /dev/null
31 +++ b/net-wireless/bluez/Manifest
32 @@ -0,0 +1 @@
33 +DIST bluez-5.51.tar.xz 1941904 BLAKE2B e8580388961c99305c6f723160e726232a097067815a88a056c1569c55c2ea410004cf92572afbef9b782807d8a940503b4501f9c6046cacac35136fbbe580a8 SHA512 8b14eea98f541b981162abce728e0f917654ad3c990721ec398fe41bdd68069fe55ff64b61bc3c3b9f813facf42c995b07619f6d5d153965de27154b1a7b578f
34
35 diff --git a/net-wireless/bluez/bluez-5.51.ebuild b/net-wireless/bluez/bluez-5.51.ebuild
36 new file mode 100644
37 index 0000000..cc086d7
38 --- /dev/null
39 +++ b/net-wireless/bluez/bluez-5.51.ebuild
40 @@ -0,0 +1,288 @@
41 +# Copyright 1999-2019 Gentoo Authors
42 +# Distributed under the terms of the GNU General Public License v2
43 +
44 +EAPI=7
45 +PYTHON_COMPAT=( python2_7 )
46 +
47 +inherit autotools python-single-r1 readme.gentoo-r1 systemd udev multilib-minimal
48 +
49 +DESCRIPTION="Bluetooth Tools and System Daemons for Linux"
50 +HOMEPAGE="http://www.bluez.org"
51 +SRC_URI="mirror://kernel/linux/bluetooth/${P}.tar.xz"
52 +
53 +LICENSE="GPL-2+ LGPL-2.1+"
54 +SLOT="0/3"
55 +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~x86"
56 +IUSE="btpclient cups doc debug deprecated extra-tools experimental +mesh midi +obex +readline selinux systemd test test-programs +udev user-session"
57 +
58 +# Since this release all remaining extra-tools need readline support, but this could
59 +# change in the future, hence, this REQUIRED_USE constraint could be dropped
60 +# again in the future.
61 +REQUIRED_USE="
62 + extra-tools? ( deprecated readline )
63 + test? ( ${PYTHON_REQUIRED_USE} )
64 + test-programs? ( ${PYTHON_REQUIRED_USE} )
65 +"
66 +
67 +TEST_DEPS="${PYTHON_DEPS}
68 + >=dev-python/dbus-python-1[${PYTHON_USEDEP}]
69 + dev-python/pygobject:3[${PYTHON_USEDEP}]
70 +"
71 +BDEPEND="
72 + virtual/pkgconfig
73 + test? ( ${TEST_DEPS} )
74 +"
75 +DEPEND="
76 + >=dev-libs/glib-2.28:2[${MULTILIB_USEDEP}]
77 + >=sys-apps/hwids-20121202.2
78 + btpclient? ( >=dev-libs/ell-0.14 )
79 + cups? ( net-print/cups:= )
80 + mesh? (
81 + >=dev-libs/ell-0.14
82 + dev-libs/json-c:=
83 + sys-libs/readline:0=
84 + )
85 + midi? ( media-libs/alsa-lib )
86 + obex? ( dev-libs/libical:= )
87 + readline? ( sys-libs/readline:0= )
88 + systemd? (
89 + >=sys-apps/dbus-1.6:=[user-session=]
90 + sys-apps/systemd
91 + )
92 + !systemd? ( >=sys-apps/dbus-1.6:= )
93 + udev? ( >=virtual/udev-172 )
94 +"
95 +RDEPEND="${DEPEND}
96 + selinux? ( sec-policy/selinux-bluetooth )
97 + test-programs? ( ${TEST_DEPS} )
98 +"
99 +
100 +RESTRICT="!test? ( test )"
101 +
102 +PATCHES=(
103 + # Try both udevadm paths to cover udev/systemd vs. eudev locations (#539844)
104 + # http://www.spinics.net/lists/linux-bluetooth/msg58739.html
105 + # https://bugs.gentoo.org/539844
106 + "${FILESDIR}"/${PN}-udevadm-path-r1.patch
107 +
108 + # build: Quote systemd variable names, bug #527432
109 + # http://article.gmane.org/gmane.linux.bluez.kernel/67230
110 + "${FILESDIR}"/${PN}-5.39-systemd-quote.patch
111 +
112 + # Fedora patches
113 + # http://www.spinics.net/lists/linux-bluetooth/msg40136.html
114 + "${FILESDIR}"/0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch
115 +
116 + # Fix missing includes for non glibc systems
117 + "${FILESDIR}"/0001-Include-limits.h-for-PATH_MAX.patch
118 +)
119 +
120 +pkg_setup() {
121 + if use test || use test-programs; then
122 + python-single-r1_pkg_setup
123 + fi
124 +
125 + if ! use udev; then
126 + ewarn
127 + ewarn "You are installing ${PN} with USE=-udev. This means various bluetooth"
128 + ewarn "devices and adapters from Apple, Dell, Logitech etc. will not work,"
129 + ewarn "and hid2hci will not be available."
130 + ewarn
131 + fi
132 +}
133 +
134 +src_prepare() {
135 + default
136 +
137 + # http://www.spinics.net/lists/linux-bluetooth/msg38490.html
138 + if ! use user-session || ! use systemd; then
139 + eapply "${FILESDIR}"/0001-Allow-using-obexd-without-systemd-in-the-user-session-r1.patch
140 + fi
141 +
142 + if use cups; then
143 + sed -i \
144 + -e "s:cupsdir = \$(libdir)/cups:cupsdir = $(cups-config --serverbin):" \
145 + Makefile.{in,tools} || die
146 + fi
147 +
148 + # Broken test https://bugzilla.kernel.org/show_bug.cgi?id=196621
149 + # https://bugs.gentoo.org/618548
150 + sed -i -e '/unit_tests += unit\/test-gatt\b/d' Makefile.am || die
151 +
152 + eautoreconf
153 +
154 + multilib_copy_sources
155 +}
156 +
157 +multilib_src_configure() {
158 + local myconf=(
159 + # readline is automagic when client is enabled
160 + # --enable-client always needs readline, bug #504038
161 + # --enable-mesh is handled in the same way
162 + ac_cv_header_readline_readline_h=$(multilib_native_usex readline)
163 + ac_cv_header_readline_readline_h=$(multilib_native_usex mesh)
164 + )
165 +
166 + if ! multilib_is_native_abi; then
167 + myconf+=(
168 + # deps not used for the library
169 + {DBUS,GLIB}_{CFLAGS,LIBS}=' '
170 + )
171 + fi
172 +
173 + econf \
174 + --localstatedir=/var \
175 + --disable-android \
176 + --enable-datafiles \
177 + --enable-optimization \
178 + $(use_enable debug) \
179 + --enable-pie \
180 + --enable-threads \
181 + --enable-library \
182 + --enable-tools \
183 + --enable-manpages \
184 + --enable-monitor \
185 + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)" \
186 + --with-systemduserunitdir="$(systemd_get_userunitdir)" \
187 + $(multilib_native_use_enable btpclient) \
188 + $(multilib_native_use_enable btpclient external-ell) \
189 + $(multilib_native_use_enable cups) \
190 + $(multilib_native_use_enable deprecated) \
191 + $(multilib_native_use_enable experimental) \
192 + $(multilib_native_use_enable mesh) \
193 + $(multilib_native_use_enable mesh external-ell) \
194 + $(multilib_native_use_enable midi) \
195 + $(multilib_native_use_enable obex) \
196 + $(multilib_native_use_enable readline client) \
197 + $(multilib_native_use_enable systemd) \
198 + $(multilib_native_use_enable test-programs test) \
199 + $(multilib_native_use_enable udev) \
200 + $(multilib_native_use_enable udev sixaxis)
201 +}
202 +
203 +multilib_src_compile() {
204 + if multilib_is_native_abi; then
205 + default
206 + else
207 + emake -f Makefile -f - libs \
208 + <<<'libs: $(lib_LTLIBRARIES)'
209 + fi
210 +}
211 +
212 +multilib_src_test() {
213 + multilib_is_native_abi && default
214 +}
215 +
216 +multilib_src_install() {
217 + if multilib_is_native_abi; then
218 + emake DESTDIR="${D}" install
219 +
220 + # Only install extra-tools when relevant USE flag is enabled
221 + if use extra-tools; then
222 + ewarn "Upstream doesn't support using this tools and their bugs are"
223 + ewarn "likely to be ignored forever, also that tools can break"
224 + ewarn "without previous announcement."
225 + ewarn "Upstream also states all this tools are not really needed,"
226 + ewarn "then, if you still need to rely on them, you must ask them"
227 + ewarn "to either install that tool by default or add the needed"
228 + ewarn "functionality to the existing 'official' tools."
229 + ewarn "Please report this issues to:"
230 + ewarn "http://www.bluez.org/development/lists/"
231 +
232 + # Upstream doesn't install this, bug #524640
233 + # http://permalink.gmane.org/gmane.linux.bluez.kernel/53115
234 + # http://comments.gmane.org/gmane.linux.bluez.kernel/54564
235 + dobin tools/btmgmt
236 + # gatttool is only built with readline, bug #530776
237 + # https://bugzilla.redhat.com/show_bug.cgi?id=1141909
238 + # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=720486
239 + # https://bugs.archlinux.org/task/37686
240 + dobin attrib/gatttool
241 + # https://bugzilla.redhat.com/show_bug.cgi?id=1699680
242 + dobin tools/avinfo
243 + fi
244 +
245 + # Not installed by default after being built, bug #666756
246 + use btpclient && dobin tools/btpclient
247 +
248 + # Unittests are not that useful once installed, so make them optional
249 + if use test-programs; then
250 + # Few are needing python3, the others are python2 only. Remove
251 + # until we see how to pull in python2 and python3 for runtime
252 + rm "${ED}"/usr/$(get_libdir)/bluez/test/example-gatt-server || die
253 + rm "${ED}"/usr/$(get_libdir)/bluez/test/example-gatt-client || die
254 + rm "${ED}"/usr/$(get_libdir)/bluez/test/agent.py || die
255 + rm "${ED}"/usr/$(get_libdir)/bluez/test/test-mesh || die
256 +
257 + python_fix_shebang "${ED}"/usr/$(get_libdir)/bluez/test
258 +
259 + for i in $(find "${ED}"/usr/$(get_libdir)/bluez/test -maxdepth 1 -type f ! -name "*.*"); do
260 + dosym "${i}" /usr/bin/bluez-"${i##*/}"
261 + done
262 + fi
263 + else
264 + emake DESTDIR="${D}" \
265 + install-pkgincludeHEADERS \
266 + install-libLTLIBRARIES \
267 + install-pkgconfigDATA
268 + fi
269 +}
270 +
271 +multilib_src_install_all() {
272 + # We need to ensure obexd can be spawned automatically by systemd
273 + # when user-session is enabled:
274 + # http://marc.info/?l=linux-bluetooth&m=148096094716386&w=2
275 + # https://bugs.gentoo.org/show_bug.cgi?id=577842
276 + # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=804908
277 + # https://bugs.archlinux.org/task/45816
278 + # https://bugzilla.redhat.com/show_bug.cgi?id=1318441
279 + # https://bugzilla.redhat.com/show_bug.cgi?id=1389347
280 + if use user-session && use systemd; then
281 + ln -s "${ED}"/usr/lib/systemd/user/obex.service "${ED}"/usr/lib/systemd/user/dbus-org.bluez.obex.service
282 + fi
283 +
284 + find "${D}" -name '*.la' -type f -delete || die
285 +
286 + keepdir /var/lib/bluetooth
287 +
288 + # Upstream don't want people to play with them
289 + # But we keep installing them due to 'historical' reasons
290 + insinto /etc/bluetooth
291 + local d
292 + for d in input network; do
293 + doins profiles/${d}/${d}.conf
294 + done
295 + # Setup auto enable as Fedora does for allowing to use
296 + # keyboards/mouse as soon as possible
297 + sed -i 's/#\[Policy\]$/\[Policy\]/; s/#AutoEnable=false/AutoEnable=true/' src/main.conf || die
298 + doins src/main.conf
299 +
300 + newinitd "${FILESDIR}"/bluetooth-init.d-r4 bluetooth
301 +
302 + einstalldocs
303 + use doc && dodoc doc/*.txt
304 + # Install .json files as examples to be used by meshctl
305 + if use mesh; then
306 + dodoc tools/mesh/*.json
307 + local DOC_CONTENTS="Some example .json files were installed into
308 + /usr/share/doc/${PF} to be used with meshctl. Feel free to
309 + uncompress and copy them to ~/.config/meshctl to use them."
310 + readme.gentoo_create_doc
311 + fi
312 +
313 + # From Fedora:
314 + # Scripts for automatically btattach-ing serial ports connected to Broadcom HCIs
315 + # as found on some Atom based x86 hardware
316 + udev_dorules "${FILESDIR}/69-btattach-bcm.rules"
317 + systemd_newunit "${FILESDIR}/btattach-bcm_at.service" "btattach-bcm@.service"
318 + exeinto /usr/libexec/bluetooth
319 + doexe "${FILESDIR}/btattach-bcm-service.sh"
320 +}
321 +
322 +pkg_postinst() {
323 + use udev && udev_reload
324 + systemd_reenable bluetooth.service
325 +
326 + has_version net-dialup/ppp || elog "To use dial up networking you must install net-dialup/ppp"
327 + use mesh && readme.gentoo_print_elog
328 +}
329
330 diff --git a/net-wireless/bluez/files/0001-Allow-using-obexd-without-systemd-in-the-user-session-r1.patch b/net-wireless/bluez/files/0001-Allow-using-obexd-without-systemd-in-the-user-session-r1.patch
331 new file mode 100644
332 index 0000000..dec9307
333 --- /dev/null
334 +++ b/net-wireless/bluez/files/0001-Allow-using-obexd-without-systemd-in-the-user-session-r1.patch
335 @@ -0,0 +1,58 @@
336 +From 3027cb7141fb65cf3eeda69c688db8c4045e2d3f Mon Sep 17 00:00:00 2001
337 +From: Giovanni Campagna <gcampagna-cNUdlRotFMnNLxjTenLetw@××××××××××××.org>
338 +Date: Sat, 12 Oct 2013 17:45:25 +0200
339 +Subject: [PATCH] Allow using obexd without systemd in the user session
340 +
341 +Not all sessions run systemd --user (actually, the majority
342 +doesn't), so the dbus daemon must be able to spawn obexd
343 +directly, and to do so it needs the full path of the daemon.
344 +---
345 + Makefile.obexd | 4 ++--
346 + obexd/src/org.bluez.obex.service | 4 ----
347 + obexd/src/org.bluez.obex.service.in | 4 ++++
348 + 3 files changed, 6 insertions(+), 6 deletions(-)
349 + delete mode 100644 obexd/src/org.bluez.obex.service
350 + create mode 100644 obexd/src/org.bluez.obex.service.in
351 +
352 +diff --git a/Makefile.obexd b/Makefile.obexd
353 +index 3760867..142e7c3 100644
354 +--- a/Makefile.obexd
355 ++++ b/Makefile.obexd
356 +@@ -2,12 +2,12 @@
357 + if SYSTEMD
358 + systemduserunitdir = $(SYSTEMD_USERUNITDIR)
359 + systemduserunit_DATA = obexd/src/obex.service
360 ++endif
361 +
362 + dbussessionbusdir = $(DBUS_SESSIONBUSDIR)
363 + dbussessionbus_DATA = obexd/src/org.bluez.obex.service
364 +-endif
365 +
366 +-EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service
367 ++EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service.in
368 +
369 + obex_plugindir = $(libdir)/obex/plugins
370 +
371 +diff --git a/obexd/src/org.bluez.obex.service b/obexd/src/org.bluez.obex.service
372 +deleted file mode 100644
373 +index a538088..0000000
374 +--- a/obexd/src/org.bluez.obex.service
375 ++++ /dev/null
376 +@@ -1,4 +0,0 @@
377 +-[D-BUS Service]
378 +-Name=org.bluez.obex
379 +-Exec=/bin/false
380 +-SystemdService=dbus-org.bluez.obex.service
381 +diff --git a/obexd/src/org.bluez.obex.service.in b/obexd/src/org.bluez.obex.service.in
382 +new file mode 100644
383 +index 0000000..9c815f2
384 +--- /dev/null
385 ++++ b/obexd/src/org.bluez.obex.service.in
386 +@@ -0,0 +1,4 @@
387 ++[D-BUS Service]
388 ++Name=org.bluez.obex
389 ++Exec=@libexecdir@/obexd
390 ++SystemdService=dbus-org.bluez.obex.service
391 +--
392 +1.8.3.1
393 +
394
395 diff --git a/net-wireless/bluez/files/0001-Include-limits.h-for-PATH_MAX.patch b/net-wireless/bluez/files/0001-Include-limits.h-for-PATH_MAX.patch
396 new file mode 100644
397 index 0000000..ccbc152
398 --- /dev/null
399 +++ b/net-wireless/bluez/files/0001-Include-limits.h-for-PATH_MAX.patch
400 @@ -0,0 +1,64 @@
401 +From 20128c5c95fbae93c9fd996d5ad2584cf6ad8032 Mon Sep 17 00:00:00 2001
402 +From: Jory Pratt <anarchy@g.o>
403 +Date: Mon, 30 Sep 2019 18:35:56 -0500
404 +Subject: [PATCH] Include limits.h for PATH_MAX
405 +
406 +Signed-off-by: Jory Pratt <anarchy@g.o>
407 +---
408 + mesh/keyring.c | 1 +
409 + mesh/mesh-config-json.c | 1 +
410 + mesh/node.c | 1 +
411 + mesh/util.c | 1 +
412 + 4 files changed, 4 insertions(+)
413 +
414 +diff --git a/mesh/keyring.c b/mesh/keyring.c
415 +index 3a7f92f..9fa7d6b 100644
416 +--- a/mesh/keyring.c
417 ++++ b/mesh/keyring.c
418 +@@ -24,6 +24,7 @@
419 + #define _GNU_SOURCE
420 + #include <fcntl.h>
421 + #include <dirent.h>
422 ++#include <limits.h>
423 + #include <stdio.h>
424 + #include <unistd.h>
425 + #include <dirent.h>
426 +diff --git a/mesh/mesh-config-json.c b/mesh/mesh-config-json.c
427 +index cafa2fd..74ca495 100644
428 +--- a/mesh/mesh-config-json.c
429 ++++ b/mesh/mesh-config-json.c
430 +@@ -27,6 +27,7 @@
431 + #include <fcntl.h>
432 + #include <ftw.h>
433 + #include <libgen.h>
434 ++#include <limits.h>
435 + #include <stdio.h>
436 + #include <string.h>
437 + #include <unistd.h>
438 +diff --git a/mesh/node.c b/mesh/node.c
439 +index b6824f5..15dcb97 100644
440 +--- a/mesh/node.c
441 ++++ b/mesh/node.c
442 +@@ -23,6 +23,7 @@
443 +
444 + #define _GNU_SOURCE
445 + #include <dirent.h>
446 ++#include <limits.h>
447 + #include <stdio.h>
448 + #include <sys/time.h>
449 +
450 +diff --git a/mesh/util.c b/mesh/util.c
451 +index 1455bde..986ba4b 100644
452 +--- a/mesh/util.c
453 ++++ b/mesh/util.c
454 +@@ -25,6 +25,7 @@
455 + #include <dirent.h>
456 + #include <ftw.h>
457 + #include <stdio.h>
458 ++#include <limits.h>
459 + #include <time.h>
460 + #include <sys/time.h>
461 +
462 +--
463 +2.23.0
464 +
465
466 diff --git a/net-wireless/bluez/files/0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch b/net-wireless/bluez/files/0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch
467 new file mode 100644
468 index 0000000..004a389
469 --- /dev/null
470 +++ b/net-wireless/bluez/files/0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch
471 @@ -0,0 +1,38 @@
472 +From f7861d27fbcbc519f57d8496aa9486f487908821 Mon Sep 17 00:00:00 2001
473 +From: Bastien Nocera <hadess@××××××.net>
474 +Date: Sat, 9 Nov 2013 18:13:43 +0100
475 +Subject: [PATCH 1/5] obex: Use GLib helper function to manipulate paths
476 +
477 +Instead of trying to do it by hand. This also makes sure that
478 +relative paths aren't used by the agent.
479 +---
480 + obexd/src/manager.c | 10 +++++-----
481 + 1 file changed, 5 insertions(+), 5 deletions(-)
482 +
483 +diff --git a/obexd/src/manager.c b/obexd/src/manager.c
484 +index cec8a39..f18896e 100644
485 +--- a/obexd/src/manager.c
486 ++++ b/obexd/src/manager.c
487 +@@ -651,14 +651,14 @@ static void agent_reply(DBusPendingCall *call, void *user_data)
488 + DBUS_TYPE_STRING, &name,
489 + DBUS_TYPE_INVALID)) {
490 + /* Splits folder and name */
491 +- const char *slash = strrchr(name, '/');
492 ++ gboolean is_relative = !g_path_is_absolute(name);
493 + DBG("Agent replied with %s", name);
494 +- if (!slash) {
495 +- agent->new_name = g_strdup(name);
496 ++ if (is_relative) {
497 ++ agent->new_name = g_path_get_basename(name);
498 + agent->new_folder = NULL;
499 + } else {
500 +- agent->new_name = g_strdup(slash + 1);
501 +- agent->new_folder = g_strndup(name, slash - name);
502 ++ agent->new_name = g_path_get_basename(name);
503 ++ agent->new_folder = g_path_get_dirname(name);
504 + }
505 + }
506 +
507 +--
508 +1.8.4.2
509 +
510
511 diff --git a/net-wireless/bluez/files/69-btattach-bcm.rules b/net-wireless/bluez/files/69-btattach-bcm.rules
512 new file mode 100644
513 index 0000000..dfe8d1e
514 --- /dev/null
515 +++ b/net-wireless/bluez/files/69-btattach-bcm.rules
516 @@ -0,0 +1,33 @@
517 +# Some devices have a bluetooth HCI connected to an uart, these needs to be
518 +# setup by calling btattach. The systemd btattach-bcm.service takes care of
519 +# this. These udev rules hardware-activate that service when necessary.
520 +#
521 +# For now this only suports ACPI enumerated Broadcom BT HCIs.
522 +# This has been tested on Bay and Cherry Trail devices with both ACPI and
523 +# PCI enumerated UARTs.
524 +
525 +# Note we check for the platform device not for the acpi device, because
526 +# some DSDTs list multiple bluetooth adapters, but only some (or none)
527 +# are enabled. Only enabled adapters get a platform device created.
528 +ACTION!="add", GOTO="btattach_bcm_rules_end"
529 +SUBSYSTEM!="platform", GOTO="btattach_bcm_rules_end"
530 +
531 +KERNEL=="BCM2E1A:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
532 +KERNEL=="BCM2E39:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
533 +KERNEL=="BCM2E3A:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
534 +KERNEL=="BCM2E3D:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
535 +KERNEL=="BCM2E3F:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
536 +KERNEL=="BCM2E40:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
537 +KERNEL=="BCM2E54:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
538 +KERNEL=="BCM2E55:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
539 +KERNEL=="BCM2E64:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
540 +KERNEL=="BCM2E65:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
541 +KERNEL=="BCM2E67:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
542 +KERNEL=="BCM2E71:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
543 +KERNEL=="BCM2E7B:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
544 +KERNEL=="BCM2E7C:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
545 +KERNEL=="BCM2E7E:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
546 +KERNEL=="BCM2E95:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
547 +KERNEL=="BCM2E96:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service"
548 +
549 +LABEL="btattach_bcm_rules_end"
550
551 diff --git a/net-wireless/bluez/files/bluetooth-init.d-r4 b/net-wireless/bluez/files/bluetooth-init.d-r4
552 new file mode 100644
553 index 0000000..e69c668
554 --- /dev/null
555 +++ b/net-wireless/bluez/files/bluetooth-init.d-r4
556 @@ -0,0 +1,12 @@
557 +#!/sbin/openrc-run
558 +# Copyright 1999-2019 Gentoo Authors
559 +# Distributed under the terms of the GNU General Public License v2
560 +
561 +pidfile="/run/bluetoothd.pid"
562 +command="/usr/libexec/bluetooth/bluetoothd"
563 +command_background=1
564 +
565 +depend() {
566 + after coldplug
567 + need dbus localmount hostname
568 +}
569
570 diff --git a/net-wireless/bluez/files/bluez-5.39-systemd-quote.patch b/net-wireless/bluez/files/bluez-5.39-systemd-quote.patch
571 new file mode 100644
572 index 0000000..d23c877
573 --- /dev/null
574 +++ b/net-wireless/bluez/files/bluez-5.39-systemd-quote.patch
575 @@ -0,0 +1,38 @@
576 +From f554e152715a3c06a69954d9d4f15415c798e083 Mon Sep 17 00:00:00 2001
577 +From: Mike Gilbert <floppym@g.o>
578 +Date: Sun, 3 Apr 2016 14:30:02 -0400
579 +Subject: [PATCH] build: Quote systemd variable names
580 +
581 +If the systemd-m4 package has been installed, SYSTEMD_USERUNITDIR is
582 +defined as a macro. Quote this name to prevent macro expansion.
583 +
584 +Bug: https://bugs.gentoo.org/527432
585 +---
586 + configure.ac | 4 ++--
587 + 1 file changed, 2 insertions(+), 2 deletions(-)
588 +
589 +diff --git a/configure.ac b/configure.ac
590 +index 1679a47..4664003 100644
591 +--- a/configure.ac
592 ++++ b/configure.ac
593 +@@ -216,7 +216,7 @@ if (test "${enable_systemd}" != "no" && test -z "${path_systemunitdir}"); then
594 + fi
595 + AC_MSG_RESULT([${path_systemunitdir}])
596 + fi
597 +-AC_SUBST(SYSTEMD_SYSTEMUNITDIR, [${path_systemunitdir}])
598 ++AC_SUBST([SYSTEMD_SYSTEMUNITDIR], [${path_systemunitdir}])
599 +
600 + AC_ARG_WITH([systemduserunitdir],
601 + AC_HELP_STRING([--with-systemduserunitdir=DIR],
602 +@@ -230,7 +230,7 @@ if (test "${enable_systemd}" != "no" && test -z "${path_userunitdir}"); then
603 + fi
604 + AC_MSG_RESULT([${path_userunitdir}])
605 + fi
606 +-AC_SUBST(SYSTEMD_USERUNITDIR, [${path_userunitdir}])
607 ++AC_SUBST([SYSTEMD_USERUNITDIR], [${path_userunitdir}])
608 +
609 + AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
610 + [do not install configuration and data files]),
611 +--
612 +2.8.0
613 +
614
615 diff --git a/net-wireless/bluez/files/bluez-udevadm-path-r1.patch b/net-wireless/bluez/files/bluez-udevadm-path-r1.patch
616 new file mode 100644
617 index 0000000..ac1c94c
618 --- /dev/null
619 +++ b/net-wireless/bluez/files/bluez-udevadm-path-r1.patch
620 @@ -0,0 +1,10 @@
621 +--- a/tools/hid2hci.rules
622 ++++ b/tools/hid2hci.rules
623 +@@ -20,6 +20,7 @@
624 + # Unfortunately the only event seen is the BT device disappearing, so the mouse
625 + # device needs to be chased down on the USB bus.
626 + ATTR{bDeviceClass}=="e0", ATTR{bDeviceSubClass}=="01", ATTR{bDeviceProtocol}=="01", ATTR{idVendor}=="413c", \
627 ++ ENV{REMOVE_CMD}="/bin/udevadm trigger --action=change --subsystem-match=usb --property-match=HID2HCI_SWITCH=1" \
628 + ENV{REMOVE_CMD}="/sbin/udevadm trigger --action=change --subsystem-match=usb --property-match=HID2HCI_SWITCH=1"
629 +
630 + # CSR devices
631
632 diff --git a/net-wireless/bluez/files/btattach-bcm-service.sh b/net-wireless/bluez/files/btattach-bcm-service.sh
633 new file mode 100644
634 index 0000000..c7f8b17
635 --- /dev/null
636 +++ b/net-wireless/bluez/files/btattach-bcm-service.sh
637 @@ -0,0 +1,30 @@
638 +#!/bin/bash
639 +
640 +# Simple shell script to wait for the tty for an uart using BT HCI to show up
641 +# and then invoke btattach with the right parameters, this is intended to be
642 +# invoked from a hardware-activated systemd service
643 +#
644 +# For now this only suports ACPI enumerated Broadcom BT HCIs.
645 +# This has been tested on Bay and Cherry Trail devices with both ACPI and
646 +# PCI enumerated UARTs.
647 +#
648 +# Note the kernel bt developers are working on solving this entirely in the
649 +# kernel, so it is not worth the trouble to write something better then this.
650 +
651 +BT_DEV="/sys/bus/platform/devices/$1"
652 +BT_DEV="$(readlink -f $BT_DEV)"
653 +UART_DEV="$(dirname $BT_DEV)"
654 +
655 +# Stupid GPD-pocket has USB BT with id 0000:0000, but still claims to have
656 +# an uart attached bt
657 +if [ "$1" = "BCM2E7E:00" ] && lsusb | grep -q "ID 0000:0000"; then
658 + exit 0
659 +fi
660 +
661 +while [ ! -d "$UART_DEV/tty" ]; do
662 + sleep .2
663 +done
664 +
665 +TTY="$(ls $UART_DEV/tty)"
666 +
667 +exec btattach --bredr "/dev/$TTY" -P bcm
668
669 diff --git a/net-wireless/bluez/files/btattach-bcm_at.service b/net-wireless/bluez/files/btattach-bcm_at.service
670 new file mode 100644
671 index 0000000..1e7c7db
672 --- /dev/null
673 +++ b/net-wireless/bluez/files/btattach-bcm_at.service
674 @@ -0,0 +1,6 @@
675 +[Unit]
676 +Description=btattach for Broadcom devices
677 +
678 +[Service]
679 +Type=simple
680 +ExecStart=/usr/libexec/bluetooth/btattach-bcm-service.sh %I
681
682 diff --git a/net-wireless/bluez/metadata.xml b/net-wireless/bluez/metadata.xml
683 new file mode 100644
684 index 0000000..31e8695
685 --- /dev/null
686 +++ b/net-wireless/bluez/metadata.xml
687 @@ -0,0 +1,26 @@
688 +<?xml version="1.0" encoding="UTF-8"?>
689 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
690 +<pkgmetadata>
691 +<maintainer type="person">
692 + <email>pacho@g.o</email>
693 + <name>Pacho Ramos</name>
694 + </maintainer>
695 +<use>
696 + <flag name="btpclient">Enable BTP client</flag>
697 + <flag name="deprecated">Build deprecated plugins</flag>
698 + <flag name="experimental">Build experimental plugins</flag>
699 + <flag name="extra-tools">Install tools that upstream doesn't install on
700 + purpose by default. All this tools shouldn't be used. Then, please
701 + notify upstream about you still need them to let them know the
702 + situation.</flag>
703 + <flag name="mesh">Add support for Bluetooth Mesh control application and advertising bearer.</flag>
704 + <flag name="midi">Enable MIDI support</flag>
705 + <flag name="obex">Enable OBEX transfer support</flag>
706 + <flag name="test-programs">Install tools for testing of various Bluetooth functions</flag>
707 + <flag name="user-session">Allow compatibility with user-session semantics for session bus under systemd</flag>
708 +</use>
709 +<upstream>
710 + <remote-id type="cpe">cpe:/a:bluez:bluez</remote-id>
711 + <remote-id type="cpe">cpe:/a:bluez:bluez-libs</remote-id>
712 +</upstream>
713 +</pkgmetadata>