Initial revision
[openwrt/svn-archive/archive.git] / obsolete-buildroot / sources / STLport-4.5.3.patch
1 diff -urN STLport-4.5.3/Makefile STLport-4.5.3-devel/Makefile
2 --- STLport-4.5.3/Makefile Wed Dec 31 17:00:00 1969
3 +++ STLport-4.5.3-devel/Makefile Tue Jan 7 15:28:08 2003
4 @@ -0,0 +1,44 @@
5 +# Makefile to compile stlport with uClibc
6 +#
7 +# Copyright (C) 2002 Erik Andersen <andersen@codepoet.org>
8 +#
9 +# This program is free software; you can redistribute it and/or modify
10 +# it under the terms of the GNU General Public License as published by
11 +# the Free Software Foundation; either version 2 of the License, or
12 +# (at your option) any later version.
13 +#
14 +# This program is distributed in the hope that it will be useful,
15 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
16 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 +# General Public License for more details.
18 +#
19 +# You should have received a copy of the GNU General Public License
20 +# along with this program; if not, write to the Free Software
21 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 +
23 +ARCH:=i386
24 +PREFIX:=/usr/$(ARCH)-linux-uclibc
25 +CROSS:= $(PREFIX)/../bin/$(ARCH)-linux-uclibc-
26 +CC=$(CROSS)gcc
27 +CXX=$(CROSS)g++
28 +AR = $(CROSS)ar
29 +STRIP = $(CROSS)strip --remove-section=.comment --remove-section=.note --strip-unneeded
30 +.EXPORT_ALL_VARIABLES:
31 +
32 +all:
33 + rm -f lib/lib*
34 + make -C src -f gcc-uClibc.mak all
35 + (cd lib; rm -f libstdc++_debug.so; \
36 + ln -fs libstdc++.so.4.5 libstdc++.so; \
37 + ln -fs libstdc++.so.4.5 libstdc++.so.0;)
38 + $(STRIP) lib/libstdc++.so.4.5;
39 +
40 +clean:
41 + make -C src -f gcc-uClibc.mak clean
42 + rm -rf lib/*
43 +
44 +install:
45 + (cd lib; \
46 + cp -a libstdc++.a $(PREFIX)/lib; \
47 + cp -a libstdc++.so libstdc++.so.0 libstdc++.so.4.5 $(PREFIX)/lib;)
48 + cp -a stlport $(PREFIX)/include/c++
49 diff -urN STLport-4.5.3/src/dll_main.cpp STLport-4.5.3-devel/src/dll_main.cpp
50 --- STLport-4.5.3/src/dll_main.cpp Sat Feb 2 16:11:56 2002
51 +++ STLport-4.5.3-devel/src/dll_main.cpp Tue Jan 7 15:28:08 2003
52 @@ -52,7 +52,7 @@
53 # include <locale>
54 # endif
55
56 -# if defined (_STLP_UNIX)
57 +# if defined (_STLP_UNIX) && defined (_STLP_PTHREADS) && ! defined (_STLP_USE_UCLIBC)
58 # define _STLP_HAS_PERTHREAD_ALLOCATOR
59 # include <stl/_pthread_alloc.h>
60 # endif
61 diff -urN STLport-4.5.3/src/gcc-uClibc.mak STLport-4.5.3-devel/src/gcc-uClibc.mak
62 --- STLport-4.5.3/src/gcc-uClibc.mak Wed Dec 31 17:00:00 1969
63 +++ STLport-4.5.3-devel/src/gcc-uClibc.mak Tue Jan 7 15:28:08 2003
64 @@ -0,0 +1,61 @@
65 +#
66 +# Basename for libraries
67 +#
68 +LIB_BASENAME:=libstdc++
69 +LIB_SHAREDNAME:=$(LIB_BASENAME).so
70 +LIB_SHAREDNAME_FULL:=$(LIB_SHAREDNAME).0
71 +
72 +#
73 +# guts for common stuff
74 +#
75 +#
76 +LINK:=$(AR) -cr
77 +#DYN_LINK:=$(CC) -fno-exceptions -lpthread -lm -shared -Wl,-soname=$(LIB_SHAREDNAME_FULL) -o
78 +DYN_LINK:=$(CC) -fno-exceptions -shared -Wl,-soname=$(LIB_SHAREDNAME_FULL) -o
79 +
80 +OBJEXT=o
81 +DYNEXT=so
82 +STEXT=a
83 +RM=rm -rf
84 +PATH_SEP=/
85 +MKDIR=mkdir -p
86 +COMP=GCC$(ARCH)
87 +INSTALL_STEP = install_unix
88 +
89 +all: release_dynamic release_static
90 +#all: all_dynamic all_static symbolic_links
91 +
92 +include common_macros.mak
93 +STLDEBUG_NAME:=$(LIB_BASENAME).debug
94 +
95 +# Lets disable exception support, since this saves over 200k...
96 +DEFINE_FLAGS:= -fno-exceptions
97 +#DEFINE_FLAGS:= -D_STLP_NO_EXCEPTIONS -fno-exceptions -DSTL_NO_EXCEPTIONS
98 +
99 +#DEFINE_FLAGS+= -D_STLP_USE_UCLIBC -D_STLP_NO_WCHAR_T \
100 +# -DUSE_SPRINTF_INSTEAD -D_ISOC99_SOURCE
101 +
102 +WARNING_FLAGS:= -W -Wno-sign-compare -Wno-unused -Wno-uninitialized
103 +INCLUDE_FLAGS = -I${STLPORT_DIR}
104 +CXXFLAGS_COMMON = $(WARNING_FLAGS) $(DEFINE_FLAGS) $(INCLUDE_FLAGS)
105 +
106 +CXXFLAGS_RELEASE_static = $(CXXFLAGS_COMMON) -Os
107 +CXXFLAGS_RELEASE_dynamic = $(CXXFLAGS_COMMON) -Os -fPIC
108 +
109 +CXXFLAGS_DEBUG_static = $(CXXFLAGS_COMMON) -O -g
110 +CXXFLAGS_DEBUG_dynamic = $(CXXFLAGS_COMMON) -O -g -fPIC
111 +
112 +CXXFLAGS_STLDEBUG_static = $(CXXFLAGS_DEBUG_static) -D_STLP_DEBUG
113 +CXXFLAGS_STLDEBUG_dynamic = $(CXXFLAGS_DEBUG_dynamic) -D_STLP_DEBUG -fPIC
114 +
115 +include common_percent_rules.mak
116 +include common_rules.mak
117 +
118 +
119 +#install: all
120 +# cp -p $(LIB_TARGET) ${D_LIB_TARGET} ../lib
121 +
122 +#%.s: %.cpp
123 +# $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
124 +
125 +
126 diff -urN STLport-4.5.3/src/num_put_float.cpp STLport-4.5.3-devel/src/num_put_float.cpp
127 --- STLport-4.5.3/src/num_put_float.cpp Fri Jan 18 15:06:52 2002
128 +++ STLport-4.5.3-devel/src/num_put_float.cpp Tue Jan 7 15:28:08 2003
129 @@ -65,6 +65,12 @@
130
131 # endif
132
133 +# if defined(_STLP_USE_UCLIBC)
134 +# define __USE_ISOC99 1
135 +# include <math.h>
136 +# include <float.h>
137 +# endif
138 +
139 # include <cstdlib>
140
141 #if defined (_MSC_VER) || defined (__MINGW32__) || defined (__BORLANDC__) || defined (__DJGPP) || defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR)
142 @@ -209,7 +215,7 @@
143
144 #ifdef USE_SPRINTF_INSTEAD
145
146 -#elif defined (__hpux) || defined (__DJGPP) || ( defined(_STLP_USE_GLIBC) && ! defined (__MSL__) )
147 +#elif defined (__hpux) || defined (__DJGPP) || ( defined(_STLP_USE_GLIBC) && ! defined (__MSL__) ) || defined (_STLP_USE_UCLIBC)
148 # if defined (isfinite)
149 inline bool _Stl_is_nan_or_inf(double x) { return !isfinite(x); }
150 # else
151 @@ -238,7 +244,7 @@
152 }
153 inline bool _Stl_is_neg_inf(double x) { return _fpclass(x) == _FPCLASS_NINF; }
154 inline bool _Stl_is_neg_nan(double x) { return _isnan(x) && _copysign(1., x) < 0 ; }
155 -#elif defined(__MRC__) || defined(__SC__) //*TY 02/24/2000 - added support for MPW
156 +#elif defined(__MRC__) || defined(__SC__)
157 bool _Stl_is_nan_or_inf(double x) { return isnan(x) || !isfinite(x); }
158 bool _Stl_is_inf(double x) { return !isfinite(x); }
159 bool _Stl_is_neg_inf(double x) { return !isfinite(x) && signbit(x); }
160 @@ -280,7 +286,7 @@
161 inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
162 { return fcvtbuf(x, n, pt, sign, buf); }
163 # endif
164 -#elif defined (_STLP_USE_GLIBC)
165 +#elif defined (_STLP_USE_GLIBC) || defined(_STLP_USE_UCLIBC)
166 inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
167 { return buf + ecvt_r(x, n, pt, sign, buf, NDIG+2); }
168 inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
169 diff -urN STLport-4.5.3/src/stdio_streambuf.cpp STLport-4.5.3-devel/src/stdio_streambuf.cpp
170 --- STLport-4.5.3/src/stdio_streambuf.cpp Thu Jan 10 11:41:52 2002
171 +++ STLport-4.5.3-devel/src/stdio_streambuf.cpp Tue Jan 7 15:28:08 2003
172 @@ -82,7 +82,7 @@
173 _STLP_VENDOR_CSTD::fgetpos(_M_file, &pos);
174 // added 21 june 00 mdb,rjf,wjs: glibc 2.2 changed fpos_t to be a struct instead
175 // of a primitive type
176 -#if (defined(__GLIBC__) && ( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2) ) ) )
177 +#if defined(_STLP_USE_UCLIBC) || (defined(__GLIBC__) && defined(_STLP_USE_GLIBC) && ( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2) ) ) )
178 return pos_type((streamoff)pos.__pos);
179 #elif defined(__ISCPP__) || defined(__MVS__) || (__OS400__)
180 return pos_type(pos.__fpos_elem[ 0 ]);
181 @@ -101,13 +101,16 @@
182
183 // added 21 june 00 mdb,rjf,wjs: glibc 2.2 changed fpos_t to be a struct instead
184 // of a primitive type
185 -#if (defined(__GLIBC__) && ( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2) ) ) )
186 +#if (defined(__GLIBC__) && defined(_STLP_USE_GLIBC) && ( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2) ) ) )
187 fpos_t p;
188 p.__pos = pos;
189 memset( &(p.__state), 0, sizeof(p.__state) );
190 #elif defined(__MVS__) || (__OS400__)
191 fpos_t p;
192 p.__fpos_elem[0] = pos;
193 +#elif defined(_STLP_USE_UCLIBC)
194 + fpos_t p;
195 + p.__pos = pos;
196 #else
197 fpos_t p(pos);
198 #endif
199 diff -urN STLport-4.5.3/stlport/config/_prolog.h STLport-4.5.3-devel/stlport/config/_prolog.h
200 --- STLport-4.5.3/stlport/config/_prolog.h Sun Oct 28 13:26:44 2001
201 +++ STLport-4.5.3-devel/stlport/config/_prolog.h Tue Jan 7 15:28:08 2003
202 @@ -1,3 +1,8 @@
203 +/* Evil hack to make sure everything behaves itself */
204 +#define _STLP_USE_UCLIBC
205 +//#define _STLP_NO_WCHAR_T
206 +//#define _ISOC99_SOURCE
207 +//#define USE_SPRINTF_INSTEAD
208
209 #if defined (_STLP_MSVC) || defined (__ICL) || defined (__BORLANDC__)
210
211 diff -urN STLport-4.5.3/stlport/config/stl_gcc.h STLport-4.5.3-devel/stlport/config/stl_gcc.h
212 --- STLport-4.5.3/stlport/config/stl_gcc.h Thu Jan 10 11:41:58 2002
213 +++ STLport-4.5.3-devel/stlport/config/stl_gcc.h Tue Jan 7 15:28:08 2003
214 @@ -3,7 +3,7 @@
215 */
216
217 /* Systems having GLIBC installed have different traits */
218 -#if ! defined (_STLP_USE_GLIBC) && ( defined (__linux__) || defined (__CYGWIN__) )
219 +#if ! defined (_STLP_USE_GLIBC) && ! defined (_STLP_USE_UCLIBC) && ( defined (__linux__) || defined (__CYGWIN__) )
220 # define _STLP_USE_GLIBC
221 #endif
222
223 diff -urN STLport-4.5.3/stlport/cstdlib STLport-4.5.3-devel/stlport/cstdlib
224 --- STLport-4.5.3/stlport/cstdlib Thu Aug 23 15:51:54 2001
225 +++ STLport-4.5.3-devel/stlport/cstdlib Tue Jan 7 15:28:08 2003
226 @@ -55,9 +55,11 @@
227 using _STLP_VENDOR_CSTD::atof;
228 using _STLP_VENDOR_CSTD::atoi;
229 using _STLP_VENDOR_CSTD::atol;
230 +# ifndef _STLP_USE_UCLIBC
231 using _STLP_VENDOR_CSTD::mblen;
232 using _STLP_VENDOR_CSTD::mbstowcs;
233 using _STLP_VENDOR_CSTD::mbtowc;
234 +# endif
235 using _STLP_VENDOR_CSTD::strtod;
236 using _STLP_VENDOR_CSTD::strtol;
237 using _STLP_VENDOR_CSTD::strtoul;
238 diff -urN STLport-4.5.3/stlport/stl/_config.h STLport-4.5.3-devel/stlport/stl/_config.h
239 --- STLport-4.5.3/stlport/stl/_config.h Fri Jan 18 15:08:36 2002
240 +++ STLport-4.5.3-devel/stlport/stl/_config.h Tue Jan 7 15:28:08 2003
241 @@ -26,6 +26,16 @@
242 #ifndef _STLP_CONFIG_H
243 # define _STLP_CONFIG_H
244
245 +/* Make the STLport headers provide uClibc support by default */
246 +#define _STLP_NO_EXCEPTIONS 1
247 +#define STL_NO_EXCEPTIONS 1
248 +#define _STLP_USE_UCLIBC 1
249 +//#define _STLP_NO_WCHAR_T 1
250 +#define _STLP_NO_LONG_DOUBLE 1
251 +#define USE_SPRINTF_INSTEAD 1
252 +#define _ISOC99_SOURCE 1
253 +#define _STLP_NO_ANACHRONISMS 1
254 +
255 /*
256 * Purpose of this file :
257 *
258 @@ -164,7 +174,7 @@
259 /* Operating system recognition (basic) */
260 # if defined (__unix) || defined (__linux__) || defined (__QNX__) || defined (_AIX) || defined (__NetBSD__) || defined (__Lynx__)
261 # define _STLP_UNIX 1
262 -# if defined (__linux__) && ! defined (_STLP_USE_GLIBC)
263 +# if defined (__linux__) && ! defined (_STLP_USE_GLIBC) && ! defined (_STLP_USE_UCLIBC)
264 # define _STLP_USE_GLIBC 1
265 # endif
266 # elif defined(macintosh) || defined (_MAC)
267 diff -urN STLport-4.5.3/stlport/stl/_stdio_file.h STLport-4.5.3-devel/stlport/stl/_stdio_file.h
268 --- STLport-4.5.3/stlport/stl/_stdio_file.h Fri Jan 18 15:07:00 2002
269 +++ STLport-4.5.3-devel/stlport/stl/_stdio_file.h Tue Jan 7 15:28:08 2003
270 @@ -634,6 +634,112 @@
271 }
272 # define _STLP_FILE_I_O_IDENTICAL
273
274 +#elif defined(_STLP_USE_UCLIBC)
275 +
276 +#if defined(__MASK_READING)
277 +
278 +inline int _FILE_fd(const FILE *__f) { return __f->__filedes; }
279 +
280 +// Returns a pointer to the beginning of the buffer.
281 +inline char* _FILE_I_begin(const FILE *__f) { return (char*) __f->__bufstart; }
282 +
283 +// Returns the current read/write position within the buffer.
284 +inline char* _FILE_I_next(const FILE *__f) { return (char*) __f->__bufpos; }
285 +
286 +// Returns a pointer immediately past the end of the buffer.
287 +inline char* _FILE_I_end(const FILE *__f) { return (char*)__f->__bufend; }
288 +
289 +// Returns the number of characters remaining in the buffer, i.e.
290 +// _FILE_[IO]_end(__f) - _FILE_[IO]_next(__f).
291 +inline ptrdiff_t _FILE_I_avail(const FILE *__f)
292 + { return __f->__bufgetc_u - __f->__bufpos; }
293 +
294 +// Increments the current read/write position by 1, returning the
295 +// character at the old position.
296 +inline char& _FILE_I_preincr(FILE *__f) { return *(char*)(++__f->__bufpos); }
297 +
298 +// Increments the current read/write position by 1, returning the
299 +// character at the old position.
300 +inline char& _FILE_I_postincr(FILE *__f) { return *(char*)(__f->__bufpos++); }
301 +
302 +// Decrements the current read/write position by 1, returning the
303 +// character at the old position.
304 +inline char& _FILE_I_predecr(FILE *__f) { return *(char*)(--__f->__bufpos); }
305 +
306 +// Decrements the current read/write position by 1, returning the
307 +// character at the old position.
308 +inline char& _FILE_I_postdecr(FILE *__f) { return *(char*)(__f->__bufpos--); }
309 +
310 +// Increments the current read/write position by __n.
311 +inline void _FILE_I_bump(FILE *__f, int __n) { __f->__bufpos += __n; }
312 +
313 +// Sets the beginning of the bufer to __begin, the current read/write
314 +// position to __next, and the buffer's past-the-end pointer to __end.
315 +// If any of those pointers is null, then all of them must be null.
316 +inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end)
317 +{
318 + __f->__bufstart = (unsigned char*)__begin;
319 + __f->__bufpos = (unsigned char*)__next;
320 + __f->__bufend = (unsigned char*)__end;
321 + __f->__bufgetc_u = (unsigned char*)__begin;
322 + __f->__bufputc_u = (unsigned char*)__end;
323 +}
324 +
325 +# define _STLP_FILE_I_O_IDENTICAL
326 +
327 +#else // Support old stdio for a little while.
328 +
329 +inline int _FILE_fd(const FILE *__f) { return __f->filedes; }
330 +
331 +// Returns a pointer to the beginning of the buffer.
332 +inline char* _FILE_I_begin(const FILE *__f) { return (char*) __f->bufstart; }
333 +
334 +// Returns the current read/write position within the buffer.
335 +inline char* _FILE_I_next(const FILE *__f) { return (char*) __f->bufpos; }
336 +
337 +// Returns a pointer immediately past the end of the buffer.
338 +inline char* _FILE_I_end(const FILE *__f) { return (char*)__f->bufend; }
339 +
340 +// Returns the number of characters remaining in the buffer, i.e.
341 +// _FILE_[IO]_end(__f) - _FILE_[IO]_next(__f).
342 +inline ptrdiff_t _FILE_I_avail(const FILE *__f)
343 + { return __f->bufgetc - __f->bufpos; }
344 +
345 +// Increments the current read/write position by 1, returning the
346 +// character at the old position.
347 +inline char& _FILE_I_preincr(FILE *__f) { return *(char*)(++__f->bufpos); }
348 +
349 +// Increments the current read/write position by 1, returning the
350 +// character at the old position.
351 +inline char& _FILE_I_postincr(FILE *__f) { return *(char*)(__f->bufpos++); }
352 +
353 +// Decrements the current read/write position by 1, returning the
354 +// character at the old position.
355 +inline char& _FILE_I_predecr(FILE *__f) { return *(char*)(--__f->bufpos); }
356 +
357 +// Decrements the current read/write position by 1, returning the
358 +// character at the old position.
359 +inline char& _FILE_I_postdecr(FILE *__f) { return *(char*)(__f->bufpos--); }
360 +
361 +// Increments the current read/write position by __n.
362 +inline void _FILE_I_bump(FILE *__f, int __n) { __f->bufpos += __n; }
363 +
364 +// Sets the beginning of the bufer to __begin, the current read/write
365 +// position to __next, and the buffer's past-the-end pointer to __end.
366 +// If any of those pointers is null, then all of them must be null.
367 +inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end)
368 +{
369 + __f->bufstart = (unsigned char*)__begin;
370 + __f->bufpos = (unsigned char*)__next;
371 + __f->bufend = (unsigned char*)__end;
372 + __f->bufgetc = (unsigned char*)__begin;
373 + __f->bufputc = (unsigned char*)__end;
374 +}
375 +
376 +# define _STLP_FILE_I_O_IDENTICAL
377 +
378 +#endif
379 +
380 #else /* A C library that we don't have an implementation for. */
381
382 # error The C++ I/O library is not configured for this compiler
383 diff -urN STLport-4.5.3/stlport/stl/c_locale.h STLport-4.5.3-devel/stlport/stl/c_locale.h
384 --- STLport-4.5.3/stlport/stl/c_locale.h Fri Jan 18 15:07:00 2002
385 +++ STLport-4.5.3-devel/stlport/stl/c_locale.h Wed Jan 8 10:58:10 2003
386 @@ -401,6 +401,21 @@
387 # define _Locale_SPACE _S
388 # define _Locale_PRINT (_P | _U | _L | _N | _B)
389 # define _Locale_ALPHA (_U | _L)
390 +
391 +# elif defined(_STLP_USE_UCLIBC) /* linux, using the gnu compiler */
392 +
393 +# define _Locale_CNTRL _IScntrl
394 +# define _Locale_UPPER _ISupper
395 +# define _Locale_LOWER _ISlower
396 +# define _Locale_DIGIT _ISdigit
397 +# define _Locale_XDIGIT _ISxdigit
398 +# define _Locale_PUNCT _ISpunct
399 +# define _Locale_SPACE _ISspace
400 +# define _Locale_PRINT _ISprint
401 +# define _Locale_ALPHA _ISalpha
402 +
403 +#else
404 +# error Unknown Locale
405 #endif
406
407 # endif /* _STLP_C_LOCALE_H */