#
# spec file for package hyprpaper
#
# Copyright (c) 2023 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#

%if 0%{!?mkrel:1}
%define mkrel(c) %{1}%{?dist}
%endif

%global __builder ninja
Name:           hyprpaper
Summary:        Wayland wallpaper utility with IPC controls
Version:        0.7.1
Release:        %mkrel 1.1
License:        BSD-3-Clause
URL:            https://github.com/hyprwm/hyprpaper
Source0:        https://github.com/hyprwm/hyprpaper/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
%if "%{version}" <= "0.7.1"
Patch0:         hyprpaper-0.7.1-fix-prototypes.diff
%endif
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  (ninja or ninja-build)
BuildRequires:  pkgconfig(gtk-layer-shell-0)
BuildRequires:  pkgconfig(libglvnd)
%if "%{version}" < "0.7.2"
BuildRequires:  pkgconfig(libjpeg)
BuildRequires:  pkgconfig(libwebp)
BuildRequires:  pkgconfig(libmagic)
%else
BuildRequires:  pkgconfig(hyprgraphics)
%endif
BuildRequires:  pkgconfig(pango)
BuildRequires:  pkgconfig(pangocairo)
BuildRequires:  pkgconfig(wayland-protocols) >= 1.24
BuildRequires:  pkgconfig(wayland-server) >= 1.20.0
BuildRequires:  pkgconfig(hyprlang) >= 0.6.0
BuildRequires:  pkgconfig(hyprwayland-scanner)
BuildRequires:  pkgconfig(hyprutils) >= 0.2.4
Requires:       (hyprland >= 0.40.0 or socat)

%description
Hyprpaper is a wallpaper utility. It supports IPC
through a sockets interface and various image formats.

%prep
%autosetup -p1

%build
# Necessary to allow build
make protocols

%cmake
%cmake_build

%install
install -Dm0755 -t "%{buildroot}%{_bindir}" "%{_builddir}/%{name}-%{version}/build/%{name}"

%files
%_bindir/hyprpaper
%license LICENSE

%changelog
* Fri Oct 13 2023 Soc Virnyl Estela <socvirnyl.estela@uncomfyhalomacro.pl>
- Update to version 0.4.0:
  * Add dependencies to readme
  * [RFC] Filetype detection without extension
  * Added support for XDG_CONFIG_HOME
  * Support for symlinks
  * Clear wallpaper from monitor before destroying ouput
  * Reset hasATarget when issuing wallpaper command
* Thu Jun  1 2023 Soc Virnyl Estela <socvirnyl.estela@gmail.com>
- Move make protocols to build section.
* Tue May 30 2023 Soc Virnyl Estela <socvirnyl.estela@gmail.com>
- Initial spec of hyprpaper version 0.3.0