bzip2/bzip2.spec

253 lines
8.0 KiB
RPMSpec
Raw Permalink Normal View History

%define libname libbzip2
Name: bzip2
Version: 1.0.6
Release: 3mamba
Summary: Extremely powerful file compression utility
Group: Applications/Archiving
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://www.bzip.org/
Source: http://www.bzip.org/%{version}/bzip2-%{version}.tar.gz
Patch0: %{name}-1.0.6-cflags.patch
Patch1: %{name}-1.0.6-makefiles.patch
Patch4: %{name}-1.0.3-cross_compiling.patch
Patch5: %{name}-1.0.6-bzip2recover_strncpy.patch
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
## AUTOBUILDREQ-END
%ifarch x86_64_disabled
BuildRequires: gcc-multilib
BuildRequires: glibc-multilib-devel
%endif
License: BSD
Requires: %{libname} = %{?epoch:%epoch:}%{version}-%{release}
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
Bzip2 compresses files using the Burrows-Wheeler block-sorting text compression algorithm, and Huffman coding.
Compression is generally considerably better than that achieved by more conventional LZ77/LZ78-based compressors, and approaches the performance of the PPM family of statistical compressors.
The command-line options are deliberately very similar to those of GNU Gzip, but they are not identical.
%package -n %{libname}
Summary: Libraries for developing apps which will use bzip2
Group: System/Libraries
%description -n %{libname}
Library of bzip2 functions, for developing apps which will use the bzip2 library (aka libz2).
%package -n %{libname}-devel
Summary: Header files for developing apps which will use bzip2
Group: Development/Libraries
Requires: %{libname} = %{?epoch:%epoch:}%{version}-%{release}
%description -n %{libname}-devel
Header files and static library of bzip2 functions, for developing apps which will use the bzip2 library (aka libz2).
%package -n lib32-%{libname}
Summary: Libraries for developing apps which will use bzip2 (32bit)
Group: System/Libraries
%description -n lib32-%{libname}
Library of bzip2 functions, for developing apps which will use the bzip2 library (aka libz2).
%package -n lib32-%{libname}-devel
Summary: Header files for developing apps which will use bzip2 (32 bit)
Group: Development/Libraries
Requires: lib32-%{libname} = %{?epoch:%epoch:}%{version}-%{release}
Requires: %{libname}-devel = %{?epoch:%epoch:}%{version}-%{release}
%description -n lib32-%{libname}-devel
Header files and static library of bzip2 functions, for developing apps which will use the bzip2 library (aka libz2).
%prep
%setup -q
%patch0 -p1 -b .cflags
%patch1 -p1 -b .makefiles
%if "%{_target_platform}" != "%{_build}"
%patch4 -p1 -b .cross_compiling
%endif
%patch5 -p1 -b bzip2recover_strncpy
# x86_64 lib64 support
sed -i "s@/lib\(/\| \|$\)@/%{_lib}\1@g" Makefile Makefile-libbz2_so
%build
%make -f Makefile-libbz2_so \
CFLAGS="%{optflags} -D_FILE_OFFSET_BITS=64 -fpic -fPIC" \
CC=%{_target_platform}-gcc \
AR=%{_target_platform}-ar \
RANLIB=%{_target_platform}-ranlib
#rm -f *.o
%make \
CFLAGS="%{optflags} -D_FILE_OFFSET_BITS=64" \
CC=%{_target_platform}-gcc \
AR=%{_target_platform}-ar \
RANLIB=%{_target_platform}-ranlib
%install
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
make install PREFIX=%{buildroot}%{_prefix}
make install -f Makefile-libbz2_so \
CC=%{_target_platform}-gcc \
AR=%{_target_platform}-ar \
RANLIB=%{_target_platform}-ranlib \
PREFIX=%{buildroot}%{_prefix}
mv %{buildroot}%{_bindir}/bzip2-shared %{buildroot}%{_bindir}/bzip2
rm -f %{buildroot}%{_bindir}/{bunzip2,bzcat}
ln -s bzip2 %{buildroot}%{_bindir}/bunzip2
ln -s bzip2 %{buildroot}%{_bindir}/bzcat
rm -f %{buildroot}%{_bindir}/bzcmp
ln -s bzdiff %{buildroot}%{_bindir}/bzcmp
rm -f %{buildroot}%{_bindir}/bzless
ln -s bzmore %{buildroot}%{_bindir}/bzless
ln -s bzip2.1 %{buildroot}%{_mandir}/man1/bzip2recover.1
ln -s bzip2.1 %{buildroot}%{_mandir}/man1/bunzip2.1
ln -s bzip2.1 %{buildroot}%{_mandir}/man1/bzcat.1
rm -f %{buildroot}%{_mandir}/man1/bzless.1
ln -s bzmore.1 %{buildroot}%{_mandir}/man1/bzless.1
# fix broken symlinks
ln -sf bzgrep %{buildroot}%{_bindir}/bzegrep
ln -sf bzgrep %{buildroot}%{_bindir}/bzfgrep
# make links needed for compatibility pointing to %buildroot
install -d %{buildroot}/bin
ln -s %{_bindir}/bzip2 %{buildroot}/bin/bzip2
ln -s %{_bindir}/bzip2 %{buildroot}/bin/bunzip2
ln -s %{_bindir}/bzip2 %{buildroot}/bin/bzcat
ln -s libbz2.so.1.0 %{buildroot}%{_libdir}/libbz2.so
ln -s libbz2.so.%{version} %{buildroot}%{_libdir}/libbz2.so.1.0
%ifarch x86_64_disabled
# x86_64 lib64 support
sed -i "s@/%{_lib}\(/\| \|$\)@/\/lib\1@g" Makefile-libbz2_so
make -f Makefile-libbz2_so clean
%make -f Makefile-libbz2_so \
CFLAGS="%{optflags} -D_FILE_OFFSET_BITS=64 -fpic -fPIC -m32" \
CC=%{_target_platform}-gcc \
AR=%{_target_platform}-ar \
RANLIB=%{_target_platform}-ranlib
install -D -m0755 libbz2.so.%{version} %{buildroot}%{_prefix}/lib/libbz2.so.%{version}
ln -s libbz2.so.1.0 %{buildroot}%{_prefix}/lib/libbz2.so
ln -s libbz2.so.%{version} %{buildroot}%{_prefix}/lib/libbz2.so.1.0
%endif
%clean
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%files
%defattr(-,root,root)
/bin/bunzip2
/bin/bzcat
/bin/bzip2
%{_bindir}/bunzip2
%{_bindir}/bzcat
%{_bindir}/bzcmp
%{_bindir}/bzdiff
%{_bindir}/bzegrep
%{_bindir}/bzfgrep
%{_bindir}/bzgrep
%{_bindir}/bzip2
%{_bindir}/bzip2recover
%{_bindir}/bzless
%{_bindir}/bzmore
%{_mandir}/man1/bunzip2.*
%{_mandir}/man1/bzcat.*
%{_mandir}/man1/bzcmp.*
%{_mandir}/man1/bzdiff.*
%{_mandir}/man1/bzegrep.*
%{_mandir}/man1/bzfgrep.*
%{_mandir}/man1/bzgrep.*
%{_mandir}/man1/bzip2.*
%{_mandir}/man1/bzip2recover.*
%{_mandir}/man1/bzless.*
%{_mandir}/man1/bzmore.*
%files -n %{libname}
%defattr(-,root,root)
%{_libdir}/libbz2.so.*
%doc LICENSE
%files -n %{libname}-devel
%defattr(-,root,root)
%{_includedir}/bzlib.h
%{_libdir}/libbz2.a
%{_libdir}/libbz2.so
%doc CHANGES README README.XML.STUFF
%ifarch x86_64_disabled
%files -n lib32-%{libname}
%defattr(-,root,root)
%{_prefix}/lib/libbz2.so.*
%files -n lib32-%{libname}-devel
%defattr(-,root,root)
%{_prefix}/lib/libbz2.so
%endif
%changelog
* Sun Aug 19 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.6-3mamba
- fix requirements of subpackages to match exact version and release
- added build requirements
- move documentation files to devel package
* Sun Feb 13 2011 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.6-2mamba
- don't remove object files during two make or it will build libbz2 without -fpic
* Fri Sep 24 2010 Davide Madrisan <davide.madrisan@gmail.com> 1.0.6-1mamba
- update to 1.0.6
* Tue Mar 18 2008 Aleph0 <aleph0@openmamba.org> 1.0.5-1mamba
- update to 1.0.5 (Security fix against CERT-FI 20469)
* Tue Sep 18 2007 Aleph0 <aleph0@openmamba.org> 1.0.4-1mamba
- update to 1.0.4 (fixes CAN-2005-0758, CAN-2005-0953)
- make bzcmp a symlink to bzdiff
- add manpages (just symlinks) for bunzip2, bzcat, and bzip2recover
- fix buffer overflow in bzip2recover
- remove bzip2-1.0.2-chmod.patch (merged upstream)
* Wed Feb 15 2006 Davide Madrisan <davide.madrisan@qilinux.it> 1.0.3-6qilnx
- working fix: libbz2 is now a PIC library
* Mon Feb 06 2006 Davide Madrisan <davide.madrisan@qilinux.it> 1.0.3-5qilnx
- compile libbz2 using the flags "-fpic -fPIC"
* Thu Sep 22 2005 Davide Madrisan <davide.madrisan@qilinux.it> 1.0.3-4qilnx
- security fix QSA-2005-109 (CAN-2005-0758)
* Wed Sep 14 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.3-3qilnx
- add cross platform build support
* Fri May 27 2005 Davide Madrisan <davide.madrisan@qilinux.it> 1.0.3-2qilnx
- security fix QSA-2005-068 (CAN-2005-0953)
* Wed Mar 02 2005 Davide Madrisan <davide.madrisan@qilinux.it> 1.0.3-1qilnx
- update to version 1.0.3 by autospec
- bzless is now a symlinks to bzmore
- added basic documentation
- specfile cleanups
* Sat Apr 26 2003 Silvan Calarco <silvan.calarco@qinet.it>
- moved files from /bin to %{_bindir}, made symlinks to /bin
* Tue Apr 08 2003 Mirko Cortillaro <mirko.cortillaro@qinet.it>
- write a spec file for bzip2