File xfce4-power-manager.spec of Package xfce4-power-manager

#
# spec file for package xfce4-power-manager
#
# Copyright (c) 2018 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 panel_version 4.12.0
Name:           xfce4-power-manager
Version:        @SERVICE@
Release:        0
Summary:        Power Management for the Xfce Desktop Environment
License:        GPL-2.0-or-later
Group:          System/GUI/XFCE
URL:            http://goodies.xfce.org/projects/applications/xfce4-power-manager
Source0:        %{name}-%{version}.tar.bz2
Source1:        xfce4-power-manager.xml
BuildRequires:  automake
BuildRequires:  fdupes
BuildRequires:  intltool
BuildRequires:  libxslt-tools
BuildRequires:  pkgconfig
BuildRequires:  update-desktop-files
BuildRequires:  xfce4-dev-tools
BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  pkgconfig(dbus-glib-1)
BuildRequires:  pkgconfig(glib-2.0) >= 2.42
BuildRequires:  pkgconfig(gmodule-2.0)
BuildRequires:  pkgconfig(gobject-2.0)
BuildRequires:  pkgconfig(gthread-2.0)
BuildRequires:  pkgconfig(gtk+-3.0) >= 3.14
BuildRequires:  pkgconfig(libnotify)
BuildRequires:  pkgconfig(libxfce4panel-2.0) >= %{panel_version}
BuildRequires:  pkgconfig(libxfce4ui-1)
BuildRequires:  pkgconfig(libxfce4util-1.0)
BuildRequires:  pkgconfig(libxfconf-0)
BuildRequires:  pkgconfig(polkit-gobject-1) >= 0.100
BuildRequires:  pkgconfig(upower-glib) >= 0.99.0
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xrandr)
Requires:       polkit
Requires:       systemd
Requires:       upower
Recommends:     %{name}-lang = %{version}
Provides:       xfce4-power-manager-doc = %{version}
Obsoletes:      xfce4-power-manager-doc <= 1.2.0

%description
The Xfce Power Manager is a tool for the Xfce desktop environment for managing
profiles of policies which affect power consumption, such as the display
brightness level, display sleep times, or CPU frequency scaling. It can also
trigger actions on certain events such as closing the lid or reaching low
battery levels and provides a set of interfaces to inform other applications
about current power level so that they can adjust their power consumption.
Furthermore, it provides a standardized inhibit interface which allows
applications to prevent automatic sleep actions via the power manager.

%package -n xfce4-panel-plugin-power-manager
Summary:        Xfce Panel Plugin for Monitoring Batteries and Changing the Display Brightness
Group:          System/GUI/XFCE
Requires:       %{name} = %{version}
Requires:       xfce4-panel >= %{panel_version}
Provides:       xfce4-panel-plugin-brightness = %{version}
Obsoletes:      xfce4-panel-plugin-brightness <= 1.3.0
Provides:       xfce4-panel-plugin-xfce4battery = %{version}
Obsoletes:      xfce4-panel-plugin-xfce4battery <= 1.3.1

%description -n xfce4-panel-plugin-power-manager
This package provides a plugin for the Xfce panel for monitoring battery and
device charge levels and to regulate display brightness.

%package branding-upstream
Summary:        Upstream Branding of xfce4-power-manager
Group:          System/GUI/XFCE
Supplements:    packageand(%{name}:branding-upstream)
Conflicts:      otherproviders(%{name}-branding)
Provides:       %{name}-branding = %{version}
#BRAND: xfce4-power-manager.xml: Determines power management policy and related
#BRAND: event actions.
BuildArch:      noarch

%description branding-upstream
This package provides the openSUSE look and feel for the Xfce Power Manager.

%lang_package

%prep
%setup -q

# xfce4-pm-helper is only needed on non-systemd systems
xsltproc --nonet - ./src/org.xfce.power.policy.in2 <<'EOF' \
    > ./src/org.xfce.power.policy.in2.new && \
    mv ./src/org.xfce.power.policy.in2.new ./src/org.xfce.power.policy.in2
<?xml version="1.0"?>
<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output
  doctype-public="-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
  doctype-system="http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd"/>
  <xsl:template match="action[@id='org.xfce.power.xfce4-pm-helper']" />
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>
EOF

%build
NOCONFIGURE=1 ./autogen.sh
%configure \
    --enable-maintainer-mode
make %{?_smp_mflags} V=1

%install
%make_install

install -D -p -m 644 %{SOURCE1} \
    %{buildroot}%{_sysconfdir}/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-power-manager.xml

%suse_update_desktop_file xfce4-power-manager-settings
%suse_update_desktop_file xfce4-power-manager

rm %{buildroot}%{_libdir}/xfce4/panel/plugins/libxfce4powermanager.la

# xfce4-pm-helper is only needed on non-systemd systems
rm %{buildroot}%{_sbindir}/xfce4-pm-helper

%find_lang %{name} %{?no_lang_C}

%fdupes %{buildroot}/%{_datadir}

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun

%files
%doc AUTHORS COPYING NEWS README
%{_bindir}/xfce4-power-manager
%{_bindir}/xfce4-power-manager-settings
%{_sbindir}/xfpm-power-backlight-helper
%config %{_sysconfdir}/xdg/autostart/xfce4-power-manager.desktop
%{_mandir}/man1/xfce4-power-manager*.1*
%dir %{_datadir}/polkit-1
%dir %{_datadir}/polkit-1/actions
%{_datadir}/polkit-1/actions/org.xfce.power.policy
%dir %{_datadir}/appdata
%{_datadir}/appdata/xfce4-power-manager.appdata.xml
%{_datadir}/applications/xfce4-power-manager-settings.desktop
%{_datadir}/icons/hicolor/*/*/*

%files lang -f %{name}.lang

%files -n xfce4-panel-plugin-power-manager
%{_libdir}/xfce4/panel/plugins/libxfce4powermanager.so
%{_datadir}/xfce4/panel/plugins/power-manager-plugin.desktop

%files branding-upstream
%dir %{_sysconfdir}/xdg/xfce4
%dir %{_sysconfdir}/xdg/xfce4/xfconf
%dir %{_sysconfdir}/xdg/xfce4/xfconf/xfce-perchannel-xml
%config %{_sysconfdir}/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-power-manager.xml

%changelog
openSUSE Build Service is sponsored by