%bcond_without test

Name:           par2cmdline
Summary:        PAR 2.0 compatible file verification and repair tool
Version:        0.8.1
Release:        2%{?_dist_release}
Group:          accessories
Vendor:         Project Vine
Distribution:   Vine Linux

License:        GPLv2+
URL:            https://github.com/Parchive/par2cmdline/
Source:         https://github.com/Parchive/par2cmdline/releases/download/v%{version}/par2cmdline-%{version}.tar.bz2
# Fix tests to account for endianness correctly.
# Backport of https://github.com/Parchive/par2cmdline/commit/4f3576a314d7169912842ec9dc1e595e61e52653.
Patch0:         0001-Fix-for-Github-issue-143.-Test-did-not-account-for-e.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-root
Obsoletes:      parchive <= 1.1.4
Provides:       parchive = 1.1.4.0.par2.%{version}

%description
par2cmdline is a program for creating and using PAR2 files to detect damage
in data files and repair them if necessary. PAR2 files are usually
published in binary newsgroups on Usenet; they apply the data-recovery
capability concepts of RAID-like systems to the posting and recovery of
multi-part archives.


%debug_package


%prep
%autosetup -p 1

# fix end-of-lines of several files
sed -i 's/\r//' AUTHORS PORTING README ROADMAP
# Remove executable permission from text files
chmod -x ChangeLog configure.ac INSTALL Makefile.am NEWS stamp-h.in


%build
%configure
make %{_smp_mflags}


%install
rm -rf %{buildroot}
%make_install
ln -sf par2 %{buildroot}/%{_bindir}/par


%clean
rm -rf %{buildroot}


%if %{with test}
%check
make check-TESTS
%endif


%files
%defattr(-,root,root,-)
%license COPYING
%doc AUTHORS ChangeLog README*
%{_bindir}/par	
%{_bindir}/par2	
%{_bindir}/par2create	
%{_bindir}/par2repair	
%{_bindir}/par2verify
%{_mandir}/man1/par2.1*


%changelog
* Wed Mar 10 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.8.1-2
- imported Patch0 from upstream.

* Sat Apr 11 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.8.1-1
- new upstream release.
- dropped Patch1.

* Fri Sep 02 2016 Toshiaki Ara <ara_t@384.jp> 0.4-2
- rebuild with gcc-5.4.0

* Sun Oct 10 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 0.4-1
- Initial build for Vine Linux
- brought patch from debian

