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.6
Release:        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

%__make %{?_smp_flags} \
    OPTFLAGS="%{optflags} -Wall" \
    PREFIX="%{_prefix}" \
    BINDIR="%{_bindir}" \
    MANDIR="%{_mandir}" \
    all

%install
%__make \
    DESTDIR="%{buildroot}" \
    PREFIX="%{_prefix}" \
    BINDIR="%{_bindir}" \
    MANDIR="%{_mandir}" \
    install

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
openSUSE Build Service is sponsored by