source: clfs-sysroot/patches/zlib-1.2.3-fPIC-2.patch@ 312a670

Last change on this file since 312a670 was ecd7387, checked in by Joe Ciccone <jciccone@…>, 15 years ago

Updated the ZLib -fPIC patch to -2.

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

    Submitted By: Jim Gifford  <jim at cross-lfs dot org>
    Originally Submitted By: Tushar Teredesai <tushar@linuxfromscratch.org>
    Date: 2009-05-7
    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.3.orig/configure zlib-1.2.3/configure
    old new  
    2323VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
    2424VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
    2525VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h`
    26 AR=${AR-"ar rc"}
     26AR=${AR-"ar"}
    2727RANLIB=${RANLIB-"ranlib"}
    2828prefix=${prefix-/usr/local}
    2929exec_prefix=${exec_prefix-'${prefix}'}
     
    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"};;
     
    174178  if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
    175179     test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
    176180    CFLAGS="$SFLAGS"
    177     LIBS="$SHAREDLIBV"
     181    LIBS="$LIBS $SHAREDLIBV"
    178182    echo Building shared library $SHAREDLIBV with $CC.
    179183  elif test -z "$old_cc" -a -z "$old_cflags"; then
    180184    echo No shared library support.
  • Makefile.in

    diff -Naur zlib-1.2.3.orig/Makefile.in zlib-1.2.3/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
     
    6870        fi
    6971
    7072libz.a: $(OBJS) $(OBJA)
    71         $(AR) $@ $(OBJS) $(OBJA)
     73        $(AR) rc $@ $(OBJS) $(OBJA)
    7274        -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
    7375
    7476match.o: match.S
     
    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.