File redshift.spec of Package redshift

#
# spec file for package redshift
#
# 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/
#


Name:           redshift
Version:        1.11
Release:        0
Summary:        Adjusts the color temperature of your screen
License:        GPL-3.0
Group:          System/X11/Utilities
Url:            http://jonls.dk/redshift/
Source:         https://github.com/jonls/redshift/releases/download/v%{version}/%{name}-%{version}.tar.xz 
BuildRequires:  fdupes
BuildRequires:  gettext-tools
BuildRequires:  hicolor-icon-theme
BuildRequires:  intltool
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(gconf-2.0)
BuildRequires:  pkgconfig(geoclue-2.0)
BuildRequires:  pkgconfig(libdrm)
BuildRequires:  pkgconfig(python3)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xcb)
BuildRequires:  pkgconfig(xrandr)
BuildRequires:  pkgconfig(xxf86vm)
Requires:       geoclue2
Requires:       python3-xdg
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1320
BuildRequires:  systemd-rpm-macros
%{?systemd_requires}
%endif
%py_requires

%description
Redshift adjusts the color temperature of your screen according to your surroundings.
This may help your eyes hurt less if you are working in front of the screen at night.

%package gtk
Summary:        Gtk frontend for redshift
Group:          System/X11/Utilities
Requires:       hicolor-icon-theme
Requires:       redshift = %{version}-%{release}
Requires:       python3-gobject-Gdk
Requires(post): update-desktop-files
Requires(post): hicolor-icon-theme
Requires(postun): update-desktop-files
Requires(postun): hicolor-icon-theme
%if 0%{?suse_version} > 1320
%{?systemd_requires}
%endif

%description gtk
A graphical user interface for the redshift tool that integrates into Gtk+ and GNOME.

%prep
%setup -q

%build
%configure \
  --enable-gui \
  --disable-geoclue \
  --enable-geoclue2 \
  --enable-randr \
  --enable-vidmode \
  %if 0%{?suse_version} > 1320
  --with-systemduserunitdir=%{_userunitdir}
  %else
  --with-systemduserunitdir=no
  %endif
make %{?_smp_mflags} V=1

%install
make %{?_smp_mflags} DESTDIR=%{buildroot} install
%fdupes -s %{buildroot}%{python3_sitelib}
%suse_update_desktop_file redshift-gtk GTK X-SuSE-DesktopUtility

%if 0%{?suse_version} == 1310
rm %{buildroot}%{_datadir}/appdata/redshift-gtk.appdata.xml
%endif

%find_lang %{name}

%post gtk
%desktop_database_post
%icon_theme_cache_post

%postun gtk
%desktop_database_postun
%icon_theme_cache_postun

%files gtk -f %{name}.lang
%defattr(-,root,root,-)
%{_bindir}/redshift-gtk
%{python3_sitelib}/redshift_gtk
%{_datadir}/applications/redshift-gtk.desktop
%{_datadir}/icons/hicolor/scalable/apps/redshift-status-off.svg
%{_datadir}/icons/hicolor/scalable/apps/redshift-status-on.svg
%{_datadir}/icons/hicolor/scalable/apps/redshift.svg
%if 0%{?suse_version} > 1320
%{_userunitdir}/redshift-gtk.service
%endif
%if 0%{?suse_version} > 1310
%dir %{_datadir}/appdata
%{_datadir}/appdata/redshift-gtk.appdata.xml
%endif

%files
%defattr(-,root,root,-)
%{_bindir}/redshift
%{_mandir}/man1/redshift.1%{ext_man}
%{_datadir}/applications/redshift.desktop
%if 0%{?suse_version} > 1320
%{_userunitdir}/redshift.service
%endif

%changelog
openSUSE Build Service is sponsored by