File upower.spec of Package upower

#
# spec file for package upower
#
# Copyright (c) 2014 SUSE LINUX Products 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/
#


%{!?_udevrulesdir: %global _udevrulesdir %(pkg-config --variable=udevdir udev)/rules.d}
%define systemdutildir %(pkg-config --variable systemdutildir systemd)

Name:           upower
Summary:        Power Device Enumeration Framework
License:        GPL-2.0+
Group:          System/Daemons
Version:        0.99.1
Release:        0
Url:            http://upower.freedesktop.org/
Source:         http://upower.freedesktop.org/releases/%{name}-%{version}.tar.xz
BuildRequires:  dbus-1-glib-devel
BuildRequires:  gobject-introspection-devel >= 0.9.9
BuildRequires:  gtk-doc >= 1.11
BuildRequires:  intltool
BuildRequires:  libgudev-1_0-devel
BuildRequires:  libimobiledevice-devel
BuildRequires:  libusb-devel
BuildRequires:  pkgconfig(systemd)
BuildRequires:  pkgconfig(udev)
%{?systemd_requires}
Recommends:     %{name}-lang
# bnc#790787 - upower calls /usr/bin/pm-is-supported, so a Recommends should be safe
# for reference see src/linux/up-backend.c
Recommends:     pm-utils
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Obsoletes:      DeviceKit-power < 0.9.9

%description
UPower is an abstraction for enumerating power devices, listening to
device events and querying history and statistics. Any application or
service on the system can access the org.freedesktop.UPower service
via the system message bus. Some operations (such as suspending the
system) are restricted using PolicyKit.

%package -n libupower-glib3
Summary:        Power Device Enumeration Framework - Library
Group:          System/Daemons
Recommends:     %{name}

%description -n libupower-glib3
UPower is an abstraction for enumerating power devices, listening to
device events and querying history and statistics. Any application or
service on the system can access the org.freedesktop.UPower service
via the system message bus. Some operations (such as suspending the
system) are restricted using PolicyKit.

%package -n typelib-1_0-UpowerGlib-1_0
Summary:        Power Device Enumeration Framework - Introspection bindings
Group:          System/Daemons

%description -n typelib-1_0-UpowerGlib-1_0
UPower is an abstraction for enumerating power devices, listening to
device events and querying history and statistics. Any application or
service on the system can access the org.freedesktop.UPower service
via the system message bus. Some operations (such as suspending the
system) are restricted using PolicyKit.

This package provides the GObject Introspection bindings for
libupower-glib.

%package -n libupower-glib-devel
Summary:        Power Device Enumeration Framework - Development Files
Group:          Development/Libraries/Other
Requires:       libupower-glib3 = %{version}
Requires:       typelib-1_0-UpowerGlib-1_0 = %{version}
Provides:       %{name}-devel = %{version}

%description -n libupower-glib-devel
UPower is an abstraction for enumerating power devices, listening to
device events and querying history and statistics. Any application or
service on the system can access the org.freedesktop.UPower service
via the system message bus. Some operations (such as suspending the
system) are restricted using PolicyKit.

%lang_package
%prep
%setup -q

%build
export V=1
%configure\
  --disable-static \
  --libexecdir=%{_libexecdir}/upower \
  --enable-gtk-doc \
  --with-udevrulesdir=%{_udevrulesdir}
make %{?_smp_mflags}

%install
%makeinstall
rm -f %{buildroot}%{_libdir}/*.la
%find_lang %{name}

%clean
rm -rf %{buildroot}

%pre
%service_add_pre upower.service

%post
%{?udev_rules_update:%udev_rules_update}
%service_add_post upower.service

%preun
%service_del_preun upower.service

%postun
%service_del_postun upower.service

%post -n libupower-glib3 -p /sbin/ldconfig

%postun -n libupower-glib3 -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc AUTHORS COPYING NEWS README
%config %{_sysconfdir}/UPower/
%{_bindir}/upower
%dir %{_libexecdir}/upower
%{_libexecdir}/upower/upowerd
%{_udevrulesdir}/*.rules
%{_unitdir}/upower.service
%config %{_sysconfdir}/dbus-1/system.d/org.freedesktop.UPower.conf
%{_datadir}/dbus-1/interfaces/org.freedesktop.UPower.xml
%{_datadir}/dbus-1/interfaces/org.freedesktop.UPower.Device.xml
%{_datadir}/dbus-1/interfaces/org.freedesktop.UPower.KbdBacklight.xml
%{_datadir}/dbus-1/interfaces/org.freedesktop.UPower.Wakeups.xml
%{_datadir}/dbus-1/system-services/org.freedesktop.UPower.service
%doc %{_mandir}/man1/upower.1%{?ext_man}
%doc %{_mandir}/man7/UPower.7%{?ext_man}
%doc %{_mandir}/man8/upowerd.8%{?ext_man}
%dir %{_localstatedir}/lib/upower

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

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

%files -n libupower-glib-devel
%defattr(-,root,root,-)
%doc %{_datadir}/gtk-doc/html/UPower/
%{_includedir}/libupower-glib/
%{_libdir}/pkgconfig/upower-glib.pc
%{_libdir}/libupower-glib.so
%{_datadir}/gir-1.0/UPowerGlib-1.0.gir

%files lang -f %{name}.lang

%changelog