Fix another typo, definitively closes #1370
[openwrt.git] / package / zlib / patches / 100-cross_compile.patch
1 diff -ruN zlib-1.2.3-orig/Makefile.in zlib-1.2.3-2/Makefile.in
2 --- zlib-1.2.3-orig/Makefile.in 2005-07-18 10:25:21.000000000 +0800
3 +++ zlib-1.2.3-2/Makefile.in 2006-10-16 21:23:27.000000000 +0800
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.3
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.3-orig/configure zlib-1.2.3-2/configure
91 --- zlib-1.2.3-orig/configure 2005-07-12 04:11:57.000000000 +0800
92 +++ zlib-1.2.3-2/configure 2006-10-16 21:25:38.000000000 +0800
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,32 +73,9 @@
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 - CYGWIN* | Cygwin* | cygwin* | OS/2* )
112 - EXE='.exe';;
113 - QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
114 - # (alain.bonnefoy@icbt.com)
115 - LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"};;
116 - HP-UX*)
117 - LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
118 - case `(uname -m || echo unknown) 2>/dev/null` in
119 - ia64)
120 - shared_ext='.so'
121 - SHAREDLIB='libz.so';;
122 - *)
123 - shared_ext='.sl'
124 - SHAREDLIB='libz.sl';;
125 - esac;;
126 - Darwin*) shared_ext='.dylib'
127 - SHAREDLIB=libz$shared_ext
128 - SHAREDLIBV=libz.$VER$shared_ext
129 - SHAREDLIBM=libz.$VER1$shared_ext
130 - LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER"};;
131 - *) LDSHARED=${LDSHARED-"$cc -shared"};;
132 - esac
133 + LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"}
134 else
135 # find system name and corresponding cc options
136 CC=${CC-cc}
137 @@ -424,6 +401,29 @@
138 echo Checking for mmap support... No.
139 fi
140
141 +cat > $test.c <<EOF
142 +#include <stdio.h>
143 +int main() { char buf[10]; snprintf(buf, sizeof(buf), "%s", "F"); return 0; }
144 +EOF
145 +if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
146 + echo "Checking for snprintf... Yes."
147 + CFLAGS="$CFLAGS -DHAS_snprintf"
148 +else
149 + echo "Checking for snprintf.. No."
150 +fi
151 +
152 +cat > $test.c <<EOF
153 +#include <stdio.h>
154 +#include <stdarg.h>
155 +int main(void) { va_list a; vsnprintf(0, 0, "", a); return 0; }
156 +EOF
157 +if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
158 + echo "Checking for vsnprintf... Yes."
159 + CFLAGS="$CFLAGS -DHAS_vsnprintf"
160 +else
161 + echo "Checking for vsnprintf.. No."
162 +fi
163 +
164 CPP=${CPP-"$CC -E"}
165 case $CFLAGS in
166 *ASMV*)
167 @@ -440,20 +440,21 @@
168 # udpate Makefile
169 sed < Makefile.in "
170 /^CC *=/s#=.*#=$CC#
171 -/^CFLAGS *=/s#=.*#=$CFLAGS#
172 -/^CPP *=/s#=.*#=$CPP#
173 -/^LDSHARED *=/s#=.*#=$LDSHARED#
174 -/^LIBS *=/s#=.*#=$LIBS#
175 -/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
176 -/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
177 -/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
178 -/^AR *=/s#=.*#=$AR#
179 -/^RANLIB *=/s#=.*#=$RANLIB#
180 -/^EXE *=/s#=.*#=$EXE#
181 -/^prefix *=/s#=.*#=$prefix#
182 -/^exec_prefix *=/s#=.*#=$exec_prefix#
183 -/^libdir *=/s#=.*#=$libdir#
184 -/^includedir *=/s#=.*#=$includedir#
185 -/^mandir *=/s#=.*#=$mandir#
186 -/^LDFLAGS *=/s#=.*#=$LDFLAGS#
187 +/^CC *=/s%=.*%= $CC%
188 +/^CFLAGS *=/s%=.*%= $CFLAGS%
189 +/^CPP *=/s%=.*%= $CPP%
190 +/^LDSHARED *=/s%=.*%= $LDSHARED%
191 +/^LIBS *=/s%=.*%= $LIBS%
192 +/^SHAREDLIB *=/s%=.*%= $SHAREDLIB%
193 +/^SHAREDLIBV *=/s%=.*%= $SHAREDLIBV%
194 +/^SHAREDLIBM *=/s%=.*%= $SHAREDLIBM%
195 +/^AR *=/s%=.*%= $AR%
196 +/^RANLIB *=/s%=.*%= $RANLIB%
197 +/^EXE *=/s%=.*%= $EXE%
198 +/^prefix *=/s%=.*%= $prefix%
199 +/^exec_prefix *=/s%=.*%= $exec_prefix%
200 +/^libdir *=/s%=.*%= $libdir%
201 +/^includedir *=/s%=.*%= $includedir%
202 +/^mandir *=/s%=.*%= $mandir%
203 +/^LDFLAGS *=/s%=.*%= $LDFLAGS%
204 " > Makefile
205 diff -ruN zlib-1.2.3-orig/contrib/minizip/Makefile zlib-1.2.3-2/contrib/minizip/Makefile
206 --- zlib-1.2.3-orig/contrib/minizip/Makefile 2005-07-13 02:08:40.000000000 +0800
207 +++ zlib-1.2.3-2/contrib/minizip/Makefile 2006-10-16 21:23:27.000000000 +0800
208 @@ -1,8 +1,8 @@
209 CC=cc
210 -CFLAGS=-O -I../..
211 +CFLAGS=-O2 -g -I../.. -Dunix
212
213 -UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
214 -ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a
215 +UNZ_OBJS = miniunz.o unzip.o ioapi.o
216 +ZIP_OBJS = minizip.o zip.o ioapi.o
217
218 .c.o:
219 $(CC) -c $(CFLAGS) $*.c
220 @@ -10,10 +10,10 @@
221 all: miniunz minizip
222
223 miniunz: $(UNZ_OBJS)
224 - $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS)
225 + $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) -L ../.. -lz
226
227 minizip: $(ZIP_OBJS)
228 - $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS)
229 + $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) -L ../.. -lz
230
231 test: miniunz minizip
232 ./minizip test readme.txt
This page took 0.062931 seconds and 5 git commands to generate.