Merge media-sound/spotify: Fix homepage URL
[gentoo.git] / net-wireless / bluez / bluez-5.33.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6 PYTHON_COMPAT=( python{2_7,3_3,3_4} )
7
8 inherit autotools eutils multilib python-any-r1 readme.gentoo systemd udev user multilib-minimal
9
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"
13
14 LICENSE="GPL-2+ LGPL-2.1+"
15 SLOT="0/3"
16 KEYWORDS="~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~x86"
17 IUSE="cups debug +obex +readline selinux systemd test +udev"
18
19 CDEPEND="
20         >=dev-libs/glib-2.28:2
21         >=sys-apps/dbus-1.6:=
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 )
28         abi_x86_32? (
29                 !<app-emulation/emul-linux-x86-soundlibs-20140406-r1
30                 !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32]
31         )
32 "
33 DEPEND="${CDEPEND}
34         app-arch/xz-utils
35         virtual/pkgconfig
36         test? (
37                 $(python_gen_any_dep '
38                         >=dev-python/dbus-python-1[${PYTHON_USEDEP}]
39                         || (
40                                 dev-python/pygobject:3[${PYTHON_USEDEP}]
41                                 dev-python/pygobject:2[${PYTHON_USEDEP}]
42                         )
43                 ')
44         )
45 "
46 RDEPEND="${CDEPEND}
47         selinux? ( sec-policy/selinux-bluetooth )
48 "
49 DOC_CONTENTS="
50         If you want to use rfcomm as a normal user, you need to add the user
51         to the uucp group.
52 "
53
54 pkg_setup() {
55         enewgroup plugdev
56         use test && python-any-r1_pkg_setup
57
58         if ! use udev; then
59                 ewarn
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."
63                 ewarn
64         fi
65 }
66
67 src_prepare() {
68         # Use static group "plugdev" if there is no ConsoleKit (or systemd logind)
69         epatch "${FILESDIR}"/bluez-plugdev.patch
70
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
74
75         # Fedora patches
76         # http://www.spinics.net/lists/linux-bluetooth/msg38490.html
77         epatch "${FILESDIR}"/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch
78
79         # http://www.spinics.net/lists/linux-bluetooth/msg40136.html
80         epatch "${FILESDIR}"/0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch
81
82         # http://www.spinics.net/lists/linux-bluetooth/msg41264.html
83         epatch "${FILESDIR}"/0002-autopair-Don-t-handle-the-iCade.patch
84
85         # ???
86         epatch "${FILESDIR}"/0004-agent-Assert-possible-infinite-loop.patch
87
88         # Ubuntu workaround for bug #501120
89         epatch "${FILESDIR}"/0001-work-around-Logitech-diNovo-Edge-keyboard-firmware-i.patch
90
91         if use cups; then
92                 sed -i \
93                         -e "s:cupsdir = \$(libdir)/cups:cupsdir = $(cups-config --serverbin):" \
94                         Makefile.{in,tools} || die
95         fi
96
97         eautoreconf
98
99         multilib_copy_sources
100 }
101
102 multilib_src_configure() {
103         local myconf=(
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)
107         )
108
109         if ! multilib_is_native_abi; then
110                 myconf+=(
111                         # deps not used for the library
112                         {DBUS,GLIB}_{CFLAGS,LIBS}=' '
113                 )
114         fi
115
116         econf \
117                 --localstatedir=/var \
118                 --disable-android \
119                 --enable-datafiles \
120                 --enable-experimental \
121                 --enable-optimization \
122                 $(use_enable debug) \
123                 --enable-pie \
124                 --enable-threads \
125                 --enable-library \
126                 $(multilib_native_use_enable test) \
127                 --enable-tools \
128                 --enable-manpages \
129                 --enable-monitor \
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)
137 }
138
139 multilib_src_compile() {
140         if multilib_is_native_abi; then
141                 default
142         else
143                 emake -f Makefile -f - libs \
144                         <<<'libs: $(lib_LTLIBRARIES)'
145         fi
146 }
147
148 multilib_src_test() {
149         multilib_is_native_abi && default
150 }
151
152 multilib_src_install() {
153         if multilib_is_native_abi; then
154                 emake DESTDIR="${D}" install
155
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
161                 dobin tools/hex2hcd
162
163                 # Unittests are not that useful once installed
164                 if use test ; then
165                         rm -r "${ED}"/usr/$(get_libdir)/bluez/test || die
166                 fi
167         else
168                 emake DESTDIR="${D}" \
169                         install-includeHEADERS \
170                         install-libLTLIBRARIES \
171                         install-pkgconfigDATA
172         fi
173 }
174
175 multilib_src_install_all() {
176         prune_libtool_files --modules
177
178         keepdir /var/lib/bluetooth
179
180         # Upstream don't want people to play with them
181         # But we keep installing them due to 'historical' reasons
182         insinto /etc/bluetooth
183         local d
184         for d in input network proximity; do
185                 doins profiles/${d}/${d}.conf
186         done
187         doins src/main.conf
188         doins src/bluetooth.conf
189
190         newinitd "${FILESDIR}"/bluetooth-init.d-r3 bluetooth
191         newinitd "${FILESDIR}"/rfcomm-init.d-r2 rfcomm
192
193         einstalldocs
194
195         readme.gentoo_create_doc
196 }
197
198 pkg_postinst() {
199         readme.gentoo_print_elog
200
201         use udev && udev_reload
202
203         has_version net-dialup/ppp || elog "To use dial up networking you must install net-dialup/ppp."
204
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."
208         fi
209 }