mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
3.3 KiB

  1. Copied from www.linuxfromscratch.org to ROCK Linux.
  2. Submitted By: Tushar Teredesai <tushar@linuxfromscratch.org>
  3. Date: 2005-06-14
  4. Initial Package Version: 1.2.2
  5. Origin: Gentoo ebuild?
  6. Upstream Status: Not submitted
  7. Description:
  8. 1. Build shared and static lib in one pass
  9. 2. Always add -fPIC when building shared lib, don't expect the user to set it.
  10. To build the shared and static library:
  11. ./configure --prefix=<prefix> --shared &&
  12. make &&
  13. make install
  14. Remove the --shared if you don't want the shared lib.
  15. diff -Naur zlib-1.2.2.orig/configure zlib-1.2.2/configure
  16. --- zlib-1.2.2.orig/configure 2004-09-07 00:50:06.000000000 -0500
  17. +++ zlib-1.2.2/configure 2005-02-05 01:34:08.553292416 -0600
  18. @@ -73,7 +73,11 @@
  19. if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
  20. CC="$cc"
  21. - SFLAGS=${CFLAGS-"-fPIC -O3"}
  22. + #SFLAGS=${CFLAGS-"-fPIC -O3"}
  23. + # the above is horribly wrong on a few archs where -fPIC should ALWAYS be
  24. + # used in the creation of shared libraries. without the following, the
  25. + # shared lib test will sometimes fail even when shared libs -can- be created.
  26. + SFLAGS="${CFLAGS-"-O3"} -fPIC"
  27. CFLAGS="$cflags"
  28. case `(uname -s || echo unknown) 2>/dev/null` in
  29. Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};;
  30. @@ -158,7 +162,7 @@
  31. if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
  32. test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
  33. CFLAGS="$SFLAGS"
  34. - LIBS="$SHAREDLIBV"
  35. + LIBS="$LIBS $SHAREDLIBV"
  36. echo Building shared library $SHAREDLIBV with $CC.
  37. elif test -z "$old_cc" -a -z "$old_cflags"; then
  38. echo No shared library support.
  39. diff -Naur zlib-1.2.2.orig/Makefile.in zlib-1.2.2/Makefile.in
  40. --- zlib-1.2.2.orig/Makefile.in 2004-09-15 09:27:20.000000000 -0500
  41. +++ zlib-1.2.2/Makefile.in 2005-02-05 01:33:49.703158072 -0600
  42. @@ -49,6 +49,8 @@
  43. OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
  44. zutil.o inflate.o infback.o inftrees.o inffast.o
  45. +PIC_OBJS = $(OBJS:%.o=%.lo)
  46. +
  47. OBJA =
  48. # to use the asm code: make OBJA=match.o
  49. @@ -77,8 +79,11 @@
  50. mv _match.o match.o
  51. rm -f _match.s
  52. -$(SHAREDLIBV): $(OBJS)
  53. - $(LDSHARED) -o $@ $(OBJS)
  54. +%.lo: %.c
  55. + $(CC) $(CFLAGS) -DPIC -fPIC -c $< -o $@
  56. +
  57. +$(SHAREDLIBV): $(PIC_OBJS)
  58. + $(LDSHARED) -o $@ $(PIC_OBJS) -lc
  59. rm -f $(SHAREDLIB) $(SHAREDLIBM)
  60. ln -s $@ $(SHAREDLIB)
  61. ln -s $@ $(SHAREDLIBM)
  62. @@ -89,13 +94,10 @@
  63. minigzip$(EXE): minigzip.o $(LIBS)
  64. $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
  65. -install: $(LIBS)
  66. +install-libs: $(LIBS)
  67. -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
  68. - -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi
  69. -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi
  70. -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi
  71. - cp zlib.h zconf.h $(includedir)
  72. - chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
  73. cp $(LIBS) $(libdir)
  74. cd $(libdir); chmod 755 $(LIBS)
  75. -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
  76. @@ -110,6 +112,11 @@
  77. # The ranlib in install is needed on NeXTSTEP which checks file times
  78. # ldconfig is for Linux
  79. +install: install-libs
  80. + -@if [ ! -d $(includedir) ]; then mkdir $(includedir); fi
  81. + cp zlib.h zconf.h $(includedir)
  82. + chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
  83. +
  84. uninstall:
  85. cd $(includedir); \
  86. cd $(libdir); rm -f libz.a; \