summaryrefslogtreecommitdiffstats
path: root/patches
diff options
context:
space:
mode:
Diffstat (limited to 'patches')
-rw-r--r--patches/01_disable-automatic-tests.patch15
-rw-r--r--patches/01_properly-support-shared-library.patch102
2 files changed, 102 insertions, 15 deletions
diff --git a/patches/01_disable-automatic-tests.patch b/patches/01_disable-automatic-tests.patch
deleted file mode 100644
index 45eb866..0000000
--- a/patches/01_disable-automatic-tests.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Author: "P. J. McDermott" <pj@pehjota.net>
-Subject: Disable automatic tests
-
-diff -Naur src.orig/Makefile src/Makefile
---- src.orig/Makefile 2010-09-10 18:46:02.000000000 -0400
-+++ src/Makefile 2014-06-10 23:12:09.370735429 -0400
-@@ -35,7 +35,7 @@
- decompress.o \
- bzlib.o
-
--all: libbz2.a bzip2 bzip2recover test
-+all: libbz2.a bzip2 bzip2recover #test
-
- bzip2: libbz2.a bzip2.o
- $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2
diff --git a/patches/01_properly-support-shared-library.patch b/patches/01_properly-support-shared-library.patch
new file mode 100644
index 0000000..7098225
--- /dev/null
+++ b/patches/01_properly-support-shared-library.patch
@@ -0,0 +1,102 @@
+Author: "P. J. McDermott" <pj@pehjota.net>
+Subject: Properly support a shared library
+
+diff -Naur src.orig/Makefile src/Makefile
+--- src.orig/Makefile 2014-06-11 00:10:06.256905194 -0400
++++ src/Makefile 2014-06-11 04:47:04.550730273 -0400
+@@ -23,6 +23,9 @@
+ BIGFILES=-D_FILE_OFFSET_BITS=64
+ CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)
+
++SONAME=libbz2.so.1.0
++VERSION=1.0.6
++
+ # Where you want it installed when you do 'make install'
+ PREFIX=/usr/local
+
+@@ -35,14 +38,17 @@
+ decompress.o \
+ bzlib.o
+
+-all: libbz2.a bzip2 bzip2recover test
++all: libbz2.so.$(VERSION) libbz2.a bzip2 bzip2recover
+
+-bzip2: libbz2.a bzip2.o
++bzip2: libbz2.so.$(VERSION) bzip2.o
+ $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2
+
+ bzip2recover: bzip2recover.o
+ $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2recover bzip2recover.o
+
++libbz2.so.$(VERSION): $(OBJS:.o=.sho)
++ $(CC) -o $@ -shared -Wl,-soname,$(SONAME) $(OBJS:.o=.sho) -lc
++
+ libbz2.a: $(OBJS)
+ rm -f libbz2.a
+ $(AR) cq libbz2.a $(OBJS)
+@@ -55,11 +61,17 @@
+ check: test
+ test: bzip2
+ @cat words1
++ LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH \
+ ./bzip2 -1 < sample1.ref > sample1.rb2
++ LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH \
+ ./bzip2 -2 < sample2.ref > sample2.rb2
++ LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH \
+ ./bzip2 -3 < sample3.ref > sample3.rb2
++ LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH \
+ ./bzip2 -d < sample1.bz2 > sample1.tst
++ LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH \
+ ./bzip2 -d < sample2.bz2 > sample2.tst
++ LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH \
+ ./bzip2 -ds < sample3.bz2 > sample3.tst
+ cmp sample1.bz2 sample1.rb2
+ cmp sample2.bz2 sample2.rb2
+@@ -87,6 +99,8 @@
+ chmod a+r $(PREFIX)/man/man1/bzip2.1
+ cp -f bzlib.h $(PREFIX)/include
+ chmod a+r $(PREFIX)/include/bzlib.h
++ cp -f libbz2.so.$(VERSION) $(PREFIX)/lib
++ chmod a+r $(PREFIX)/lib/libbz2.so.$(VERSION)
+ cp -f libbz2.a $(PREFIX)/lib
+ chmod a+r $(PREFIX)/lib/libbz2.a
+ cp -f bzgrep $(PREFIX)/bin/bzgrep
+@@ -109,29 +123,20 @@
+ echo ".so man1/bzdiff.1" > $(PREFIX)/man/man1/bzcmp.1
+
+ clean:
+- rm -f *.o libbz2.a bzip2 bzip2recover \
++ rm -f *.o *.sho libbz2.so* libbz2.a bzip2 bzip2recover \
+ sample1.rb2 sample2.rb2 sample3.rb2 \
+ sample1.tst sample2.tst sample3.tst
+
+-blocksort.o: blocksort.c
++.SUFFIXES:
++.SUFFIXES: .c .o .sho
++
++blocksort.sho: blocksort.c
+ @cat words0
+ $(CC) $(CFLAGS) -c blocksort.c
+-huffman.o: huffman.c
+- $(CC) $(CFLAGS) -c huffman.c
+-crctable.o: crctable.c
+- $(CC) $(CFLAGS) -c crctable.c
+-randtable.o: randtable.c
+- $(CC) $(CFLAGS) -c randtable.c
+-compress.o: compress.c
+- $(CC) $(CFLAGS) -c compress.c
+-decompress.o: decompress.c
+- $(CC) $(CFLAGS) -c decompress.c
+-bzlib.o: bzlib.c
+- $(CC) $(CFLAGS) -c bzlib.c
+-bzip2.o: bzip2.c
+- $(CC) $(CFLAGS) -c bzip2.c
+-bzip2recover.o: bzip2recover.c
+- $(CC) $(CFLAGS) -c bzip2recover.c
++.c.o:
++ $(CC) $(CFLAGS) -D_REENTRANT -c -o $@ $<
++.c.sho:
++ $(CC) $(CFLAGS) -D_REENTRANT -fPIC -c -o $@ $<
+
+
+ distclean: clean