File pbzip2.spec of Package pbzip2

#
# spec file for package pbzip2
#
# Copyright (c) 2011 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/
#



Name:           pbzip2
Version:        1.1.9
Release:        1.1
%define pkg_version %{version}
License:        BSD-4-Clause
Summary:        Parallelized Implementation of bzip2
Url:            http://compression.ca/pbzip2/
Group:          Productivity/Archiving/Compression
Source:         http://compression.ca/pbzip2/pbzip2-%{pkg_version}.tar.gz
Source1:        macros.pbzip2.in
# pbleser: add support for DESTDIR, MANDIR, BINDIR and OPTFLAGS in Makefile
Patch1:         pbzip2-makefile.patch
# pbleser: fix printf format specifications for size_t and such
Patch2:         pbzip2-fix_printf_format.patch
# pbleser: fix not using the result value of fwrite()
Patch3:         pbzip2-fix_unused_result.patch
BuildRequires:  gcc-c++
BuildRequires:  libbz2-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
PBZIP2 is a parallel implementation of the bzip2 block-sorting file
compressor that uses pthreads and achieves near-linear speedup on SMP
machines.

%prep
%setup -q -n "%{name}-%{pkg_version}"
#%patch1
#%patch2
%patch3

%build
export SUSE_ASNEEDED=0

CXXFLAGS="%{optflags}" CFLAGS="%{optflags}" LDFLAGS="%{?__global_ldflags}" make %{?_smp_mflags}

