File bzip2.spec of Package bzip2

#
# spec file for package bzip2 (version 1.0.5)
#
# Copyright (c) Lincom Software Team. All spec files
# are released under the CC-BY-NC-ND, version 3 United States.
#

# Basic Information
Name:		bzip2
Version:	1.0.5
Release:	2%{?dist}
Summary:	High Quality Data Compressor
Group:		Applications/Archiving
License:	BSD
URL:		http://www.bzip.org/

# Source Information
Source0:	http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz
Patch0:		http://www.linuxfromscratch.org/patches/lfs/development/bzip2-1.0.5-install_docs-1.patch
Patch1:		http://cvs.fedoraproject.org/viewvc/devel/bzip2/bzip2-1.0.4-cflags.patch
Patch2:		http://cvs.fedoraproject.org/viewvc/devel/bzip2/bzip2-1.0.4-saneso.patch

# Build Information
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires:	%{name}-libs = %{version}-%{release}

%description
Bzip2 is a freely available, patent-free, high quality data compressor.
Bzip2 compresses files to within 10 to 15 percent of the capabilities 
of the best techniques available.  However, bzip2 has the added benefit 
of being approximately two times faster at compression and six times 
faster at decompression than those techniques.  Bzip2 is not the 
fastest compression utility, but it does strike a balance between speed 
and compression capability.

Install bzip2 if you need a compression utility.

%package devel
Summary: Header files developing apps which will use bzip2
Group: Development/Libraries
Requires: bzip2-libs = %{version}-%{release}

%description devel

Header files and a library of bzip2 functions, for developing apps
which will use the library.

%package libs
Summary: Libraries for applications using bzip2
Group: System Environment/Libraries
Provides: libbz2.so.1

%description libs

Libraries for applications using the bzip2 compression format.

%prep
%setup -q
%patch0 -p1
#%patch1 -p1
%patch2 -p1
sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile

%build
make -f Makefile-libbz2_so %{?_smp_mflags}
rm -f *.o
make %{?_smp_mflags}

%install
rm -rf %{buildroot}
make install PREFIX=%{buildroot}/usr
mkdir -pv %{buildroot}/bin
cp -v bzip2-shared %{buildroot}/bin/bzip2
%ifarch x86_64
mkdir -v %{buildroot}/%{_libdir}
mv -v %{buildroot}/usr/lib/libbz2.a %{buildroot}/%{_libdir}
%endif
mkdir -v %{buildroot}/%{_lib}
cp -av libbz2.so* %{buildroot}/%{_lib}
mkdir -pv %{buildroot}/%{_libdir}
ln -sfv ../../%{_lib}/libbz2.so.1 %{buildroot}/%{_libdir}/libbz2.so
ln -sfv ../../%{_lib}/libbz2.so.1 %{buildroot}/%{_libdir}/libbz2.so.1
rm -v %{buildroot}/usr/bin/{bunzip2,bzcat}
#cd %{buildroot}/bin
ln -sv bzip2 %{buildroot}/bin/bunzip2
ln -sv bzip2 %{buildroot}/bin/bzcat

mkdir -pv %{buildroot}%{_mandir}/man1
mv -v %{buildroot}/usr/man/man1/bz* %{buildroot}%{_mandir}/man1/


%post libs -p /sbin/ldconfig

%postun libs  -p /sbin/ldconfig

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%doc LICENSE CHANGES README 
%{_bindir}/*
%{_mandir}/*/*
/bin/bunzip2
/bin/bzcat
/bin/bzip2

%files libs
%defattr(-,root,root,-)
/%{_lib}/*so.*
%{_libdir}/*so*
%{_libdir}/libbz2.a

%files devel
%defattr(-,root,root,-)
%doc manual.html manual.pdf
%{_includedir}/*
/%{_libdir}/*so

%changelog
* Sat Dec 26 2009 Robert Xu <robxu9@gmail.com> 1.0.5-2
- Comparison with major distributions
- Added/Split subpackages
* Sun Nov 14 2009 Robert Xu <robxu9@gmail.com> 1.0.5-1
- Created Initial Spec File.
openSUSE Build Service is sponsored by