source:
patches/zlib-1.2.3-fPIC-2.patch@
369d5d6
Last change on this file since 369d5d6 was 0054948, checked in by , 16 years ago | |
---|---|
|
|
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 23 23 VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h` 24 24 VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h` 25 25 VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h` 26 AR=${AR-"ar rc"}26 AR=${AR-"ar"} 27 27 RANLIB=${RANLIB-"ranlib"} 28 28 prefix=${prefix-/usr/local} 29 29 exec_prefix=${exec_prefix-'${prefix}'} … … 73 73 74 74 if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then 75 75 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" 77 81 CFLAGS="$cflags" 78 82 case `(uname -s || echo unknown) 2>/dev/null` in 79 83 Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};; … … 174 178 if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" && 175 179 test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then 176 180 CFLAGS="$SFLAGS" 177 LIBS="$ SHAREDLIBV"181 LIBS="$LIBS $SHAREDLIBV" 178 182 echo Building shared library $SHAREDLIBV with $CC. 179 183 elif test -z "$old_cc" -a -z "$old_cflags"; then 180 184 echo No shared library support. -
Makefile.in
diff -Naur zlib-1.2.3.orig/Makefile.in zlib-1.2.3/Makefile.in
old new 49 49 OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ 50 50 zutil.o inflate.o infback.o inftrees.o inffast.o 51 51 52 PIC_OBJS = $(OBJS:%.o=%.lo) 53 52 54 OBJA = 53 55 # to use the asm code: make OBJA=match.o 54 56 … … 68 70 fi 69 71 70 72 libz.a: $(OBJS) $(OBJA) 71 $(AR) $@ $(OBJS) $(OBJA)73 $(AR) rc $@ $(OBJS) $(OBJA) 72 74 -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 73 75 74 76 match.o: match.S … … 77 79 mv _match.o match.o 78 80 rm -f _match.s 79 81 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 82 87 rm -f $(SHAREDLIB) $(SHAREDLIBM) 83 88 ln -s $@ $(SHAREDLIB) 84 89 ln -s $@ $(SHAREDLIBM) … … 89 94 minigzip$(EXE): minigzip.o $(LIBS) 90 95 $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) 91 96 92 install : $(LIBS)97 install-libs: $(LIBS) 93 98 -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi 94 -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi95 99 -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi 96 100 -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi 97 cp zlib.h zconf.h $(includedir)98 chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h99 101 cp $(LIBS) $(libdir) 100 102 cd $(libdir); chmod 755 $(LIBS) 101 103 -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1 … … 110 112 # The ranlib in install is needed on NeXTSTEP which checks file times 111 113 # ldconfig is for Linux 112 114 115 install: 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 113 120 uninstall: 114 121 cd $(includedir); \ 115 122 cd $(libdir); rm -f libz.a; \
Note:
See TracBrowser
for help on using the repository browser.