0001-build-objects-twice.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. Build objects twice for shared and static libraries
  2. The existing Makefile causes problems on MIPS because the same object
  3. files (not compiled with -fPIC) are used in static and shared libraries.
  4. MIPS will refuce to link non-pic objects in shared libraries.
  5. We fix this problems by creating a new rule for the shared library
  6. and build the shared objects as *.sho instead of *.o.
  7. Then, we use these objects to create the shared library.
  8. Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
  9. Index: bzip2-1.0.6/Makefile-libbz2_so
  10. ===================================================================
  11. --- bzip2-1.0.6.orig/Makefile-libbz2_so
  12. +++ bzip2-1.0.6/Makefile-libbz2_so
  13. @@ -25,13 +25,13 @@ SHELL=/bin/sh
  14. CC=gcc
  15. override CFLAGS += -fpic -fPIC -Wall
  16. -OBJS= blocksort.o \
  17. - huffman.o \
  18. - crctable.o \
  19. - randtable.o \
  20. - compress.o \
  21. - decompress.o \
  22. - bzlib.o
  23. +OBJS= blocksort.sho \
  24. + huffman.sho \
  25. + crctable.sho \
  26. + randtable.sho \
  27. + compress.sho \
  28. + decompress.sho \
  29. + bzlib.sho
  30. all: $(OBJS)
  31. $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 $(OBJS)
  32. @@ -45,17 +45,5 @@ install:
  33. clean:
  34. rm -f $(OBJS) bzip2.o libbz2.so.1.0.6 libbz2.so.1.0 bzip2-shared
  35. -blocksort.o: blocksort.c
  36. - $(CC) $(CFLAGS) -c blocksort.c
  37. -huffman.o: huffman.c
  38. - $(CC) $(CFLAGS) -c huffman.c
  39. -crctable.o: crctable.c
  40. - $(CC) $(CFLAGS) -c crctable.c
  41. -randtable.o: randtable.c
  42. - $(CC) $(CFLAGS) -c randtable.c
  43. -compress.o: compress.c
  44. - $(CC) $(CFLAGS) -c compress.c
  45. -decompress.o: decompress.c
  46. - $(CC) $(CFLAGS) -c decompress.c
  47. -bzlib.o: bzlib.c
  48. - $(CC) $(CFLAGS) -c bzlib.c
  49. +%.sho: %.c
  50. + $(CC) $(CFLAGS) -o $@ -c $<