File bzip2.spec of Package bzip2

#
# spec file for package bzip2 (Version 1.0.5)
#
# Copyright (c) 2010 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/
#

# norootforbuild


Name:           bzip2
Version:        1.0.5
Release:        36.<RELEASE7>
Provides:       bzip 
Obsoletes:      bzip
# The following is a kludge to get updating bzip2 to after the split work
PreReq:         libbz2-1
AutoReqProv:    on
# bug437293
%ifarch ppc64
Obsoletes:      bzip2-64bit
%endif
#
Group:          Productivity/Archiving/Compression
License:        BSD3c
Url:            http://www.bzip.org/
Summary:        A Program for Compressing Files
Source:         bzip2-%{version}.tar.gz
Source1:        bznew.gz
Source2:        bznew.1.gz
Source100:      rpmlintrc
Patch1:         bzip2-shared_lib.patch
Patch2:         bzip2-maxlen20.patch
Patch3:         bzip2-faster.patch
Patch4:         bzip2-cflags.patch
Patch5:         bzip2-unsafe_strcpy.patch
Patch6:         bzip2-CVE-2010-0405.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The bzip2 program is a very powerful program for compressing files.



Authors:
--------
    Julian Seward <jseward@acm.org>

%package doc
License:        BSD3c
Summary:        The bzip2 program and Library Documentation
Group:          Productivity/Archiving/Compression

%description doc
The bzip2 program and library documentation.



Authors:
--------
    Julian Seward <jseward@acm.org>

%package -n libbz2-1
License:        BSD3c
Summary:        The bzip2 runtime library
Group:          Productivity/Archiving/Compression

%description -n libbz2-1
The bzip2 runtime library



Authors:
--------
    Julian Seward <jseward@acm.org>

%package -n libbz2-devel
License:        BSD3c
Summary:        The bzip2 runtime library development files
Group:          Development/Libraries/Other
Requires:       libbz2-1 = %{version} glibc-devel

%description -n libbz2-devel
The bzip2 runtime library development files.



Authors:
--------
    Julian Seward <jseward@acm.org>

%prep
%setup -q
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6 -p1

%build
profile_bzip2()
{
    tmpfile=$(mktemp)
    trap "rm -f $tmpfile $tmpfile.gz" EXIT
    tar -cjf $tmpfile.bz2 /usr/src || true
   # time ./bzip2 $tmpfile
    export LD_PRELOAD=$PWD/libbz2.so
    time ./bzip2 -d < $tmpfile.bz2 > /dev/null
    unset LD_PRELOAD
}
export CFLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64 -Wall -Winline -fpic"
%if %{do_profiling}
make CFLAGS="$CFLAGS %{cflags_profile_generate}" LIBDIR=%{_libdir} %{?jobs:-j %jobs} bzip2
profile_bzip2
make clean
make CFLAGS="$CFLAGS %{cflags_profile_feedback}" LIBDIR=%{_libdir} %{?jobs:-j %jobs} bzip2
%endif
make CFLAGS="$CFLAGS" LIBDIR=%{_libdir} %{?jobs:-j %jobs}

%install
make PREFIX=$RPM_BUILD_ROOT%{_prefix} MANDIR=$RPM_BUILD_ROOT%{_mandir} \
     LIBDIR=$RPM_BUILD_ROOT%{_libdir} install
gzip -9 manual.ps
gzip -dc %{SOURCE1} > bznew
install -D -m 755 bznew      $RPM_BUILD_ROOT%{_bindir}/bznew
install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man1
install -m 755 -d $RPM_BUILD_ROOT/%{_lib}/
mv $RPM_BUILD_ROOT%{_libdir}/libbz2.so $RPM_BUILD_ROOT/%{_lib}/libbz2.so.%{version}
ln -sf libbz2.so.%{version} $RPM_BUILD_ROOT/%{_lib}/libbz2.so.1
ln -sf ../../%{_lib}/libbz2.so.%{version} $RPM_BUILD_ROOT%{_libdir}/libbz2.so
# installing bzgrep, bzdiff and bzmore scripts bnc#376464
mkdir -p $RPM_BUILD_ROOT%{_bindir}
install -m 755 bzgrep bzdiff bzmore $RPM_BUILD_ROOT%{_bindir}
install -m 644 bzgrep.1 bzdiff.1 bzmore.1 $RPM_BUILD_ROOT%{_mandir}/man1
ln -s bzdiff $RPM_BUILD_ROOT%{_bindir}/bzcmp
ln -s bzmore $RPM_BUILD_ROOT%{_bindir}/bzless
ln -s bzdiff.1 $RPM_BUILD_ROOT%{_mandir}/man1/bzcmp.1
ln -s bzmore.1 $RPM_BUILD_ROOT%{_mandir}/man1/bzless.1
%{__rm} -rf %{buildroot}%{_libdir}/*.a

%clean
rm -rf $RPM_BUILD_ROOT

%post -n libbz2-1 -p /sbin/ldconfig

%postun -n libbz2-1  -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc README LICENSE CHANGES
%doc %{_mandir}/man1/*
%{_bindir}/*

%files doc
%defattr(-,root,root)
%doc manual.ps.gz manual*.html

%files -n libbz2-1
%defattr(-,root,root)
%doc README LICENSE CHANGES
/%{_lib}/libbz2.so.1
/%{_lib}/libbz2.so.1.*

%files -n libbz2-devel
%defattr(-,root,root)
%{_includedir}/bzlib.h
%{_libdir}/libbz2.so

%changelog
openSUSE Build Service is sponsored by