update uml to 2.6.24 (i386 only for now)
[openwrt.git] / package / zlib / patches / 100-cross_compile.patch
1 Index: zlib-1.2.3/Makefile.in
2 ===================================================================
3 --- zlib-1.2.3.orig/Makefile.in 2007-06-04 13:24:03.760040896 +0200
4 +++ zlib-1.2.3/Makefile.in 2007-06-04 13:24:03.839028888 +0200
5 @@ -25,20 +25,23 @@
6 # -Wstrict-prototypes -Wmissing-prototypes
7
8 LDFLAGS=libz.a
9 -LDSHARED=$(CC)
10 +LDSHARED=$(CC) -shared -Wl,-soname,$(SHAREDLIBM)
11 CPP=$(CC) -E
12
13 -LIBS=libz.a
14 +LIBS=
15 +STATICLIB=libz.a
16 SHAREDLIB=libz.so
17 SHAREDLIBV=libz.so.1.2.3
18 SHAREDLIBM=libz.so.1
19
20 -AR=ar rc
21 +AR=ar
22 RANLIB=ranlib
23 TAR=tar
24 SHELL=/bin/sh
25 EXE=
26
27 +DESTDIR =
28 +
29 prefix = /usr/local
30 exec_prefix = ${prefix}
31 libdir = ${exec_prefix}/lib
32 @@ -67,8 +70,8 @@
33 echo ' *** zlib test FAILED ***'; \
34 fi
35
36 -libz.a: $(OBJS) $(OBJA)
37 - $(AR) $@ $(OBJS) $(OBJA)
38 +$(STATICLIB): $(OBJS) $(OBJA)
39 + $(AR) rc $@ $(OBJS) $(OBJA)
40 -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
41
42 match.o: match.S
43 @@ -77,8 +80,10 @@
44 mv _match.o match.o
45 rm -f _match.s
46
47 +$(SHAREDLIB): $(SHAREDLIBV)
48 +
49 $(SHAREDLIBV): $(OBJS)
50 - $(LDSHARED) -o $@ $(OBJS)
51 + $(LDSHARED) -lc -o $@ $(OBJS)
52 rm -f $(SHAREDLIB) $(SHAREDLIBM)
53 ln -s $@ $(SHAREDLIB)
54 ln -s $@ $(SHAREDLIBM)
55 @@ -90,23 +95,23 @@
56 $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
57
58 install: $(LIBS)
59 - -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
60 - -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi
61 - -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi
62 - -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi
63 - cp zlib.h zconf.h $(includedir)
64 - chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
65 - cp $(LIBS) $(libdir)
66 - cd $(libdir); chmod 755 $(LIBS)
67 - -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
68 - cd $(libdir); if test -f $(SHAREDLIBV); then \
69 + -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
70 + -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
71 + -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
72 + -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
73 + cp zlib.h zconf.h $(DESTDIR)$(includedir)
74 + chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
75 + cp $(STATICLIB) $(SHAREDLIBV) $(DESTDIR)$(libdir)
76 + cd $(DESTDIR)$(libdir); chmod 755 $(LIBS)
77 + -@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
78 + cd $(DESTDIR)$(libdir); if test -f $(SHAREDLIBV); then \
79 rm -f $(SHAREDLIB) $(SHAREDLIBM); \
80 ln -s $(SHAREDLIBV) $(SHAREDLIB); \
81 ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
82 (ldconfig || true) >/dev/null 2>&1; \
83 fi
84 - cp zlib.3 $(man3dir)
85 - chmod 644 $(man3dir)/zlib.3
86 + cp zlib.3 $(DESTDIR)$(man3dir)
87 + chmod 644 $(DESTDIR)$(man3dir)/zlib.3
88 # The ranlib in install is needed on NeXTSTEP which checks file times
89 # ldconfig is for Linux
90
91 Index: zlib-1.2.3/configure
92 ===================================================================
93 --- zlib-1.2.3.orig/configure 2007-06-04 13:24:03.765040136 +0200
94 +++ zlib-1.2.3/configure 2007-06-04 13:24:03.839028888 +0200
95 @@ -23,7 +23,7 @@
96 VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
97 VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
98 VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h`
99 -AR=${AR-"ar rc"}
100 +AR=${AR-"ar"}
101 RANLIB=${RANLIB-"ranlib"}
102 prefix=${prefix-/usr/local}
103 exec_prefix=${exec_prefix-'${prefix}'}
104 @@ -73,32 +73,9 @@
105
106 if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
107 CC="$cc"
108 - SFLAGS=${CFLAGS-"-fPIC -O3"}
109 + SFLAGS=${CFLAGS-"-D_REENTRANT -fPIC -O3"}
110 CFLAGS="$cflags"
111 - case `(uname -s || echo unknown) 2>/dev/null` in
112 - Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};;
113 - CYGWIN* | Cygwin* | cygwin* | OS/2* )
114 - EXE='.exe';;
115 - QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
116 - # (alain.bonnefoy@icbt.com)
117 - LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"};;
118 - HP-UX*)
119 - LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
120 - case `(uname -m || echo unknown) 2>/dev/null` in
121 - ia64)
122 - shared_ext='.so'
123 - SHAREDLIB='libz.so';;
124 - *)
125 - shared_ext='.sl'
126 - SHAREDLIB='libz.sl';;
127 - esac;;
128 - Darwin*) shared_ext='.dylib'
129 - SHAREDLIB=libz$shared_ext
130 - SHAREDLIBV=libz.$VER$shared_ext
131 - SHAREDLIBM=libz.$VER1$shared_ext
132 - LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER"};;
133 - *) LDSHARED=${LDSHARED-"$cc -shared"};;
134 - esac
135 + LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"}
136 else
137 # find system name and corresponding cc options
138 CC=${CC-cc}
139 @@ -424,6 +401,29 @@
140 echo Checking for mmap support... No.
141 fi
142
143 +cat > $test.c <<EOF
144 +#include <stdio.h>
145 +int main() { char buf[10]; snprintf(buf, sizeof(buf), "%s", "F"); return 0; }
146 +EOF
147 +if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
148 + echo "Checking for snprintf... Yes."
149 + CFLAGS="$CFLAGS -DHAS_snprintf"
150 +else
151 + echo "Checking for snprintf.. No."
152 +fi
153 +
154 +cat > $test.c <<EOF
155 +#include <stdio.h>
156 +#include <stdarg.h>
157 +int main(void) { va_list a; vsnprintf(0, 0, "", a); return 0; }
158 +EOF
159 +if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
160 + echo "Checking for vsnprintf... Yes."
161 + CFLAGS="$CFLAGS -DHAS_vsnprintf"
162 +else
163 + echo "Checking for vsnprintf.. No."
164 +fi
165 +
166 CPP=${CPP-"$CC -E"}
167 case $CFLAGS in
168 *ASMV*)
169 @@ -440,20 +440,21 @@
170 # udpate Makefile
171 sed < Makefile.in "
172 /^CC *=/s#=.*#=$CC#
173 -/^CFLAGS *=/s#=.*#=$CFLAGS#
174 -/^CPP *=/s#=.*#=$CPP#
175 -/^LDSHARED *=/s#=.*#=$LDSHARED#
176 -/^LIBS *=/s#=.*#=$LIBS#
177 -/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
178 -/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
179 -/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
180 -/^AR *=/s#=.*#=$AR#
181 -/^RANLIB *=/s#=.*#=$RANLIB#
182 -/^EXE *=/s#=.*#=$EXE#
183 -/^prefix *=/s#=.*#=$prefix#
184 -/^exec_prefix *=/s#=.*#=$exec_prefix#
185 -/^libdir *=/s#=.*#=$libdir#
186 -/^includedir *=/s#=.*#=$includedir#
187 -/^mandir *=/s#=.*#=$mandir#
188 -/^LDFLAGS *=/s#=.*#=$LDFLAGS#
189 +/^CC *=/s%=.*%= $CC%
190 +/^CFLAGS *=/s%=.*%= $CFLAGS%
191 +/^CPP *=/s%=.*%= $CPP%
192 +/^LDSHARED *=/s%=.*%= $LDSHARED%
193 +/^LIBS *=/s%=.*%= $LIBS%
194 +/^SHAREDLIB *=/s%=.*%= $SHAREDLIB%
195 +/^SHAREDLIBV *=/s%=.*%= $SHAREDLIBV%
196 +/^SHAREDLIBM *=/s%=.*%= $SHAREDLIBM%
197 +/^AR *=/s%=.*%= $AR%
198 +/^RANLIB *=/s%=.*%= $RANLIB%
199 +/^EXE *=/s%=.*%= $EXE%
200 +/^prefix *=/s%=.*%= $prefix%
201 +/^exec_prefix *=/s%=.*%= $exec_prefix%
202 +/^libdir *=/s%=.*%= $libdir%
203 +/^includedir *=/s%=.*%= $includedir%
204 +/^mandir *=/s%=.*%= $mandir%
205 +/^LDFLAGS *=/s%=.*%= $LDFLAGS%
206 " > Makefile
207 Index: zlib-1.2.3/contrib/minizip/Makefile
208 ===================================================================
209 --- zlib-1.2.3.orig/contrib/minizip/Makefile 2007-06-04 13:24:03.773038920 +0200
210 +++ zlib-1.2.3/contrib/minizip/Makefile 2007-06-04 13:24:03.839028888 +0200
211 @@ -1,8 +1,8 @@
212 CC=cc
213 -CFLAGS=-O -I../..
214 +CFLAGS=-O2 -g -I../.. -Dunix
215
216 -UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
217 -ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a
218 +UNZ_OBJS = miniunz.o unzip.o ioapi.o
219 +ZIP_OBJS = minizip.o zip.o ioapi.o
220
221 .c.o:
222 $(CC) -c $(CFLAGS) $*.c
223 @@ -10,10 +10,10 @@
224 all: miniunz minizip
225
226 miniunz: $(UNZ_OBJS)
227 - $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS)
228 + $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) -L ../.. -lz
229
230 minizip: $(ZIP_OBJS)
231 - $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS)
232 + $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) -L ../.. -lz
233
234 test: miniunz minizip
235 ./minizip test readme.txt
This page took 0.048873 seconds and 5 git commands to generate.