xref: /OK3568_Linux_fs/buildroot/package/bzip2/0002-improve-build-system.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1Improve bzip2 build system
2
3This patch makes a number of improvements to the bzip2 build system:
4
5 * Remove the BIGFILE variable that was used to force largefile
6   support. Now, the user of the Makefile is supposed to pass
7   -D_FILE_OFFSET_BITS=64 when largefile support is desired.
8
9 * Use override CFLAGS += so that additional CFLAGS can be passed on
10   the command line.
11
12 * Removed "forced" CFLAGS -O2, -g and -Winline. We don't want them by
13   default, and want the build system to use its own ones.
14
15 * When creating the symbolic links bzegrep, bzfgrep, bzless and
16   bzcmp, don't link them to an absolute path, or they'll point to
17   some path on the build machine.
18
19 * Provide an install target for the shared library, which creates the
20   appropriate symbolic links.
21
22Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
23
24Index: b/Makefile
25===================================================================
26--- a/Makefile
27+++ b/Makefile
28@@ -20,8 +20,7 @@
29 RANLIB=ranlib
30 LDFLAGS=
31
32-BIGFILES=-D_FILE_OFFSET_BITS=64
33-CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)
34+override CFLAGS += -Wall
35
36 # Where you want it installed when you do 'make install'
37 PREFIX=/usr/local
38@@ -90,14 +89,14 @@
39 	cp -f libbz2.a $(PREFIX)/lib
40 	chmod a+r $(PREFIX)/lib/libbz2.a
41 	cp -f bzgrep $(PREFIX)/bin/bzgrep
42-	ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep
43-	ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzfgrep
44+	ln -s -f bzgrep $(PREFIX)/bin/bzegrep
45+	ln -s -f bzgrep $(PREFIX)/bin/bzfgrep
46 	chmod a+x $(PREFIX)/bin/bzgrep
47 	cp -f bzmore $(PREFIX)/bin/bzmore
48-	ln -s -f $(PREFIX)/bin/bzmore $(PREFIX)/bin/bzless
49+	ln -s -f bzmore $(PREFIX)/bin/bzless
50 	chmod a+x $(PREFIX)/bin/bzmore
51 	cp -f bzdiff $(PREFIX)/bin/bzdiff
52-	ln -s -f $(PREFIX)/bin/bzdiff $(PREFIX)/bin/bzcmp
53+	ln -s -f bzdiff $(PREFIX)/bin/bzcmp
54 	chmod a+x $(PREFIX)/bin/bzdiff
55 	cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/man/man1
56 	chmod a+r $(PREFIX)/man/man1/bzgrep.1
57Index: b/Makefile-libbz2_so
58===================================================================
59--- a/Makefile-libbz2_so
60+++ b/Makefile-libbz2_so
61@@ -23,8 +23,7 @@
62
63 SHELL=/bin/sh
64 CC=gcc
65-BIGFILES=-D_FILE_OFFSET_BITS=64
66-CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES)
67+override CFLAGS += -fpic -fPIC -Wall
68
69 OBJS= blocksort.o  \
70       huffman.o    \
71@@ -37,8 +36,11 @@
72 all: $(OBJS)
73 	$(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.8 $(OBJS)
74 	$(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.8
75-	rm -f libbz2.so.1.0
76-	ln -s libbz2.so.1.0.8 libbz2.so.1.0
77+
78+install:
79+	install -m 0755 -D libbz2.so.1.0.8 $(PREFIX)/lib/libbz2.so.1.0.8
80+	ln -sf libbz2.so.1.0.8 $(PREFIX)/lib/libbz2.so
81+	ln -sf libbz2.so.1.0.8 $(PREFIX)/lib/libbz2.so.1.0
82
83 clean:
84 	rm -f $(OBJS) bzip2.o libbz2.so.1.0.8 libbz2.so.1.0 bzip2-shared
85