File ModemManager.spec of Package ModemManager

#
# spec file for package ModemManager
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define _udevdir %(pkg-config --variable udevdir udev)
Name:           ModemManager
Version:        1.4.14
Release:        0
Summary:        DBus interface for modem handling
License:        GPL-2.0+ and GPL-3.0+
Group:          Productivity/Networking/System
Url:            http://cgit.freedesktop.org/ModemManager/ModemManager
Source0:        http://www.freedesktop.org/software/%{name}/%{name}-%{version}.tar.xz
# PATCH-FIX-OPENSUSE ModemManager-1.0.0-systemd-activation.patch bnc#892682 lnussel@suse.de -- Fix systemd dbus activation
Patch0:         ModemManager-1.0.0-systemd-activation.patch
BuildRequires:  dbus-1-glib-devel
BuildRequires:  gobject-introspection-devel >= 0.9.6
BuildRequires:  hicolor-icon-theme
BuildRequires:  intltool >= 0.40.0
BuildRequires:  libgudev-1_0-devel
BuildRequires:  ppp-devel
BuildRequires:  vala-devel >= 0.18
BuildRequires:  pkgconfig(gudev-1.0) >= 147
BuildRequires:  pkgconfig(mbim-glib) >= 1.10
BuildRequires:  pkgconfig(polkit-gobject-1) >= 0.97
BuildRequires:  pkgconfig(qmi-glib) >= 1.12.4
BuildRequires:  pkgconfig(systemd)
BuildRequires:  pkgconfig(udev)
Requires:       hicolor-icon-theme
Recommends:     usb_modeswitch
Provides:       org.freedesktop.ModemManager
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}

%description
DBus interface for modem handling. Provides a standard abstracted API
(over DBus) to communicate with all sorts of modems (landline, GSM,
CDMA).

%package -n libmm-glib0
Summary:        DBus interface for modem handling -- GLib bindings
Group:          System/Libraries

%description -n libmm-glib0
DBus interface for modem handling. Provides a standard abstracted API
(over DBus) to communicate with all sorts of modems (landline, GSM,
CDMA).

%package -n typelib-1_0-ModemManager-1_0
Summary:        DBus interface for modem handling -- GLib bindings
Group:          System/Libraries

%description -n typelib-1_0-ModemManager-1_0
DBus interface for modem handling. Provides a standard abstracted API
(over DBus) to communicate with all sorts of modems (landline, GSM,
CDMA).

%package devel
Summary:        DBus interface for modem handling -- Development Files
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
Requires:       libmm-glib0 = %{version}
Requires:       typelib-1_0-ModemManager-1_0 = %{version}

%description devel
DBus interface for modem handling. Provides a standard abstracted API
(over DBus) to communicate with all sorts of modems (landline, GSM,
CDMA).

%lang_package

%prep
%setup -q
%patch0 -p1

%build
pppddir=`ls -1d %{_libdir}/pppd/2*`
test -n "$pppddir" || exit 1
%configure \
    --disable-static \
    --with-polkit \
    --with-udev-base-dir=%{_udevdir} --with-qmi \
    --with-mbim
make %{?_smp_mflags}

%install
make DESTDIR=%{buildroot} install %{?_smp_mflags}
find %{buildroot} -type f -name "*.la" -delete -print
# create suse-specific rcFOO link
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcModemManager
%find_lang ModemManager %{name}.lang

%pre
%service_add_pre ModemManager.service

%post
%icon_theme_cache_post
%{?udev_rules_update:%udev_rules_update}
%service_add_post ModemManager.service
systemctl --quiet enable ModemManager.service || :

%preun
%service_del_preun ModemManager.service

%postun
%icon_theme_cache_postun
%service_del_postun ModemManager.service

%post -n libmm-glib0 -p /sbin/ldconfig

%postun -n libmm-glib0 -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc COPYING AUTHORS README
%{_bindir}/mmcli
%{_sbindir}/ModemManager
%{_sbindir}/rcModemManager
%config %{_sysconfdir}/dbus-1/system.d/org.freedesktop.ModemManager1.conf
%{_libdir}/ModemManager/
%{_datadir}/dbus-1/interfaces/*.xml
%{_datadir}/dbus-1/system-services/org.freedesktop.ModemManager1.service
%{_datadir}/icons/hicolor/*/*/ModemManager.png
%{_datadir}/polkit-1/actions/org.freedesktop.ModemManager1.policy
%{_udevdir}/rules.d/*-mm-*.rules
%{_unitdir}/ModemManager.service
%{_mandir}/man8/mmcli.8%{?ext_man}
%{_mandir}/man8/ModemManager.8%{?ext_man}

%files lang -f %{name}.lang
%defattr(-,root,root)

%files -n libmm-glib0
%defattr(-,root,root)
%{_libdir}/libmm-glib.so.*

%files -n typelib-1_0-ModemManager-1_0
%defattr(-,root,root)
%{_libdir}/girepository-1.0/ModemManager-1.0.typelib

%files devel
%defattr(-,root,root)
%{_datadir}/gir-1.0/ModemManager-1.0.gir
%{_datadir}/vala/vapi/
%{_includedir}/ModemManager/
%{_includedir}/libmm-glib/
%{_libdir}/libmm-glib.so
%{_libdir}/pkgconfig/ModemManager.pc
%{_libdir}/pkgconfig/mm-glib.pc

%changelog
openSUSE Build Service is sponsored by