source: patches/zlib-1.2.3-fPIC-1.patch@ aaa4568

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since aaa4568 was 69cde8d, checked in by Jim Gifford <clfs@…>, 19 years ago

Added: All patches needed for the book.

  • Property mode set to 100644
File size: 3.2 KB
  • configure

    Submitted By: Tushar Teredesai <tushar@linuxfromscratch.org>
    Date: 2005-06-14
    Initial Package Version: 1.2.2
    Origin: Gentoo ebuild?
    Upstream Status: Not submitted
    Description:
     1. Build shared and static lib in one pass
     2. Always add -fPIC when building shared lib, don't expect the user to set it.
    
    To build the shared and static library:
    	./configure --prefix=<prefix> --shared &&
    	make &&
    	make install
    Remove the --shared if you don't want the shared lib.
    
    diff -Naur zlib-1.2.2.orig/configure zlib-1.2.2/configure
    old new  
    7373
    7474if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
    7575  CC="$cc"
    76   SFLAGS=${CFLAGS-"-fPIC -O3"}
     76  #SFLAGS=${CFLAGS-"-fPIC -O3"}
     77  # the above is horribly wrong on a few archs where -fPIC should ALWAYS be
     78  # used in the creation of shared libraries. without the following, the
     79  # shared lib test will sometimes fail even when shared libs -can- be created.
     80  SFLAGS="${CFLAGS-"-O3"} -fPIC"
    7781  CFLAGS="$cflags"
    7882  case `(uname -s || echo unknown) 2>/dev/null` in
    7983  Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};;
     
    158162  if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
    159163     test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
    160164    CFLAGS="$SFLAGS"
    161     LIBS="$SHAREDLIBV"
     165    LIBS="$LIBS $SHAREDLIBV"
    162166    echo Building shared library $SHAREDLIBV with $CC.
    163167  elif test -z "$old_cc" -a -z "$old_cflags"; then
    164168    echo No shared library support.
  • Makefile.in

    diff -Naur zlib-1.2.2.orig/Makefile.in zlib-1.2.2/Makefile.in
    old new  
    4949OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
    5050       zutil.o inflate.o infback.o inftrees.o inffast.o
    5151
     52PIC_OBJS = $(OBJS:%.o=%.lo)
     53
    5254OBJA =
    5355# to use the asm code: make OBJA=match.o
    5456
     
    7779        mv _match.o match.o
    7880        rm -f _match.s
    7981
    80 $(SHAREDLIBV): $(OBJS)
    81         $(LDSHARED) -o $@ $(OBJS)
     82%.lo: %.c
     83        $(CC) $(CFLAGS) -DPIC -fPIC -c $< -o $@
     84
     85$(SHAREDLIBV): $(PIC_OBJS)
     86        $(LDSHARED) -o $@ $(PIC_OBJS) -lc
    8287        rm -f $(SHAREDLIB) $(SHAREDLIBM)
    8388        ln -s $@ $(SHAREDLIB)
    8489        ln -s $@ $(SHAREDLIBM)
     
    8994minigzip$(EXE): minigzip.o $(LIBS)
    9095        $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
    9196
    92 install: $(LIBS)
     97install-libs: $(LIBS)
    9398        -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
    94         -@if [ ! -d $(includedir)  ]; then mkdir -p $(includedir); fi
    9599        -@if [ ! -d $(libdir)      ]; then mkdir -p $(libdir); fi
    96100        -@if [ ! -d $(man3dir)     ]; then mkdir -p $(man3dir); fi
    97         cp zlib.h zconf.h $(includedir)
    98         chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
    99101        cp $(LIBS) $(libdir)
    100102        cd $(libdir); chmod 755 $(LIBS)
    101103        -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
     
    110112# The ranlib in install is needed on NeXTSTEP which checks file times
    111113# ldconfig is for Linux
    112114
     115install: install-libs
     116        -@if [ ! -d $(includedir)  ]; then mkdir $(includedir); fi
     117        cp zlib.h zconf.h $(includedir)
     118        chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
     119
    113120uninstall:
    114121        cd $(includedir); \
    115122        cd $(libdir); rm -f libz.a; \
Note: See TracBrowser for help on using the repository browser.