source: patches/zlib-1.2.3-fPIC-2.patch@ 2349999

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 2349999 was 0054948, checked in by Jim Gifford <clfs@…>, 15 years ago

Updated Zlib FPIC patch to -2

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