Gentoo Archives: gentoo-commits

From: Pacho Ramos <pacho@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-wireless/bluez/
Date: Sat, 27 Oct 2018 13:58:08
Message-Id: 1540648664.52ca93bd2211fa9de1adc45b0fbdd2d58214ec7d.pacho@gentoo
1 commit: 52ca93bd2211fa9de1adc45b0fbdd2d58214ec7d
2 Author: Pacho Ramos <pacho <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 27 13:57:44 2018 +0000
4 Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 27 13:57:44 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=52ca93bd
7
8 net-wireless/bluez: Fix btpclient handling/installation
9
10 Thanks-to: Chris Mayo
11 Closes: https://bugs.gentoo.org/666756
12 Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org>
13 Package-Manager: Portage-2.3.51, Repoman-2.3.11
14
15 net-wireless/bluez/bluez-5.50-r1.ebuild | 262 ++++++++++++++++++++++++++++++++
16 1 file changed, 262 insertions(+)
17
18 diff --git a/net-wireless/bluez/bluez-5.50-r1.ebuild b/net-wireless/bluez/bluez-5.50-r1.ebuild
19 new file mode 100644
20 index 00000000000..b43d92b9371
21 --- /dev/null
22 +++ b/net-wireless/bluez/bluez-5.50-r1.ebuild
23 @@ -0,0 +1,262 @@
24 +# Copyright 1999-2018 Gentoo Authors
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +EAPI=6
28 +PYTHON_COMPAT=( python2_7 )
29 +
30 +inherit autotools multilib python-single-r1 readme.gentoo-r1 systemd udev user multilib-minimal
31 +
32 +DESCRIPTION="Bluetooth Tools and System Daemons for Linux"
33 +HOMEPAGE="http://www.bluez.org"
34 +SRC_URI="mirror://kernel/linux/bluetooth/${P}.tar.xz"
35 +
36 +LICENSE="GPL-2+ LGPL-2.1+"
37 +SLOT="0/3"
38 +KEYWORDS="~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~x86"
39 +IUSE="alsa btpclient cups doc debug deprecated extra-tools experimental +mesh +obex +readline selinux systemd test test-programs +udev user-session"
40 +
41 +# Since this release all remaining extra-tools need readline support, but this could
42 +# change in the future, hence, this REQUIRED_USE constraint could be dropped
43 +# again in the future.
44 +REQUIRED_USE="
45 + extra-tools? ( deprecated readline )
46 + test? ( ${PYTHON_REQUIRED_USE} )
47 + test-programs? ( ${PYTHON_REQUIRED_USE} )
48 + user-session? ( systemd )
49 +"
50 +
51 +CDEPEND="
52 + >=dev-libs/glib-2.28:2[${MULTILIB_USEDEP}]
53 + >=sys-apps/dbus-1.6:=[user-session=]
54 + >=sys-apps/hwids-20121202.2
55 + alsa? ( media-libs/alsa-lib )
56 + btpclient? ( >=dev-libs/ell-0.3 )
57 + cups? ( net-print/cups:= )
58 + mesh? (
59 + >=dev-libs/ell-0.3
60 + dev-libs/json-c:=
61 + sys-libs/readline:0= )
62 + obex? ( dev-libs/libical:= )
63 + readline? ( sys-libs/readline:0= )
64 + systemd? ( sys-apps/systemd )
65 + udev? ( >=virtual/udev-172 )
66 +"
67 +TEST_DEPS="${PYTHON_DEPS}
68 + >=dev-python/dbus-python-1[${PYTHON_USEDEP}]
69 + dev-python/pygobject:3[${PYTHON_USEDEP}]
70 +"
71 +
72 +DEPEND="${CDEPEND}
73 + virtual/pkgconfig
74 + test? ( ${TEST_DEPS} )
75 +"
76 +RDEPEND="${CDEPEND}
77 + selinux? ( sec-policy/selinux-bluetooth )
78 + test-programs? ( ${TEST_DEPS} )
79 +"
80 +DOC_CONTENTS="
81 + If you want to control your bluetooth devices as a non-root user,
82 + please remember to add you to plugdev group.
83 +"
84 +
85 +PATCHES=(
86 + # Use static group "plugdev" to not force people to become root for
87 + # controlling the devices.
88 + "${FILESDIR}"/${PN}-plugdev.patch
89 +
90 + # Try both udevadm paths to cover udev/systemd vs. eudev locations (#539844)
91 + # http://www.spinics.net/lists/linux-bluetooth/msg58739.html
92 + "${FILESDIR}"/${PN}-udevadm-path.patch
93 +
94 + # build: Quote systemd variable names, bug #527432
95 + # http://article.gmane.org/gmane.linux.bluez.kernel/67230
96 + "${FILESDIR}"/${PN}-5.39-systemd-quote.patch
97 +
98 + # Fedora patches
99 + # http://www.spinics.net/lists/linux-bluetooth/msg40136.html
100 + "${FILESDIR}"/0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch
101 +
102 + # ???
103 + "${FILESDIR}"/0004-agent-Assert-possible-infinite-loop.patch
104 +)
105 +
106 +pkg_setup() {
107 + enewgroup plugdev
108 +
109 + if use test || use test-programs; then
110 + python-single-r1_pkg_setup
111 + fi
112 +
113 + if ! use udev; then
114 + ewarn
115 + ewarn "You are installing ${PN} with USE=-udev. This means various bluetooth"
116 + ewarn "devices and adapters from Apple, Dell, Logitech etc. will not work,"
117 + ewarn "and hid2hci will not be available."
118 + ewarn
119 + fi
120 +}
121 +
122 +src_prepare() {
123 + default
124 +
125 + # http://www.spinics.net/lists/linux-bluetooth/msg38490.html
126 + ! use user-session && eapply "${FILESDIR}"/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch
127 +
128 + if use cups; then
129 + sed -i \
130 + -e "s:cupsdir = \$(libdir)/cups:cupsdir = $(cups-config --serverbin):" \
131 + Makefile.{in,tools} || die
132 + fi
133 +
134 + # Broken test https://bugzilla.kernel.org/show_bug.cgi?id=196621
135 + sed -i -e '/unit_tests += unit\/test-gatt\b/d' Makefile.am || die
136 +
137 + eautoreconf
138 +
139 + multilib_copy_sources
140 +}
141 +
142 +multilib_src_configure() {
143 + local myconf=(
144 + # readline is automagic when client is enabled
145 + # --enable-client always needs readline, bug #504038
146 + # --enable-mesh is handled in the same way
147 + ac_cv_header_readline_readline_h=$(multilib_native_usex readline)
148 + ac_cv_header_readline_readline_h=$(multilib_native_usex mesh)
149 + )
150 +
151 + if ! multilib_is_native_abi; then
152 + myconf+=(
153 + # deps not used for the library
154 + {DBUS,GLIB}_{CFLAGS,LIBS}=' '
155 + )
156 + fi
157 +
158 + econf \
159 + --localstatedir=/var \
160 + --disable-android \
161 + --enable-datafiles \
162 + --enable-optimization \
163 + $(use_enable debug) \
164 + --enable-pie \
165 + --enable-threads \
166 + --enable-library \
167 + --enable-tools \
168 + --enable-manpages \
169 + --enable-monitor \
170 + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)" \
171 + --with-systemduserunitdir="$(systemd_get_userunitdir)" \
172 + $(multilib_native_use_enable alsa midi) \
173 + $(multilib_native_use_enable btpclient) \
174 + $(multilib_native_use_enable cups) \
175 + $(multilib_native_use_enable deprecated) \
176 + $(multilib_native_use_enable experimental) \
177 + $(multilib_native_use_enable mesh) \
178 + $(multilib_native_use_enable obex) \
179 + $(multilib_native_use_enable readline client) \
180 + $(multilib_native_use_enable systemd) \
181 + $(multilib_native_use_enable test-programs test) \
182 + $(multilib_native_use_enable udev) \
183 + $(multilib_native_use_enable udev sixaxis)
184 +}
185 +
186 +multilib_src_compile() {
187 + if multilib_is_native_abi; then
188 + default
189 + else
190 + emake -f Makefile -f - libs \
191 + <<<'libs: $(lib_LTLIBRARIES)'
192 + fi
193 +}
194 +
195 +multilib_src_test() {
196 + multilib_is_native_abi && default
197 +}
198 +
199 +multilib_src_install() {
200 + if multilib_is_native_abi; then
201 + emake DESTDIR="${D}" install
202 +
203 + # Only install extra-tools when relevant USE flag is enabled
204 + if use extra-tools; then
205 + ewarn "Upstream doesn't support using this tools and their bugs are"
206 + ewarn "likely to be ignored forever, also that tools can break"
207 + ewarn "without previous announcement."
208 + ewarn "Upstream also states all this tools are not really needed,"
209 + ewarn "then, if you still need to rely on them, you must ask them"
210 + ewarn "to either install that tool by default or add the needed"
211 + ewarn "functionality to the existing 'official' tools."
212 + ewarn "Please report this issues to:"
213 + ewarn "http://www.bluez.org/development/lists/"
214 +
215 + # Upstream doesn't install this, bug #524640
216 + # http://permalink.gmane.org/gmane.linux.bluez.kernel/53115
217 + # http://comments.gmane.org/gmane.linux.bluez.kernel/54564
218 + # gatttool is only built with readline, bug #530776
219 + dobin attrib/gatttool
220 + dobin tools/btmgmt
221 + fi
222 +
223 + # Not installed by default after being built, bug #666756
224 + use btpclient && dobin tools/btpclient
225 +
226 + # Unittests are not that useful once installed, so make them optional
227 + if use test-programs; then
228 + # example-gatt-client is the only one needing
229 + # python3, the others are python2 only. Remove
230 + # until we see how to pull in python2 and python3
231 + # for runtime
232 + rm "${ED}"/usr/$(get_libdir)/bluez/test/example-gatt-server || die
233 + rm "${ED}"/usr/$(get_libdir)/bluez/test/example-gatt-client || die
234 + python_fix_shebang "${ED}"/usr/$(get_libdir)/bluez/test
235 + for i in $(find "${ED}"/usr/$(get_libdir)/bluez/test -maxdepth 1 -type f ! -name "*.*"); do
236 + dosym "${i}" /usr/bin/bluez-"${i##*/}"
237 + done
238 + fi
239 + else
240 + emake DESTDIR="${D}" \
241 + install-includeHEADERS \
242 + install-libLTLIBRARIES \
243 + install-pkgconfigDATA
244 + fi
245 +}
246 +
247 +multilib_src_install_all() {
248 + # We need to ensure obexd can be spawned automatically by systemd
249 + # when user-session is enabled:
250 + # http://marc.info/?l=linux-bluetooth&m=148096094716386&w=2
251 + # https://bugs.gentoo.org/show_bug.cgi?id=577842
252 + # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=804908
253 + # https://bugs.archlinux.org/task/45816
254 + # https://bugzilla.redhat.com/show_bug.cgi?id=1318441
255 + # https://bugzilla.redhat.com/show_bug.cgi?id=1389347
256 + use user-session && ln -s "${ED}"/usr/lib/systemd/user/obex.service "${ED}"/usr/lib/systemd/user/dbus-org.bluez.obex.service
257 +
258 + find "${D}" -name '*.la' -delete || die
259 +
260 + keepdir /var/lib/bluetooth
261 +
262 + # Upstream don't want people to play with them
263 + # But we keep installing them due to 'historical' reasons
264 + insinto /etc/bluetooth
265 + local d
266 + for d in input network; do
267 + doins profiles/${d}/${d}.conf
268 + done
269 + doins src/main.conf
270 +
271 + newinitd "${FILESDIR}"/bluetooth-init.d-r4 bluetooth
272 +
273 + einstalldocs
274 + use doc && dodoc doc/*.txt
275 + ! use systemd && readme.gentoo_create_doc
276 +}
277 +
278 +pkg_postinst() {
279 + ! use systemd && readme.gentoo_print_elog
280 +
281 + use udev && udev_reload
282 + systemd_reenable bluetooth.service
283 +
284 + has_version net-dialup/ppp || elog "To use dial up networking you must install net-dialup/ppp."
285 +}