0002-improve-build-system.patch 2.7 KB

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