1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 VALA_USE_DEPEND="vapigen"
8 inherit gnome2 readme.gentoo-r1 systemd udev vala
10 DESCRIPTION="Modem and mobile broadband management libraries"
11 HOMEPAGE="https://www.freedesktop.org/wiki/Software/ModemManager/"
12 SRC_URI="https://www.freedesktop.org/software/ModemManager/ModemManager-${PV}.tar.xz"
15 SLOT="0/1" # subslot = dbus interface version, i.e. N in org.freedesktop.ModemManager${N}
16 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
18 IUSE="elogind +introspection mbim policykit +qmi systemd +udev vala"
20 ?? ( elogind systemd )
21 vala? ( introspection )
25 >=dev-libs/glib-2.36.0:2
26 udev? ( >=dev-libs/libgudev-230:= )
27 introspection? ( >=dev-libs/gobject-introspection-0.9.6:= )
28 mbim? ( >=net-libs/libmbim-1.18.0 )
29 policykit? ( >=sys-auth/polkit-0.106[introspection] )
30 qmi? ( >=net-libs/libqmi-1.22.0:= )
31 elogind? ( sys-auth/elogind )
32 systemd? ( >=sys-apps/systemd-209 )
35 dev-util/gdbus-codegen
37 >=dev-util/gtk-doc-am-1
38 >=sys-devel/gettext-0.19.8
40 vala? ( $(vala_depend) )
43 policykit? ( acct-group/plugdev )"
45 S="${WORKDIR}/ModemManager-${PV}"
49 If your USB modem shows up only as a storage device when you plug it in,
50 then you should install sys-apps/usb_modeswitch, which will automatically
51 switch it over to USB modem mode whenever you plug it in.\n"
53 if use policykit; then
54 DOC_CONTENTS+="\nTo control your modem without needing to enter the root password,
55 add your user account to the 'plugdev' group."
58 use vala && vala_src_prepare
64 --disable-more-warnings
66 --with-dist-version=${PVR}
67 --with-udev-base-dir="$(get_udevdir)"
69 $(use_enable introspection)
71 $(use_with policykit polkit)
72 $(use_with systemd systemd-suspend-resume)
73 $(use_with systemd systemd-journal)
79 --with-systemd-suspend-resume
80 LIBSYSTEMD_LOGIN_CFLAGS=`pkg-config --cflags "libelogind" 2>/dev/null`
81 LIBSYSTEMD_LOGIN_LIBS=`pkg-config --libs "libelogind" 2>/dev/null`
84 gnome2_src_configure "${myconf[@]}"
90 # Allow users in plugdev group full control over their modem
91 if use policykit; then
92 insinto /usr/share/polkit-1/rules.d/
93 doins "${FILESDIR}"/01-org.freedesktop.ModemManager1.rules
96 readme.gentoo_create_doc
102 # The polkit rules file moved to /usr/share
103 old_rules="${EROOT}etc/polkit-1/rules.d/01-org.freedesktop.ModemManager.rules"
104 if [[ -f "${old_rules}" ]]; then
105 case "$(md5sum ${old_rules})" in
106 c5ff02532cb1da2c7545c3069e5d0992* | 5c50f0dc603c0a56e2851a5ce9389335* )
107 # Automatically delete the old rules.d file if the user did not change it
109 elog "Removing old ${old_rules} ..."
110 rm -f "${old_rules}" || eerror "Failed, please remove ${old_rules} manually"
113 elog "The ${old_rules}"
114 elog "file moved to /usr/share/polkit-1/rules.d/ in >=modemmanager-0.5.2.0-r2"
115 elog "If you edited ${old_rules}"
116 elog "without changing its behavior, you may want to remove it."
122 ewarn "You have built ModemManager without udev support. You may have to teach it"
123 ewarn "about your modem port manually."
126 systemd_reenable ModemManager.service
128 readme.gentoo_print_elog