Name:          libarchive
Summary:       A library for handling streaming archive formats 
Version:       3.7.2
Release:       1%{?_dist_release}
Group:         system
Vendor:        Project Vine
Distribution:  Vine Linux

License:       BSD
URL:           https://www.libarchive.org/
Source0:       https://www.libarchive.org/downloads/%{name}-%{version}.tar.gz

BuildRoot:     %{_tmppath}/%{name}-%{version}-root
BuildRequires: bzip2-devel
BuildRequires: libacl-devel
BuildRequires: libattr-devel
BuildRequires: libxml2-devel
BuildRequires: libzstd-devel
BuildRequires: lz4-devel
BuildRequires: openssl-devel
BuildRequires: xz-devel
BuildRequires: zlib-devel

%description
Libarchive is a programming library that can create and read several different 
streaming archive formats, including most popular tar variants, several cpio 
formats, and both BSD and GNU ar variants. It can also write shar archives and 
read ISO9660 CDROM images and ZIP archives.

%package       devel
Summary:       Development files for %{name}
Group:         programming
Requires:      %{name} = %{version}-%{release}

%description   devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.


%debug_package


%prep
%autosetup -p1

# When configured against OpenSSL 1.1, the RIPEMD-160 support was not detected,
# so it was not compiled in previously. With OpenSSL 3.0, it's now detected as
# being available, but it only actually works when the legacy provider is
# loaded, which breaks the RIPEMD-160 test. This patch disables the RIPEMD-160
# support explicitly.
sed -i -e '/RMD160, OPENSSL, rmd160/d' configure.ac

autoreconf -vif


%build
%configure \
    --disable-static \
    --disable-bsdtar \
    --disable-bsdcpio \
    --disable-bsdcat \
    --disable-bsdunzip
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
#iconv -f latin1 -t utf-8 < NEWS > NEWS.utf8; cp NEWS.utf8 NEWS
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
find $RPM_BUILD_ROOT -name cpio.5 -exec rm -f {} ';'
find $RPM_BUILD_ROOT -name mtree.5 -exec rm -f {} ';'
find $RPM_BUILD_ROOT -name tar.5 -exec rm -f {} ';'


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%license COPYING
%doc README* NEWS
%{_libdir}/*.so.*

%files devel
%defattr(-,root,root,-)
%doc
%{_includedir}/*
%{_mandir}/*/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc


%changelog
* Tue Sep 12 2023 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.7.2-1
- new upstream release.

* Mon Jul 31 2023 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.7.1-1
- new upstream release.

* Sat Dec 10 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.6.2-1
- new upstream release.
- dropped Patch0001: maede to get the same effect by sed.
- dropped Patch1000: fixed in upstream.

* Tue Nov 29 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.6.1-2
- imported Patch1000 from upstream to fix CVE-2022-36227.

* Fri May 13 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.6.1-1
- new upstream release.
- dropped Patch0: fixed in upstream.
- imported Patch0001 from rawhide.

* Tue Oct 05 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.5.2-1
- new upstream release.
- built with openssl-3.0.0.
- imported Patch0 from rawhide.
- dropped ldconfig scriptlets.

* Wed Feb 17 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.5.1-1
- new upstream release.

* Thu Jul 16 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.4.3-1
- new upstream release.
- added BR:lz4-devel.
- added BR:libzstd-devel.

* Sun Feb 16 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.4.2-1
- new upstream release.

* Sat Oct 26 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.4.0-1
- new upstream release.

* Fri Nov 30 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.3.3-1
- new upstream release.

* Tue Dec 19 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.3.2-1
- new upstream release.

* Sun May 15 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.2.0-1
- new upstream release

* Sun Jul 06 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.1.2-1
- update to 3.1.2

* Sun Jun 10 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.0.4-1
- new upstream release

* Thu May 19 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.8.4-4
- add BuildRequires: openssl-devel, libxml2-devel

* Thu May 19 2011 Daisuke SUZUKI <daisuke@linux.or.jp> 2.8.4-3
- rebuild against liblzma.so.5

* Sun Sep 26 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.8.4-2
- rebuild with rpm-4.8.1 for pkg-config file

* Sun Sep  5 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.8.4-1
- new upstream release

* Wed Apr 14 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.8.3-1
- new upstream release
- built with new toolchain

* Tue Apr  8 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.6.0-1
- new upstream release

* Wed Apr  2 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.4.14-1vl5
- Build for Vine Linux

* Tue Mar 18 2008 Tomas Bzatek <tbzatek@redhat.com> 2.4.14-1
- Initial packaging
