1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python{2_7,3_3,3_4} )
8 inherit autotools eutils multilib python-any-r1 readme.gentoo systemd udev user multilib-minimal
10 DESCRIPTION="Bluetooth Tools and System Daemons for Linux"
11 HOMEPAGE="http://www.bluez.org"
12 SRC_URI="mirror://kernel/linux/bluetooth/${P}.tar.xz"
14 LICENSE="GPL-2+ LGPL-2.1+"
16 KEYWORDS="~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~x86"
17 IUSE="cups debug +obex +readline selinux systemd test +udev"
20 >=dev-libs/glib-2.28:2
22 >=sys-apps/hwids-20121202.2
23 cups? ( net-print/cups:= )
24 obex? ( dev-libs/libical:= )
25 readline? ( sys-libs/readline:= )
26 systemd? ( sys-apps/systemd )
27 udev? ( >=virtual/udev-172 )
29 !<app-emulation/emul-linux-x86-soundlibs-20140406-r1
30 !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32]
37 $(python_gen_any_dep '
38 >=dev-python/dbus-python-1[${PYTHON_USEDEP}]
40 dev-python/pygobject:3[${PYTHON_USEDEP}]
41 dev-python/pygobject:2[${PYTHON_USEDEP}]
47 selinux? ( sec-policy/selinux-bluetooth )
50 If you want to use rfcomm as a normal user, you need to add the user
56 use test && python-any-r1_pkg_setup
60 ewarn "You are installing ${PN} with USE=-udev. This means various bluetooth"
61 ewarn "devices and adapters from Apple, Dell, Logitech etc. will not work,"
62 ewarn "and hid2hci will not be available."
68 # Use static group "plugdev" if there is no ConsoleKit (or systemd logind)
69 epatch "${FILESDIR}"/bluez-plugdev.patch
71 # Try both udevadm paths to cover udev/systemd vs. eudev locations (#539844)
72 # http://www.spinics.net/lists/linux-bluetooth/msg58739.html
73 epatch "${FILESDIR}"/bluez-udevadm-path.patch
76 # http://www.spinics.net/lists/linux-bluetooth/msg38490.html
77 epatch "${FILESDIR}"/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch
79 # http://www.spinics.net/lists/linux-bluetooth/msg40136.html
80 epatch "${FILESDIR}"/0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch
82 # http://www.spinics.net/lists/linux-bluetooth/msg41264.html
83 epatch "${FILESDIR}"/0002-autopair-Don-t-handle-the-iCade.patch
86 epatch "${FILESDIR}"/0004-agent-Assert-possible-infinite-loop.patch
88 # Ubuntu workaround for bug #501120
89 epatch "${FILESDIR}"/0001-work-around-Logitech-diNovo-Edge-keyboard-firmware-i.patch
93 -e "s:cupsdir = \$(libdir)/cups:cupsdir = $(cups-config --serverbin):" \
94 Makefile.{in,tools} || die
102 multilib_src_configure() {
104 # readline is automagic when client is enabled
105 # --enable-client always needs readline, bug #504038
106 ac_cv_header_readline_readline_h=$(multilib_native_usex readline)
109 if ! multilib_is_native_abi; then
111 # deps not used for the library
112 {DBUS,GLIB}_{CFLAGS,LIBS}=' '
117 --localstatedir=/var \
120 --enable-experimental \
121 --enable-optimization \
122 $(use_enable debug) \
126 $(multilib_native_use_enable test) \
130 $(multilib_native_use_enable cups) \
131 $(multilib_native_use_enable obex) \
132 $(multilib_native_use_enable readline client) \
133 $(multilib_native_use_enable systemd) \
134 $(systemd_with_unitdir) \
135 $(multilib_native_use_enable udev) \
136 $(multilib_native_use_enable udev sixaxis)
139 multilib_src_compile() {
140 if multilib_is_native_abi; then
143 emake -f Makefile -f - libs \
144 <<<'libs: $(lib_LTLIBRARIES)'
148 multilib_src_test() {
149 multilib_is_native_abi && default
152 multilib_src_install() {
153 if multilib_is_native_abi; then
154 emake DESTDIR="${D}" install
156 # Upstream doesn't install this, bug #524640
157 # http://permalink.gmane.org/gmane.linux.bluez.kernel/53115
158 # http://comments.gmane.org/gmane.linux.bluez.kernel/54564
159 # gatttool is only built with readline, bug #530776
160 use readline && dobin attrib/gatttool
163 # Unittests are not that useful once installed
165 rm -r "${ED}"/usr/$(get_libdir)/bluez/test || die
168 emake DESTDIR="${D}" \
169 install-includeHEADERS \
170 install-libLTLIBRARIES \
171 install-pkgconfigDATA
175 multilib_src_install_all() {
176 prune_libtool_files --modules
178 keepdir /var/lib/bluetooth
180 # Upstream don't want people to play with them
181 # But we keep installing them due to 'historical' reasons
182 insinto /etc/bluetooth
184 for d in input network proximity; do
185 doins profiles/${d}/${d}.conf
188 doins src/bluetooth.conf
190 newinitd "${FILESDIR}"/bluetooth-init.d-r3 bluetooth
191 newinitd "${FILESDIR}"/rfcomm-init.d-r2 rfcomm
195 readme.gentoo_create_doc
199 readme.gentoo_print_elog
201 use udev && udev_reload
203 has_version net-dialup/ppp || elog "To use dial up networking you must install net-dialup/ppp."
205 if ! has_version sys-auth/consolekit && ! has_version sys-apps/systemd; then
206 elog "Since you don't have sys-auth/consolekit neither sys-apps/systemd, you will"
207 elog "need to add the user to the plugdev group."