%install
rm -rf %{buildroot}
install -D -m755 %{name} %{buildroot}%{_bindir}/%{name}
install -D -m644 %{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1
ln -sf ./%{name} %{buildroot}%{_bindir}/pbunzip2
ln -sf ./%{name} %{buildroot}%{_bindir}/pbzcat

for x in pbunzip2 pbzcat; do
    %__ln_s "pbzip2.1%{ext_man}" "%{buildroot}%{_mandir}/man1/${x}.1%{ext_man}"
done

%__install -D -m 0644 "%{SOURCE1}" "%{buildroot}%{_sysconfdir}/rpm/macros.%{name}"
%__sed -i 's|@@BINDIR@@|%{_bindir}|g' "%{buildroot}%{_sysconfdir}/rpm/macros.%{name}"

%clean
%{?buildroot:%__rm -rf "%{buildroot}"}

%files
%defattr(-,root,root)
%doc AUTHORS COPYING README ChangeLog
%{_bindir}/pbzip2
%{_bindir}/pbunzip2
%{_bindir}/pbzcat
%doc %{_mandir}/man1/pbzip2.1%{ext_man}
%doc %{_mandir}/man1/pbunzip2.1%{ext_man}
%doc %{_mandir}/man1/pbzcat.1%{ext_man}
%config %{_sysconfdir}/rpm/macros.%{name}

%changelog
* Thu Nov  3 2011 pascal.bleser@opensuse.org
- update to 1.1.6:
  * fixed bug - deadlock due to unsynchronized broadcasts (bug #876686)
  * prevent deletion of input files on error (bug #874543)
  * document how to compress/decompress from standard input (bug #820525)
  * added more detailed kernel error messages (bug #874605)
  * error-handling fixes for multi-archive scenarios (bug #883782)
- use original upstream format archive .gz instead of .bz2 to avoid any
  potential chicken/egg (requires bzip2 to uncompress the pbzip2 sources)
* Thu Jul 21 2011 pascal.bleser@opensuse.org
- update to 1.1.5:
  * SECURITY FIX: fixes excessive output permissions while compress/decompress
    is in progress; it now emulates the same behaviour as bzip2
* Wed Apr 27 2011 pascal.bleser@opensuse.org
- update to 1.1.4:
  * fixes a hang on decompress with --ignore-trailing-garbage=1 when producer
    is interrupted on trailing garbage
  * adds an example to help for decompression piped to tar
  * fixes a typo in the Trailing Garbage printed message
* Tue Mar 29 2011 pascal.bleser@opensuse.org
- update to 1.1.3:
  * fixes a hang on decompress with --ignore-trailing-garbage=1 when using more
    than 2 CPUs
  * the default extension on decompress of .tbz2 has been changed to .tar for
    bzip2 compatibility
  * trailing garbage errors will now be printed even when in quiet mode
* Sat Feb 19 2011 pascal.bleser@opensuse.org
- update to 1.1.2:
  * modifies Consumer_decompress throttling to prevent potential
    deadlock/infinite loops in certain situations
  * fixes a deadlock bug and performance issue when consumer is working with
    long bzip2 sequences
  * fixes a bug which caused a hang while decompressing a prematurely truncated
    bzip2 stream
  * fixes a hang on decompression of some truncated archives
  * adds --ignore-trailing-garbage for non-standard archives such as gentoo
    packages
- reformatted changes file
* Mon Dec 20 2010 pascal.bleser@opensuse.org
- reverting to upstream release, changed version to 1.1.0+0 to be newer than
  1.1.0_git...
- add patches:
  * pbzip2-makefile.patch: adds support for BINDIR, MANDIR, DESTDIR and
    OPTFLAGS
  * pbzip2-fix_printf_format.patch: fix the many printf format errors in debug
    and error reporting statements
  * pbzip2-fix_unused_result.patch: fix not using the result value of fwrite()
- replace macros.pbzip2 with macros.pbzip2.in and a placeholder to inject the
  build time value of %%{_bindir}
- add symbolic links to the manpage for pbunzip2 and pbzcat too, thanks to
  darix for pointing this out
- changed compression of upstream tarball from xz to bzip2 in order to build on
  older openSUSE and SLE releases
* Thu Dec  9 2010 cristian.rodriguez@opensuse.org
- add an rpm macro file to overload %%__bzip2 definition
* Thu Dec  9 2010 cristian.rodriguez@opensuse.org
- Update to git snapshot, only difference is that Build
  is now using autotools.
* Tue Apr 20 2010 pascal.bleser@opensuse.org
- update to 1.1.1:
  * improves the decompression performance of long bzip2 streams of large
    single-stream bzip2 blocks
  * pbzip2 should now decompress files created with bzip2 at least as quickly
    as bzip2, or slightly faster
  * handles decompression of long bzip2 streams incrementally instead of
    loading whole streams in memory at once
* Mon Mar 15 2010 pascal.bleser@opensuse.org
- update to 1.1.0:
  * adds support for multi-threaded decompression using STDIN/pipes and
    throttling compression to prevent memory exhaustion with slow output pipe
  * fixes a bug that did not allow command line parameters to be used when
    compressing data from STDIN
  * contains major improvements to protection of shared variables, error and
    signal handling, and program termination
  * many more minor enhancements and bugfixes
* Tue Jan 13 2009 guru@unixtech.be
- update to 1.0.5:
  * this release properly complains about trying to read or write compressed
    data to the terminal, and exits
  * fixes the CPU detection crash
* Mon Dec 22 2008 guru@unixtech.be
- update to 1.0.4:
  * support was added for using pbzip2 with tar and for all remaining bzip2
    command line options, so pbzip2 can be used as a drop-in replacement for
    bzip2
  * a bug was fixed that would cause pbzip2 to crash if detection of the
    number of processors failed
* Sat Nov  1 2008 guru@unixtech.be
- update to 1.0.3:
  * the ability to compress, decompress, and test data using stdin and pipes
    is now supported
  * support was added to directly decompress files without using threads when
    files are small, the system only has 1 CPU, or if the .bz2 file contains 1
    bzip2 stream
  * can now compress 0 byte files like bzip2
  * support for pbzcat symlink to automatically specify a decompression mode
    to stdout, just like bzcat, is now included
* Thu Jul 26 2007 guru@unixtech.be
- update to 1.0.2
* Thu May 31 2007 guru@unixtech.be
- initial submission into openSUSE Build Service
openSUSE Build Service is sponsored by