36efcd261c602346e6e13016b376cdec2901f751
[gentoo.git] / net-wireless / blueman / blueman-2.1.1-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="7"
5
6 PYTHON_COMPAT=( python3_{6,7} )
7 inherit autotools gnome2-utils linux-info python-single-r1 systemd xdg-utils
8
9 DESCRIPTION="Simple and intuitive GTK+ Bluetooth Manager"
10 HOMEPAGE="https://github.com/blueman-project/blueman"
11
12 if [[ ${PV} == "9999" ]] ; then
13         inherit git-r3
14         EGIT_REPO_URI="https://github.com/blueman-project/blueman.git"
15         KEYWORDS=""
16 else
17         SRC_URI="https://github.com/blueman-project/${PN}/releases/download/${PV/_/.}/${P/_/.}.tar.xz"
18         S=${WORKDIR}/${P/_/.}
19         KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
20 fi
21
22 # icons are GPL-2
23 # source files are mixed GPL-3+ and GPL-2+
24 LICENSE="GPL-3+ GPL-2"
25 SLOT="0"
26 IUSE="appindicator network nls policykit pulseaudio"
27
28 DEPEND="
29         $(python_gen_cond_dep '
30                 dev-python/pygobject:3[${PYTHON_MULTI_USEDEP}]
31         ')
32         >=net-wireless/bluez-5:=
33         ${PYTHON_DEPS}"
34 BDEPEND="
35         $(python_gen_cond_dep '
36                 dev-python/cython[${PYTHON_MULTI_USEDEP}]
37         ')
38         virtual/pkgconfig
39         nls? ( dev-util/intltool sys-devel/gettext )"
40 RDEPEND="${DEPEND}
41         $(python_gen_cond_dep '
42                 dev-python/pycairo[${PYTHON_MULTI_USEDEP}]
43         ')
44         sys-apps/dbus
45         x11-libs/gtk+:3[introspection]
46         x11-libs/libnotify[introspection]
47         || (
48                 x11-themes/adwaita-icon-theme
49                 x11-themes/faenza-icon-theme
50                 x11-themes/mate-icon-theme
51         )
52         appindicator? ( dev-libs/libappindicator:3[introspection] )
53         network? (
54                 net-firewall/iptables
55                 || (
56                         sys-apps/net-tools
57                         sys-apps/iproute2
58                 )
59                 || (
60                         net-dns/dnsmasq
61                         net-misc/dhcp
62                         >=net-misc/networkmanager-0.8
63                 )
64         )
65         policykit? ( sys-auth/polkit )
66         pulseaudio? (
67                 || (
68                         media-sound/pulseaudio[bluetooth]
69                         media-sound/pulseaudio-modules-bt
70                 )
71         )
72         !net-wireless/gnome-bluetooth
73 "
74
75 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
76
77 pkg_pretend() {
78         if use network; then
79                 local CONFIG_CHECK="~BRIDGE ~IP_NF_IPTABLES
80                         ~IP_NF_NAT ~IP_NF_TARGET_MASQUERADE"
81                 check_extra_config
82         fi
83 }
84
85 pkg_setup() {
86         python-single-r1_pkg_setup
87 }
88
89 src_prepare() {
90         default
91         # replace py-compile to fix py3
92         [[ ${PV} == 9999 ]] && eautoreconf || eautomake
93 }
94
95 src_configure() {
96         local myconf=(
97                 --docdir=/usr/share/doc/${PF}
98                 --disable-runtime-deps-check
99                 --disable-static
100                 --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
101                 --with-systemduserunitdir="$(systemd_get_userunitdir)"
102                 --with-dhcp-config="/etc/dhcp/dhcpd.conf"
103                 $(use_enable appindicator)
104                 $(use_enable policykit polkit)
105                 $(use_enable nls)
106                 $(use_enable pulseaudio)
107                 # thunar integration is a single data file with no extra deps
108                 # so install it unconditionally
109                 --enable-thunar-sendto
110         )
111         econf "${myconf[@]}"
112 }
113
114 src_install() {
115         default
116
117         if use policykit; then
118                 # Allow users in plugdev group to modify connections
119                 insinto /usr/share/polkit-1/rules.d
120                 doins "${FILESDIR}/01-org.blueman.rules"
121         fi
122
123         rm "${D}"/$(python_get_sitedir)/*.la || die
124 }
125
126 pkg_postinst() {
127         xdg_icon_cache_update
128         gnome2_schemas_update
129 }
130
131 pkg_postrm() {
132         xdg_icon_cache_update
133         gnome2_schemas_update
134 }