File libarchive.spec of Package libarchive.2786

#
# spec file for package libarchive
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%if 0%{?centos_version} || 0%{?rhel_version}
%if 0%{?centos_version} <= 600 || 0%{?rhel_version <= 600}
%bcond_without	static_libs
%bcond_with	openssl
%bcond_with	ext2fs
%endif
%else
%bcond_with	static_libs
%bcond_without	openssl
%bcond_without	ext2fs
%endif

%define somajor 13
%define libname libarchive%{somajor}

Name:           libarchive
Version:        3.1.2
Release:        0
Summary:        Creates and reads several different streaming archive formats
License:        BSD-2-Clause
Group:          Productivity/Archiving/Compression
Url:            http://www.libarchive.org/
Source0:        http://www.libarchive.org/downloads/libarchive-%{version}.tar.gz
Source1:        baselibs.conf
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  libacl-devel
BuildRequires:  libattr-devel
BuildRequires:  libbz2-devel
%if %{with ext2fs}
BuildRequires:  libext2fs-devel
%endif
%if %{with openssl}
BuildRequires:  libopenssl-devel
%endif
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libtool
BuildRequires:  libxml2-devel
BuildRequires:  pkg-config
BuildRequires:  xz-devel
BuildRequires:  zlib-devel
Patch0:         libarchive-openssl.patch
# PATCH-FIX-UPSTREAM bnc#800024
Patch2:         CVE-2013-0211.patch
# PATCH-FIX-UPSTREAM bnc#920870
Patch3:         directory-traversal-fix.patch
# PATCH-FIX-UPSTREAM bnc#979005
Patch4:         CVE-2016-1541.patch
# PATCH-FIX-UPSTREAM bnc#984990
Patch5:         CVE-2016-4809.patch
# PATCH-FIX-UPSTREAM bnc#985609
Patch6:         CVE-2015-8924.patch
# PATCH-FIX-UPSTREAM bnc#985665
Patch7:         CVE-2015-8932.patch
# PATCH-FIX-UPSTREAM bnc#985669
Patch8:         CVE-2015-8929.patch
# PATCH-FIX-UPSTREAM bnc#985673
Patch9:         CVE-2015-8934.patch
# PATCH-FIX-UPSTREAM bnc#985675
Patch10:        CVE-2015-8920.patch
# PATCH-FIX-UPSTREAM bnc#985679
Patch11:        CVE-2015-8928.patch
# PATCH-FIX-UPSTREAM bnc#985682
Patch12:        CVE-2015-8921.patch
# PATCH-FIX-UPSTREAM bnc#985685
Patch13:        CVE-2015-8922.patch
# PATCH-FIX-UPSTREAM bnc#985688
Patch14:        CVE-2015-8933.patch
# PATCH-FIX-UPSTREAM bnc#985689
Patch15:        CVE-2015-8931.patch
# PATCH-FIX-UPSTREAM bsc#985697
Patch16:        CVE-2015-8919.patch
# PATCH-FIX-UPSTREAM bsc#985698
Patch17:        CVE-2015-8918.patch
# PATCH-FIX-UPSTREAM bsc#985700
Patch18:        CVE-2015-8930.patch
# PATCH-FIX-UPSTREAM bsc#985703
Patch19:        CVE-2015-8923.patch
# PATCH-FIX-UPSTREAM bsc#985704
Patch20:        CVE-2015-8926.patch
# PATCH-FIX-UPSTREAM bsc#985706
Patch21:        CVE-2015-8925.patch
# PATCH-FIX-UPSTREAM bsc#985726
Patch22:        CVE-2016-4301-base.patch
# PATCH-FIX-UPSTREAM bsc#985726
Patch23:        CVE-2016-4301.patch
# PATCH-FIX-UPSTREAM bsc#985832
Patch24:        CVE-2016-4300.patch
# PATCH-FIX-UPSTREAM bsc#985835
Patch25:        CVE-2016-4302.patch
# TODO: CVE-2015-8917 bsc#985691
# from pull request #504
Patch100:       fix-build.patch

%description
Libarchive is a programming library that can create and read several
different streaming archive formats, including most popular tar
variants and several cpio formats. It can also write shar archives and
read ISO9660 CDROM images. The bsdtar program is an implementation of
tar(1) that is built on top of libarchive. It started as a test
harness, but has grown and is now the standard system tar for FreeBSD 5
and 6.

This package contains the bsdtar cmdline utility.

