Name:    newsboat
Version: 2.16.1
Release: 1%{?dist}
Summary: RSS/Atom feed reader for the text console

License: MIT
URL:     https://www.newsboat.org
Source0: https://newsboat.org/releases/%{version}/%{name}-%{version}.tar.xz

Patch0:  0001-Upgrade-crate-dependencies-to-latest-in-Fedora.patch
#Patch1:  0002-Tweak-tests-for-32-bit-architectures.patch

BuildRequires: asciidoc
BuildRequires: gcc-c++
BuildRequires: gettext
BuildRequires: pkgconfig
BuildRequires: pkgconfig(json-c) >= 0.11
BuildRequires: pkgconfig(libcrypto)
BuildRequires: pkgconfig(libcurl)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(ncursesw)
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(stfl)
# libnewsboat and other rust parts
BuildRequires:  git

Provides: podboat = %{version}-%{release}

%description
Newsboat is a fork of Newsbeuter, an RSS/Atom feed reader for the text console.

%prep
%autosetup -p1
# Remove executable bit from example scripts
find contrib/ -type f -exec chmod -x '{}' +

%build
# Respect RPM settings
# CARGO_FLAGS is used/appended to by this Makefile
#%set_build_flags
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
export GFLAGS="%{optflags}"
#export CARGO_FLAGS="%{__cargo_common_opts}"
# Verify non-rust deps and setup LDFLAGS
sh config.sh

# Build the project
# Replace bare `cargo` with the one user by %%cargo_* macros
#%make_build CARGO="%{__cargo}" all test
%make_build CARGO="/bin/cargo"

%install
%make_install prefix="%{_prefix}"

%find_lang %{name}

%check
# TMPDIR=%%{_tmppath} ./test/test  # Have issues with permission in tpmdir
%cargo_test

%files -f %{name}.lang
%license LICENSE
%doc README.md

%{_bindir}/newsboat
%{_bindir}/podboat

%{_mandir}/man1/newsboat.1*
%{_mandir}/man1/podboat.1*
%{_pkgdocdir}

%changelog
* Thu Jun 27 2019 Jan Staněk <jstanek@redhat.com> - 2.16.1-1
- Upgrade to version 2.16.1
- Add %%check section

* Mon Mar 25 2019 Jan Staněk <jstanek@redhat.com> - 2.15-1
- Upgrade to version 2.15

* Mon Feb 18 2019 Jan Staněk <jstanek@redhat.com> - 2.14.1-1
- Upgrade to version 2.14.1

* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.12-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.12-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Mon Jun 25 2018 Lee Keitel <keitellf@fedoraproject.org> - 2.12-1
- Bumped version to 2.12

* Wed Jun 13 2018 Lee Keitel <keitellf@fedoraproject.org> - 2.11.1-1
- Initial version 2.11.1
