From af6e7b359a225d81ed31a9b23d6f0c40a7351dfa Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 5 Jan 2024 21:02:50 +0100 Subject: [PATCH] fix requirements of subpackages to match exact version and release added build requirements move documentation files to devel package [release 1.0.6-3mamba;Sun Aug 19 2012] --- README.md | 5 + bzip2-1.0.3-cross_compiling.patch | 11 ++ bzip2-1.0.6-bzip2recover_strncpy.patch | 13 ++ bzip2-1.0.6-cflags.patch | 20 ++ bzip2-1.0.6-makefiles.patch | 65 +++++++ bzip2.spec | 252 +++++++++++++++++++++++++ 6 files changed, 366 insertions(+) create mode 100644 bzip2-1.0.3-cross_compiling.patch create mode 100644 bzip2-1.0.6-bzip2recover_strncpy.patch create mode 100644 bzip2-1.0.6-cflags.patch create mode 100644 bzip2-1.0.6-makefiles.patch create mode 100644 bzip2.spec diff --git a/README.md b/README.md index c2419c4..f995271 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,7 @@ # bzip2 +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. + diff --git a/bzip2-1.0.3-cross_compiling.patch b/bzip2-1.0.3-cross_compiling.patch new file mode 100644 index 0000000..5b1fb61 --- /dev/null +++ b/bzip2-1.0.3-cross_compiling.patch @@ -0,0 +1,11 @@ +--- bzip2-1.0.3/Makefile 2005-09-22 09:40:09.000000000 +0200 ++++ bzip2-1.0.3-fix/Makefile 2005-09-22 09:40:42.000000000 +0200 +@@ -22,7 +22,7 @@ + decompress.o \ + bzlib.o + +-all: libbz2.a bzip2 bzip2recover test ++all: libbz2.a bzip2 bzip2recover + + bzip2: libbz2.a bzip2.o + $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2 diff --git a/bzip2-1.0.6-bzip2recover_strncpy.patch b/bzip2-1.0.6-bzip2recover_strncpy.patch new file mode 100644 index 0000000..d63fa64 --- /dev/null +++ b/bzip2-1.0.6-bzip2recover_strncpy.patch @@ -0,0 +1,13 @@ +diff -pur bzip2-1.0.6//bzip2recover.c bzip2-1.0.6-fix//bzip2recover.c +--- bzip2-1.0.6//bzip2recover.c 2010-09-11 01:18:40.000000000 +0200 ++++ bzip2-1.0.6-fix//bzip2recover.c 2010-09-24 19:44:12.000000000 +0200 +@@ -309,7 +309,8 @@ Int32 main ( Int32 argc, Char** argv ) + UInt32 buffHi, buffLo, blockCRC; + Char* p; + +- strcpy ( progName, argv[0] ); ++ strncpy ( progName, argv[0], BZ_MAX_FILENAME-1); ++ progName[BZ_MAX_FILENAME-1]='\0'; + inFileName[0] = outFileName[0] = 0; + + fprintf ( stderr, diff --git a/bzip2-1.0.6-cflags.patch b/bzip2-1.0.6-cflags.patch new file mode 100644 index 0000000..9fbbb31 --- /dev/null +++ b/bzip2-1.0.6-cflags.patch @@ -0,0 +1,20 @@ +--- bzip2-1.0.6/Makefile-libbz2_so 2010-09-11 01:07:52.000000000 +0200 ++++ bzip2-1.0.6-fix/Makefile-libbz2_so 2010-09-24 19:37:14.000000000 +0200 +@@ -24,7 +24,7 @@ + SHELL=/bin/sh + CC=gcc + BIGFILES=-D_FILE_OFFSET_BITS=64 +-CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES) ++CFLAGS=-fpic -fPIC -Wall -Winline -O2 $(BIGFILES) + + OBJS= blocksort.o \ + huffman.o \ +@@ -35,7 +35,7 @@ + bzlib.o + + all: $(OBJS) +- $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 $(OBJS) ++ $(CC) $(CFLAGS) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 $(OBJS) + $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.6 + rm -f libbz2.so.1.0 + ln -s libbz2.so.1.0.6 libbz2.so.1.0 diff --git a/bzip2-1.0.6-makefiles.patch b/bzip2-1.0.6-makefiles.patch new file mode 100644 index 0000000..d5f9e97 --- /dev/null +++ b/bzip2-1.0.6-makefiles.patch @@ -0,0 +1,65 @@ +diff -pur bzip2-1.0.6//Makefile bzip2-1.0.6-fix//Makefile +--- bzip2-1.0.6//Makefile 2010-09-11 00:46:02.000000000 +0200 ++++ bzip2-1.0.6-fix//Makefile 2010-09-24 19:56:16.000000000 +0200 +@@ -72,8 +72,8 @@ test: bzip2 + install: bzip2 bzip2recover + if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi + if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi +- if ( test ! -d $(PREFIX)/man ) ; then mkdir -p $(PREFIX)/man ; fi +- if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir -p $(PREFIX)/man/man1 ; fi ++ if ( test ! -d $(PREFIX)/share/man ) ; then mkdir -p $(PREFIX)/share/man ; fi ++ if ( test ! -d $(PREFIX)/share/man/man1 ) ; then mkdir -p $(PREFIX)/share/man/man1 ; fi + if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi + cp -f bzip2 $(PREFIX)/bin/bzip2 + cp -f bzip2 $(PREFIX)/bin/bunzip2 +@@ -83,8 +83,8 @@ install: bzip2 bzip2recover + chmod a+x $(PREFIX)/bin/bunzip2 + chmod a+x $(PREFIX)/bin/bzcat + chmod a+x $(PREFIX)/bin/bzip2recover +- cp -f bzip2.1 $(PREFIX)/man/man1 +- chmod a+r $(PREFIX)/man/man1/bzip2.1 ++ cp -f bzip2.1 $(PREFIX)/share/man/man1 ++ chmod a+r $(PREFIX)/share/man/man1/bzip2.1 + cp -f bzlib.h $(PREFIX)/include + chmod a+r $(PREFIX)/include/bzlib.h + cp -f libbz2.a $(PREFIX)/lib +@@ -99,14 +99,14 @@ install: bzip2 bzip2recover + cp -f bzdiff $(PREFIX)/bin/bzdiff + ln -s -f $(PREFIX)/bin/bzdiff $(PREFIX)/bin/bzcmp + chmod a+x $(PREFIX)/bin/bzdiff +- cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/man/man1 +- chmod a+r $(PREFIX)/man/man1/bzgrep.1 +- chmod a+r $(PREFIX)/man/man1/bzmore.1 +- chmod a+r $(PREFIX)/man/man1/bzdiff.1 +- echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzegrep.1 +- echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzfgrep.1 +- echo ".so man1/bzmore.1" > $(PREFIX)/man/man1/bzless.1 +- echo ".so man1/bzdiff.1" > $(PREFIX)/man/man1/bzcmp.1 ++ cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/share/man/man1 ++ chmod a+r $(PREFIX)/share/man/man1/bzgrep.1 ++ chmod a+r $(PREFIX)/share/man/man1/bzmore.1 ++ chmod a+r $(PREFIX)/share/man/man1/bzdiff.1 ++ echo ".so man1/bzgrep.1" > $(PREFIX)/share/man/man1/bzegrep.1 ++ echo ".so man1/bzgrep.1" > $(PREFIX)/share/man/man1/bzfgrep.1 ++ echo ".so man1/bzmore.1" > $(PREFIX)/share/man/man1/bzless.1 ++ echo ".so man1/bzdiff.1" > $(PREFIX)/share/man/man1/bzcmp.1 + + clean: + rm -f *.o libbz2.a bzip2 bzip2recover \ +diff -pur bzip2-1.0.6//Makefile-libbz2_so bzip2-1.0.6-fix//Makefile-libbz2_so +--- bzip2-1.0.6//Makefile-libbz2_so 2010-09-24 19:45:23.000000000 +0200 ++++ bzip2-1.0.6-fix//Makefile-libbz2_so 2010-09-24 19:57:28.000000000 +0200 +@@ -40,6 +40,13 @@ all: $(OBJS) + rm -f libbz2.so.1.0 + ln -s libbz2.so.1.0.6 libbz2.so.1.0 + ++install: all ++ if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi ++ if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi ++ cp bzip2-shared $(PREFIX)/bin/bzip2-shared ++ cp libbz2.so.1.0.6 $(PREFIX)/lib/libbz2.so.1.0.6 ++ chmod a+r $(PREFIX)/lib/libbz2.so.1.0.6 ++ + clean: + rm -f $(OBJS) bzip2.o libbz2.so.1.0.6 libbz2.so.1.0 bzip2-shared + diff --git a/bzip2.spec b/bzip2.spec new file mode 100644 index 0000000..759c078 --- /dev/null +++ b/bzip2.spec @@ -0,0 +1,252 @@ +%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 +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 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 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 1.0.6-1mamba +- update to 1.0.6 + +* Tue Mar 18 2008 Aleph0 1.0.5-1mamba +- update to 1.0.5 (Security fix against CERT-FI 20469) + +* Tue Sep 18 2007 Aleph0 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 1.0.3-6qilnx +- working fix: libbz2 is now a PIC library + +* Mon Feb 06 2006 Davide Madrisan 1.0.3-5qilnx +- compile libbz2 using the flags "-fpic -fPIC" + +* Thu Sep 22 2005 Davide Madrisan 1.0.3-4qilnx +- security fix QSA-2005-109 (CAN-2005-0758) + +* Wed Sep 14 2005 Silvan Calarco 1.0.3-3qilnx +- add cross platform build support + +* Fri May 27 2005 Davide Madrisan 1.0.3-2qilnx +- security fix QSA-2005-068 (CAN-2005-0953) + +* Wed Mar 02 2005 Davide Madrisan 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 +- moved files from /bin to %{_bindir}, made symlinks to /bin + +* Tue Apr 08 2003 Mirko Cortillaro +- write a spec file for bzip2