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