File pixz.spec of Package pixz

#
# spec file for package pixz
#
# Copyright (c) 2013 SUSE LINUX Products 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}
%define	use_static_libs 1
%define patch_missing_endianess_functions 1
%else
%define use_static_libs 0
%define patch_missing_endianess_functions 0
%endif

Name:           pixz
Version:        1.0.2
Release:        0
Summary:        Parallel, indexing version of XZ
License:        BSD-2-Clause
Group:          Productivity/Archiving/Compression
Url:            https://github.com/vasi/pixz
Source:         http://sourceforge.net/projects/pixz/files/pixz-%{version}.tgz
Patch1:         pixz-underlinking.patch
Patch2:         pixz-use-static.patch
Patch3:         pixz-endianess-functions.patch
%if 0%{?use_static_libs}
BuildRequires:  libarchive-static-devel >= 2.8
BuildRequires:  xz-static-devel >= 4.999.9-beta-212
%else
BuildRequires:  libarchive-devel
BuildRequires:  xz-devel
%endif

BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The existing XZ Utils ( http://tukaani.org/xz/ ) provide great compression in the .xz file format, 
but they have two significant problems:

* They are single-threaded, while most users nowadays have multi-core computers.
* The .xz files they produce are just one big block of compressed data, 
  rather than a collection of smaller blocks. This makes random access to the original data impossible.

%prep
%setup -q
%patch1 -p1
%if 0%{?use_static_libs}
%patch2 -p1
%endif
%if 0%{?patch_missing_endianess_functions}
%patch3 -p1
%endif

%build
make %{?_smp_mflags} CFLAGS="%{optflags}"

%install
mkdir -p %{buildroot}/%{_bindir}
mkdir -p %{buildroot}/%{_mandir}/man1/

install -m 0755 pixz %{buildroot}/%{_bindir}/pixz
install -m 0644 pixz.1 %{buildroot}/%{_mandir}/man1/pixz.1

%files
%defattr(-,root,root)
%doc TODO README LICENSE
%{_bindir}/pixz
%{_mandir}/man1/pixz.1.gz

%changelog