Name:       xlunch
Version:    4.7.5
Release:    1%{?dist}
Summary:    Graphical app launcher for X with minimal dependencies

License:    GPL-3.0-or-later
URL:        https://xlunch.org
Source0:    https://github.com/Tomas-M/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz

BuildRequires: desktop-file-utils
BuildRequires: gcc
BuildRequires: pkgconfig(imlib2)
BuildRequires: pkgconfig(x11)

Requires:   abattis-cantarell-fonts
Requires:   hicolor-icon-theme

# For SVG icons generation
Recommends: ImageMagick%{?_isa}

%description
Graphical app launcher for X, using pure Xlib and Imlib2.


%prep
%autosetup -p1

# Fix genentries
sed -e \
    's|bash extra/genentries --path $(DESTDIR)/usr/share/xlunch/svgicons/ > $(DESTDIR)/etc/xlunch/entries.dsv||' \
    -i Makefile
sed -e 's|bash extra/genentries > entries.dsv||' -i Makefile


%build
%if 0%{?fedora} || 0%{?rhel} >= 8
%set_build_flags
%endif
%make_build


%install
%make_install
touch %{buildroot}%{_sysconfdir}/%{name}/entries.dsv


%check
# "Error generating new entries"" for key "Exec" in group "Desktop Entry"
# contains a reserved character '$' outside of a quote
#  * error: required key "Type" in group "Desktop Entry" is not present
#   - https://github.com/Tomas-M/xlunch/issues/109
desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop


%post
genentries --path %{_datadir}/%{name}/svgicons/ > %{_sysconfdir}/%{name}/entries.dsv
cp -rp svgicons/ %{_datadir}/%{name}/ 2>/dev/null || :


%files
%license LICENSE
%doc README.md AUTHORS
%{_bindir}/%{name}
%{_bindir}/%{name}_genquick
%{_bindir}/genentries
%{_bindir}/genentries.desktop.sh
%{_bindir}/updateentries
%{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/*/*/*.png
%config(noreplace) %{_sysconfdir}/%{name}/default.conf
%ghost %{_datadir}/%{name}/
%ghost %{_sysconfdir}/%{name}/entries.dsv


%changelog
* Mon Feb 12 2024 Artem Polishchuk <ego.cordatus@gmail.com> - 4.7.5-1
- chore: Update to latest release

* Thu Nov 12 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 4.5.4-3
- build: packaging fixes

* Tue Oct  6 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 4.5.4-2
- fix: svg icons generation

* Tue Oct  6 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 4.5.4-1
- build(update): 4.5.4
- build(hard dep): abattis-cantarell-fonts
- build(weak dep): ImageMagick
- fix: add few patches (upstreamed)
- chore: switch to HTTPS in URL
- chore: minor style and packaging fixes

* Tue Sep 10 2019 Artem Polishchuk <ego.cordatus@gmail.com> - 4.5.3-7
- Update to 4.5.3

* Fri Jun 21 2019 Artem Polishchuk <ego.cordatus@gmail.com> - 4.5.1-1
- Update to 4.5.1

* Fri Feb 15 2019 Artem Polishchuk <ego.cordatus@gmail.com> - 4.1.1-1
- Initial package release