Name:              zathura
Version:           0.4.5
Release:           1%{?dist}
Summary:           A lightweight document viewer
Group:             Applications/Publishing
License:           zlib
URL:               http://pwmt.org/projects/%{name}/
Source0:           http://pwmt.org/projects/%{name}/download/%{name}-%{version}.tar.xz
BuildRequires:     bash-completion
BuildRequires:     binutils
BuildRequires:     check
BuildRequires:     desktop-file-utils
BuildRequires:     file-devel
BuildRequires:     gcc
BuildRequires:     gettext
BuildRequires:     girara-devel >= 0.3.2
BuildRequires:     glib2-devel >= 2.50
BuildRequires:     gtk3-devel >= 3.22
BuildRequires:     intltool
# Needed to validate appdata
BuildRequires:     libappstream-glib
BuildRequires:     librsvg2-tools
BuildRequires:     libseccomp-devel
BuildRequires:     meson >= 0.45
#BuildRequires:     python3-sphinx
BuildRequires:     sqlite-devel >= 3.5.9
BuildRequires:     texlive-lib-devel
BuildRequires:     zsh
# Tests
BuildRequires:     check-devel

Requires:          zathura-cb
Requires:          zathura-djvu
# poppler is preferred over mupdf
Requires:          zathura-pdf-poppler
Requires:          zathura-ps

Requires:          zathura-bash-completion
Requires:          zathura-zsh-completion

%description
Zathura is a highly customizable and functional document viewer.
It provides a minimalistic and space saving interface as well as
an easy usage that mainly focuses on keyboard interaction.
Zathura requires plugins to support document formats.
For instance:
* zathura-pdf-poppler to open PDF files,
* zathura-ps to open PostScript files,
* zathura-djvu to open DjVu files, or
* zathura-cb to open comic book files.
All of these are available as separate packages in Fedora.
A zathura-plugins-all package is available should you want
to install all available plugins.


%package devel
Summary:           Development files for the zathura PDF viewer
Requires:          %{name}%{?_isa} = %{version}-%{release}
Requires:          pkgconfig
%description devel
libraries and header files for the zathura PDF viewer.


%package plugins-all
Summary:           Zathura plugins (all plugins)
Requires:          zathura-cb
Requires:          zathura-djvu
# poppler is preferred over mupdf
Requires:          zathura-pdf-poppler
Requires:          zathura-ps
%description plugins-all
This package installs all available Zathura plugins.


%package bash-completion
Summary:           bash-completion files for zathura
BuildArch:         noarch
Requires:          bash-completion
Requires:          zathura = %{version}-%{release}
%description bash-completion
This package provides %{summary}.

%package fish-completion
Summary:           fish-completion files for zathura
BuildArch:         noarch
Requires:          fish
Requires:          zathura = %{version}-%{release}
%description fish-completion
This package provides %{summary}.


%package zsh-completion
Summary:           zsh-completion files for zathura
BuildArch:         noarch
Requires:          zsh
Requires:          zathura = %{version}-%{release}
%description zsh-completion
This package provides %{summary}.


%prep
%setup -q
sed "s|'-Werror=implicit-function-declaration',||" -i meson.build
sed "s|'-Werror=vla',||" -i meson.build
sed "s|subdir('tests')||" -i meson.build
sed "s|subdir('doc')||" -i meson.build
sed 's|>=1.19|>=1.18|' -i meson.build


%build
%meson -Dsynctex=enabled -Dsqlite=enabled -Dmagic=enabled -Dseccomp=enabled -Dtests=disabled -Dconvert-icon=enabled
%meson_build


%install
%meson_install
appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/*.appdata.xml
desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%find_lang zathura


%files -f zathura.lang
%license LICENSE
%doc README
%{_bindir}/*
#%{_mandir}/man*/*
%{_datadir}/applications/*
%{_datadir}/dbus-1/interfaces/org.pwmt.zathura.xml
%{_datadir}/icons/hicolor/*/apps/org.pwmt.zathura.png
%{_datadir}/icons/scalable/apps/org.pwmt.zathura.svg
%{_datadir}/metainfo/org.pwmt.zathura.appdata.xml


%files devel
%{_includedir}/zathura
%{_libdir}/pkgconfig/zathura.pc


%files plugins-all


%files bash-completion
%{_datadir}/bash-completion/completions/zathura


%files fish-completion
%{_datadir}/fish/completions/zathura.fish


%files zsh-completion
%{_datadir}/zsh/site-functions/_zathura


%changelog
