STLport-4.5.3.patch 13 KB

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