add dependency to zlib
[openwrt.git] / package / zlib / patches / zlib.patch
1 diff -ruN zlib-1.2.2-orig/Makefile.in zlib-1.2.2-2/Makefile.in
2 --- zlib-1.2.2-orig/Makefile.in 2004-09-15 16:27:20.000000000 +0200
3 +++ zlib-1.2.2-2/Makefile.in 2004-11-13 13:38:12.000000000 +0100
4 @@ -25,20 +25,23 @@
5 # -Wstrict-prototypes -Wmissing-prototypes
6
7 LDFLAGS=libz.a
8 -LDSHARED=$(CC)
9 +LDSHARED=$(CC) -shared -Wl,-soname,$(SHAREDLIBM)
10 CPP=$(CC) -E
11
12 -LIBS=libz.a
13 +LIBS=
14 +STATICLIB=libz.a
15 SHAREDLIB=libz.so
16 SHAREDLIBV=libz.so.1.2.2
17 SHAREDLIBM=libz.so.1
18
19 -AR=ar rc
20 +AR=ar
21 RANLIB=ranlib
22 TAR=tar
23 SHELL=/bin/sh
24 EXE=
25
26 +DESTDIR =
27 +
28 prefix = /usr/local
29 exec_prefix = ${prefix}
30 libdir = ${exec_prefix}/lib
31 @@ -67,8 +70,8 @@
32 echo ' *** zlib test FAILED ***'; \
33 fi
34
35 -libz.a: $(OBJS) $(OBJA)
36 - $(AR) $@ $(OBJS) $(OBJA)
37 +$(STATICLIB): $(OBJS) $(OBJA)
38 + $(AR) rc $@ $(OBJS) $(OBJA)
39 -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
40
41 match.o: match.S
42 @@ -77,8 +80,10 @@
43 mv _match.o match.o
44 rm -f _match.s
45
46 +$(SHAREDLIB): $(SHAREDLIBV)
47 +
48 $(SHAREDLIBV): $(OBJS)
49 - $(LDSHARED) -o $@ $(OBJS)
50 + $(LDSHARED) -lc -o $@ $(OBJS)
51 rm -f $(SHAREDLIB) $(SHAREDLIBM)
52 ln -s $@ $(SHAREDLIB)
53 ln -s $@ $(SHAREDLIBM)
54 @@ -90,23 +95,23 @@
55 $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
56
57 install: $(LIBS)
58 - -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
59 - -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi
60 - -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi
61 - -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi
62 - cp zlib.h zconf.h $(includedir)
63 - chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
64 - cp $(LIBS) $(libdir)
65 - cd $(libdir); chmod 755 $(LIBS)
66 - -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
67 - cd $(libdir); if test -f $(SHAREDLIBV); then \
68 + -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
69 + -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
70 + -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
71 + -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
72 + cp zlib.h zconf.h $(DESTDIR)$(includedir)
73 + chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
74 + cp $(STATICLIB) $(SHAREDLIBV) $(DESTDIR)$(libdir)
75 + cd $(DESTDIR)$(libdir); chmod 755 $(LIBS)
76 + -@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
77 + cd $(DESTDIR)$(libdir); if test -f $(SHAREDLIBV); then \
78 rm -f $(SHAREDLIB) $(SHAREDLIBM); \
79 ln -s $(SHAREDLIBV) $(SHAREDLIB); \
80 ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
81 (ldconfig || true) >/dev/null 2>&1; \
82 fi
83 - cp zlib.3 $(man3dir)
84 - chmod 644 $(man3dir)/zlib.3
85 + cp zlib.3 $(DESTDIR)$(man3dir)
86 + chmod 644 $(DESTDIR)$(man3dir)/zlib.3
87 # The ranlib in install is needed on NeXTSTEP which checks file times
88 # ldconfig is for Linux
89
90 diff -ruN zlib-1.2.2-orig/configure zlib-1.2.2-2/configure
91 --- zlib-1.2.2-orig/configure 2004-09-07 07:50:06.000000000 +0200
92 +++ zlib-1.2.2-2/configure 2004-11-13 12:37:43.000000000 +0100
93 @@ -23,7 +23,7 @@
94 VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
95 VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
96 VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h`
97 -AR=${AR-"ar rc"}
98 +AR=${AR-"ar"}
99 RANLIB=${RANLIB-"ranlib"}
100 prefix=${prefix-/usr/local}
101 exec_prefix=${exec_prefix-'${prefix}'}
102 @@ -73,7 +73,7 @@
103
104 if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
105 CC="$cc"
106 - SFLAGS=${CFLAGS-"-fPIC -O3"}
107 + SFLAGS=${CFLAGS-"-D_REENTRANT -fPIC -O3"}
108 CFLAGS="$cflags"
109 case `(uname -s || echo unknown) 2>/dev/null` in
110 Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};;
111 @@ -408,6 +408,29 @@
112 echo Checking for mmap support... No.
113 fi
114
115 +cat > $test.c <<EOF
116 +#include <stdio.h>
117 +int main() { char buf[10]; snprintf(buf, sizeof(buf), "%s", "F"); return 0; }
118 +EOF
119 +if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
120 + echo "Checking for snprintf... Yes."
121 + CFLAGS="$CFLAGS -DHAS_snprintf"
122 +else
123 + echo "Checking for snprintf.. No."
124 +fi
125 +
126 +cat > $test.c <<EOF
127 +#include <stdio.h>
128 +#include <stdarg.h>
129 +int main(void) { va_list a; vsnprintf(0, 0, "", a); return 0; }
130 +EOF
131 +if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
132 + echo "Checking for vsnprintf... Yes."
133 + CFLAGS="$CFLAGS -DHAS_vsnprintf"
134 +else
135 + echo "Checking for vsnprintf.. No."
136 +fi
137 +
138 CPP=${CPP-"$CC -E"}
139 case $CFLAGS in
140 *ASMV*)
141 @@ -424,20 +447,21 @@
142 # udpate Makefile
143 sed < Makefile.in "
144 /^CC *=/s#=.*#=$CC#
145 -/^CFLAGS *=/s#=.*#=$CFLAGS#
146 -/^CPP *=/s#=.*#=$CPP#
147 -/^LDSHARED *=/s#=.*#=$LDSHARED#
148 -/^LIBS *=/s#=.*#=$LIBS#
149 -/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
150 -/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
151 -/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
152 -/^AR *=/s#=.*#=$AR#
153 -/^RANLIB *=/s#=.*#=$RANLIB#
154 -/^EXE *=/s#=.*#=$EXE#
155 -/^prefix *=/s#=.*#=$prefix#
156 -/^exec_prefix *=/s#=.*#=$exec_prefix#
157 -/^libdir *=/s#=.*#=$libdir#
158 -/^includedir *=/s#=.*#=$includedir#
159 -/^mandir *=/s#=.*#=$mandir#
160 -/^LDFLAGS *=/s#=.*#=$LDFLAGS#
161 +/^CC *=/s%=.*%= $CC%
162 +/^CFLAGS *=/s%=.*%= $CFLAGS%
163 +/^CPP *=/s%=.*%= $CPP%
164 +/^LDSHARED *=/s%=.*%= $LDSHARED%
165 +/^LIBS *=/s%=.*%= $LIBS%
166 +/^SHAREDLIB *=/s%=.*%= $SHAREDLIB%
167 +/^SHAREDLIBV *=/s%=.*%= $SHAREDLIBV%
168 +/^SHAREDLIBM *=/s%=.*%= $SHAREDLIBM%
169 +/^AR *=/s%=.*%= $AR%
170 +/^RANLIB *=/s%=.*%= $RANLIB%
171 +/^EXE *=/s%=.*%= $EXE%
172 +/^prefix *=/s%=.*%= $prefix%
173 +/^exec_prefix *=/s%=.*%= $exec_prefix%
174 +/^libdir *=/s%=.*%= $libdir%
175 +/^includedir *=/s%=.*%= $includedir%
176 +/^mandir *=/s%=.*%= $mandir%
177 +/^LDFLAGS *=/s%=.*%= $LDFLAGS%
178 " > Makefile
179 diff -ruN zlib-1.2.2-orig/contrib/minizip/Makefile zlib-1.2.2-2/contrib/minizip/Makefile
180 --- zlib-1.2.2-orig/contrib/minizip/Makefile 2003-09-10 20:00:16.000000000 +0200
181 +++ zlib-1.2.2-2/contrib/minizip/Makefile 2004-11-13 12:37:43.000000000 +0100
182 @@ -1,8 +1,8 @@
183 CC=cc
184 -CFLAGS=-O -I../..
185 +CFLAGS=-O2 -g -I../.. -Dunix
186
187 -UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
188 -ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a
189 +UNZ_OBJS = miniunz.o unzip.o ioapi.o
190 +ZIP_OBJS = minizip.o zip.o ioapi.o
191
192 .c.o:
193 $(CC) -c $(CFLAGS) $*.c
194 @@ -10,10 +10,10 @@
195 all: miniunz minizip
196
197 miniunz: $(UNZ_OBJS)
198 - $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS)
199 + $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) -L ../.. -lz
200
201 minizip: $(ZIP_OBJS)
202 - $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS)
203 + $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) -L ../.. -lz
204
205 test: miniunz minizip
206 ./minizip test readme.txt
This page took 0.0459039999999999 seconds and 5 git commands to generate.