%package -n bsdtar
Summary:        Creates and reads several different streaming archive formats
Group:          Productivity/Archiving/Compression

%description -n bsdtar
This package contains the bsdtar cmdline utility.

%package -n %{libname}
Summary:        Library to work with several different streaming archive formats
Group:          Development/Libraries/C and C++

%description -n %{libname}
Libarchive is a programming library that can create and read several
different streaming archive formats, including most popular tar
variants and several cpio formats. It can also write shar archives and
read ISO9660 CDROM images. The bsdtar program is an implementation of
tar(1) that is built on top of libarchive. It started as a test
harness, but has grown and is now the standard system tar for FreeBSD 5
and 6.

The libarchive library offers a number of features that make it both
very flexible and very powerful.

- Automatic format detection: libarchive can automatically determine
   both the compression and the archive format, regardless of the
   data source. Most tar implementations do not automatically detect
   the compression format, few implementation that can correctly do
   this when reading from stdin or a socket. (The tar program
   included with Gunnar Ritter's heirloom collection also does full
   automatic format detection.)

- Writes POSIX formats: libarchive writes POSIX-standard formats,
   including "ustar," "pax interchange format," and the POSIX "cpio"
   format.

- Supports pax interchange format: Pax interchange format (which,
   despite the name, is really an extended tar format) eliminates
   almost all limitations of historic tar formats and provides a
   standard method for incorporating vendor-specific extensions.
   libarchive exploits this extension mechanism to support ACLs and
   file flags, for example. (Joerg Schilling's star archiver is
   another open-source tar program that supports pax interchange
   format.)

- Reads popular formats: libarchive can read GNU tar, ustar, pax
   interchange format, cpio, and older tar variants. The internal
   architecture is easily extensible. The only requirement for
   support is that it be possible to read the format without seeking
   in the file. (For example, a format that includes a compressed
   size field before the data cannot be correctly written without
   seeking.)

- High-Level API: the libarchive API makes it fairly simple to build
   an archive from a list of filenames or to extract the entries
   from an archive. However, the API also provides extreme
   flexibility with regards to data sources. For example, there are
   generic hooks that allow you to write an archive to a socket or
   read data from an archive entry into a memory buffer.

- Extensible. The internal design uses generic interfaces for
compression, archive format detection and decoding, and archive data
I/O. It should be very easy to add new formats, new compression
methods, or new ways of reading/writing archives.

%package -n libarchive-devel
Requires:       %{libname} = %{version}
Requires:       glibc-devel
Summary:        Development files for libarchive
Group:          Development/Libraries/C and C++

%description -n libarchive-devel
Libarchive is a programming library that can create and read several
different streaming archive formats, including most popular tar
variants and several cpio formats. It can also write shar archives and
read ISO9660 CDROM images. The bsdtar program is an implementation of
tar(1) that is built on top of libarchive. It started as a test
harness, but has grown and is now the standard system tar for FreeBSD 5
and 6.

This package contains the development files.

%if %{with static_libs}
%package static-devel
Requires:       %{name}-devel = %{version}
Summary:        static library for libarchive
Group:          Development/Libraries/C and C++

%description static-devel
static library for libarchive
%endif

%prep
%setup -q
%if %{with openssl}
%patch0
%endif
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch100 -p0

%build
# needed for new tests in patches
aclocal
autoconf
automake --add-missing

%global optflags    %{optflags} -D_REENTRANT -pipe
%configure \
	--disable-silent-rules \
%if %{without static_libs}
	--disable-static \
%endif
	--enable-bsdcpio
make %{?_smp_mflags}

%check
make check || { cat test-suite.log; exit 1; }

%install
%makeinstall
find %{buildroot} -name '*.la' -type f -delete -print
rm "%{buildroot}%{_mandir}/man5/"{tar,cpio,mtree}.5*
sed -i -e '/Libs.private/d' %{buildroot}%{_libdir}/pkgconfig/libarchive.pc

%post   -n %{libname} -p /sbin/ldconfig

%postun -n %{libname} -p /sbin/ldconfig

%files -n bsdtar
%defattr(-,root,root)
%{_bindir}/bsdtar
%{_bindir}/bsdcpio
%{_mandir}/man1/*
%{_mandir}/man5/*

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

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

%if %{with static_libs}
%files static-devel
%defattr(-,root,root)
%{_libdir}/%{name}.a
%endif

%changelog
openSUSE Build Service is sponsored by