2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
|
PYTHON_COMPAT=( python3_{9..11} )
|
6 |
|
inherit gnome2 python-any-r1 readme.gentoo-r1 systemd udev vala
|
|
5 |
PYTHON_COMPAT=( python3_{9..12} )
|
|
6 |
inherit bash-completion-r1 meson python-any-r1 optfeature systemd udev vala xdg
|
7 |
7 |
|
8 |
8 |
DESCRIPTION="Modem and mobile broadband management libraries"
|
9 |
|
HOMEPAGE="https://www.freedesktop.org/wiki/Software/ModemManager/"
|
10 |
|
SRC_URI="https://www.freedesktop.org/software/ModemManager/ModemManager-${PV}.tar.xz"
|
|
9 |
HOMEPAGE="https://www.freedesktop.org/wiki/Software/ModemManager/ https://gitlab.freedesktop.org/mobile-broadband/ModemManager"
|
|
10 |
SRC_URI="https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/archive/${PV}/ModemManager-${PV}.tar.bz2"
|
11 |
11 |
|
12 |
12 |
LICENSE="GPL-2+"
|
13 |
13 |
SLOT="0/1" # subslot = dbus interface version, i.e. N in org.freedesktop.ModemManager${N}
|
14 |
|
KEYWORDS="~alpha amd64 arm arm64 ~ia64 ~loong ~mips ppc ppc64 ~riscv ~sparc x86"
|
|
14 |
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
|
15 |
15 |
|
16 |
|
IUSE="elogind +introspection mbim policykit +qmi +qrtr selinux systemd test +udev vala"
|
|
16 |
IUSE="elogind gtk-doc +introspection +mbim policykit +qmi +qrtr selinux systemd test +udev vala"
|
17 |
17 |
REQUIRED_USE="
|
18 |
18 |
?? ( elogind systemd )
|
19 |
19 |
qrtr? ( qmi )
|
... | ... | |
24 |
24 |
DEPEND="
|
25 |
25 |
>=dev-libs/glib-2.56.0:2
|
26 |
26 |
udev? ( >=dev-libs/libgudev-232:= )
|
27 |
|
introspection? ( >=dev-libs/gobject-introspection-0.9.6:= )
|
28 |
|
mbim? ( >=net-libs/libmbim-1.26.0 )
|
|
27 |
introspection? ( >=dev-libs/gobject-introspection-1.38:= )
|
|
28 |
mbim? ( >=net-libs/libmbim-1.28.0 )
|
29 |
29 |
policykit? ( >=sys-auth/polkit-0.106[introspection?] )
|
30 |
|
qmi? ( >=net-libs/libqmi-1.30.8:=[qrtr?] )
|
|
30 |
qmi? ( >=net-libs/libqmi-1.32.0:=[qrtr?] )
|
31 |
31 |
qrtr? ( >=net-libs/libqrtr-glib-1.0.0:= )
|
32 |
32 |
elogind? ( sys-auth/elogind )
|
33 |
33 |
systemd? ( >=sys-apps/systemd-209 )
|
34 |
34 |
"
|
35 |
35 |
RDEPEND="${DEPEND}
|
36 |
|
policykit? ( acct-group/plugdev )
|
37 |
36 |
selinux? ( sec-policy/selinux-modemmanager )
|
38 |
37 |
"
|
39 |
38 |
BDEPEND="
|
40 |
39 |
dev-util/gdbus-codegen
|
41 |
40 |
dev-util/glib-utils
|
42 |
|
>=dev-util/gtk-doc-am-1
|
43 |
41 |
>=sys-devel/gettext-0.19.8
|
44 |
42 |
virtual/pkgconfig
|
|
43 |
gtk-doc? ( dev-util/gtk-doc )
|
45 |
44 |
test? (
|
46 |
45 |
${PYTHON_DEPS}
|
47 |
46 |
$(python_gen_any_dep '
|
... | ... | |
64 |
63 |
}
|
65 |
64 |
|
66 |
65 |
src_prepare() {
|
67 |
|
DOC_CONTENTS="
|
68 |
|
If your USB modem shows up only as a storage device when you plug it in,
|
69 |
|
then you should install sys-apps/usb_modeswitch, which will automatically
|
70 |
|
switch it over to USB modem mode whenever you plug it in.\n"
|
71 |
|
|
72 |
|
if use policykit; then
|
73 |
|
DOC_CONTENTS+="\nTo control your modem without needing to enter the root password,
|
74 |
|
add your user account to the 'plugdev' group."
|
75 |
|
fi
|
76 |
|
|
77 |
66 |
use vala && vala_setup
|
78 |
|
gnome2_src_prepare
|
|
67 |
default
|
79 |
68 |
}
|
80 |
69 |
|
81 |
70 |
src_configure() {
|
82 |
|
local myconf=(
|
83 |
|
--disable-Werror
|
84 |
|
--disable-static
|
85 |
|
--with-dist-version=${PVR}
|
86 |
|
--with-udev-base-dir="$(get_udevdir)"
|
87 |
|
$(use_with udev)
|
88 |
|
$(use_enable introspection)
|
89 |
|
$(use_with mbim)
|
90 |
|
$(use_with policykit polkit)
|
91 |
|
$(use_with systemd systemd-journal)
|
92 |
|
$(use_with qmi)
|
93 |
|
$(use_with qrtr)
|
94 |
|
$(use_enable vala)
|
|
71 |
# Let's avoid BuildRequiring bash-completion, install it manually
|
|
72 |
local emesonargs=(
|
|
73 |
-Dbash_completion=false
|
|
74 |
$(meson_use gtk-doc gtk_doc)
|
|
75 |
$(meson_use introspection)
|
|
76 |
|
|
77 |
$(meson_use udev)
|
|
78 |
-Dudevdir="${EPREFIX}$(get_udevdir)"
|
|
79 |
-Dsystemdsystemunitdir="$(systemd_get_systemunitdir)"
|
|
80 |
|
|
81 |
$(meson_use systemd systemd_journal)
|
|
82 |
|
|
83 |
-Dpolkit=$(usex policykit permissive no)
|
|
84 |
|
|
85 |
$(meson_use mbim)
|
|
86 |
$(meson_use qmi)
|
|
87 |
$(meson_use qrtr)
|
|
88 |
|
|
89 |
$(meson_use vala vapi)
|
95 |
90 |
)
|
96 |
91 |
if use systemd || use elogind; then
|
97 |
|
myconf+=(--with-systemd-suspend-resume)
|
|
92 |
emesonargs+=(-Dsystemd_suspend_resume=true)
|
98 |
93 |
else
|
99 |
|
myconf+=(--without-systemd-suspend-resume)
|
|
94 |
emesonargs+=(-Dsystemd_suspend_resume=false)
|
100 |
95 |
fi
|
101 |
|
gnome2_src_configure "${myconf[@]}"
|
|
96 |
meson_src_configure
|
102 |
97 |
}
|
103 |
98 |
|
104 |
99 |
src_install() {
|
105 |
|
gnome2_src_install
|
106 |
|
|
107 |
|
# Allow users in plugdev group full control over their modem
|
108 |
|
if use policykit; then
|
109 |
|
insinto /usr/share/polkit-1/rules.d/
|
110 |
|
doins "${FILESDIR}"/01-org.freedesktop.ModemManager1.rules
|
111 |
|
fi
|
112 |
|
|
113 |
|
readme.gentoo_create_doc
|
114 |
|
|
|
100 |
meson_src_install
|
115 |
101 |
newinitd "${FILESDIR}/modemmanager.initd" modemmanager
|
|
102 |
newbashcomp cli/mmcli-completion mmcli
|
116 |
103 |
}
|
117 |
104 |
|
118 |
105 |
pkg_postinst() {
|
119 |
|
gnome2_pkg_postinst
|
120 |
|
|
121 |
|
# The polkit rules file moved to /usr/share
|
122 |
|
old_rules="${EROOT}/etc/polkit-1/rules.d/01-org.freedesktop.ModemManager.rules"
|
123 |
|
if [[ -f "${old_rules}" ]]; then
|
124 |
|
case "$(md5sum ${old_rules})" in
|
125 |
|
c5ff02532cb1da2c7545c3069e5d0992* | 5c50f0dc603c0a56e2851a5ce9389335* )
|
126 |
|
# Automatically delete the old rules.d file if the user did not change it
|
127 |
|
elog
|
128 |
|
elog "Removing old ${old_rules} ..."
|
129 |
|
rm -f "${old_rules}" || eerror "Failed, please remove ${old_rules} manually"
|
130 |
|
;;
|
131 |
|
* )
|
132 |
|
elog "The ${old_rules}"
|
133 |
|
elog "file moved to /usr/share/polkit-1/rules.d/ in >=modemmanager-0.5.2.0-r2"
|
134 |
|
elog "If you edited ${old_rules}"
|
135 |
|
elog "without changing its behavior, you may want to remove it."
|
136 |
|
;;
|
137 |
|
esac
|
138 |
|
fi
|
|
106 |
xdg_pkg_postinst
|
139 |
107 |
|
140 |
108 |
if ! use udev; then
|
141 |
109 |
ewarn "You have built ModemManager without udev support. You may have to teach it"
|
... | ... | |
146 |
114 |
|
147 |
115 |
systemd_reenable ModemManager.service
|
148 |
116 |
|
149 |
|
readme.gentoo_print_elog
|
|
117 |
optfeature "the case your modem shows up as a storage drive" sys-apps/usb_modeswitch
|
150 |
118 |
}
|
151 |
119 |
|
152 |
120 |
pkg_postrm() {
|
|
121 |
xdg_pkg_postrm
|
153 |
122 |
use udev && udev_reload
|
154 |
123 |
}
|