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

Last change on this file since 7067dbb was 67300de, checked in by Joe Ciccone <jciccone@…>, 16 years ago

Create a clfs-1.1 branch in preperation for a RC.

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