README.Xfree3.2 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. This file describes how to make a threaded X11R6.
  2. You need the source-code of XFree-3.2. I used the sources of X11R6.1
  3. (files: xc-1.tar.gz xc-2.tar.gz xc-3.tar.gz) and the patches to
  4. XFree-3.2 (files: README.X11.patch R6.1pl1-3.2.diff.gz cfont32.tgz).
  5. Untar the xc-?.tar.gz files in a directory called XF3.2 and apply
  6. the XFree-3.2 patches as described in README.X11.patch or use the
  7. whole XFree86 source.
  8. Now apply the thread patch with
  9. patch -p0 < XF3.2.xc.diff
  10. Go to the XF3.2/xc directory and make the whole thing:
  11. nice make World >& world.log &
  12. tail -f world.log
  13. Wait a few hours or interrupt the process after the shared libs
  14. are made. The shared libs are:
  15. XF3.2/xc/lib/ICE/libICE.so.6.0*
  16. XF3.2/xc/lib/PEX5/libPEX5.so.6.0*
  17. XF3.2/xc/lib/SM/libSM.so.6.0*
  18. XF3.2/xc/lib/X11/libX11.so.6.1*
  19. XF3.2/xc/lib/XIE/libXIE.so.6.0*
  20. XF3.2/xc/lib/XThrStub/libXThrStub.so.6.0*
  21. XF3.2/xc/lib/Xaw/libXaw.so.6.1*
  22. XF3.2/xc/lib/Xext/libXext.so.6.1*
  23. XF3.2/xc/lib/Xi/libXi.so.6.0*
  24. XF3.2/xc/lib/Xmu/libXmu.so.6.0*
  25. XF3.2/xc/lib/Xt/libXt.so.6.0*
  26. XF3.2/xc/lib/Xtst/libXtst.so.6.1*
  27. (The Program dga didn't compile, but I have not check out why.)
  28. Now you can copy the resulting libs
  29. cp XF3.2/xc/lib/*/*.so.?.? /usr/X11R6/lib/
  30. and create some links
  31. cd /usr/X11R6/lib/
  32. ln -s libXThrStub.so.6.0 libXThrStub.so.6
  33. ln -s libXThrStub.so.6 libXThrStub.so
  34. or use make install (not tested, and needs new configuration).
  35. It is possible with the libXThrSub to compile X11 programs without linking
  36. libpthread to them and not necessary to recompile already installed
  37. unthreaded X11 programs, because libXThrSub keeps the dynamic linker quit.
  38. On the other hand you can link libpthread to a X11 program to use threads.
  39. I used linux 2.0.23 and libc 5.4.7 .
  40. Hans-Helmut Bühmann hans@expmech.ing.tu-bs.de
  41. ----------------------------------------------------------------------------
  42. XF3.2.xc.diff:
  43. -----------------------------------------------------------------------------
  44. diff -u --recursive XF3.2.orig/xc/config/cf/linux.cf XF3.2/xc/config/cf/linux.cf
  45. --- XF3.2.orig/xc/config/cf/linux.cf Sun Nov 10 17:05:30 1996
  46. +++ XF3.2/xc/config/cf/linux.cf Sun Nov 10 16:30:55 1996
  47. @@ -61,6 +61,14 @@
  48. #define HasSnprintf YES
  49. #endif
  50. +#define HasPosixThreads YES
  51. +#define ThreadedX YES
  52. +#define BuildThreadStubLibrary YES
  53. +#define NeedUIThrStubs YES
  54. +#define HasThreadSafeAPI NO
  55. +#define SystemMTDefines -D_REENTRANT
  56. +#define ThreadsLibraries -lpthread
  57. +
  58. #define AvoidNullMakeCommand YES
  59. #define StripInstalledPrograms YES
  60. #define CompressAllFonts YES
  61. @@ -158,7 +166,7 @@
  62. #define LdPostLib /* Never needed */
  63. #ifdef i386Architecture
  64. -#define OptimizedCDebugFlags DefaultGcc2i386Opt -m486
  65. +#define OptimizedCDebugFlags DefaultGcc2i386Opt -m486 -pipe
  66. #define StandardDefines -Dlinux -D__i386__ -D_POSIX_SOURCE \
  67. -D_BSD_SOURCE -D_SVID_SOURCE -DX_LOCALE
  68. #define XawI18nDefines -DUSE_XWCHAR_STRING -DUSE_XMBTOWC
  69. diff -u --recursive XF3.2.orig/xc/config/cf/lnxLib.tmpl XF3.2/xc/config/cf/lnxLib.tmpl
  70. --- XF3.2.orig/xc/config/cf/lnxLib.tmpl Sun Nov 10 17:05:30 1996
  71. +++ XF3.2/xc/config/cf/lnxLib.tmpl Sat Nov 9 14:52:39 1996
  72. @@ -19,7 +19,7 @@
  73. #define CplusplusLibC
  74. -#define SharedX11Reqs
  75. +#define SharedX11Reqs -L$(BUILDLIBDIR) -lXThrStub
  76. #define SharedOldXReqs $(LDPRELIB) $(XLIBONLY)
  77. #define SharedXtReqs $(LDPRELIB) $(XLIBONLY) $(SMLIB) $(ICELIB)
  78. #define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
  79. diff -u --recursive XF3.2.orig/xc/include/Xthreads.h XF3.2/xc/include/Xthreads.h
  80. --- XF3.2.orig/xc/include/Xthreads.h Thu Dec 7 02:19:09 1995
  81. +++ XF3.2/xc/include/Xthreads.h Sat Nov 9 01:04:55 1996
  82. @@ -229,12 +229,12 @@
  83. #define xcondition_wait(c,m) pthread_cond_wait(c,m)
  84. #define xcondition_signal(c) pthread_cond_signal(c)
  85. #define xcondition_broadcast(c) pthread_cond_broadcast(c)
  86. -#ifdef _DECTHREADS_
  87. +#if defined(_DECTHREADS_) || defined(linux)
  88. static xthread_t _X_no_thread_id;
  89. #define xthread_have_id(id) !pthread_equal(id, _X_no_thread_id)
  90. #define xthread_clear_id(id) id = _X_no_thread_id
  91. #define xthread_equal(id1,id2) pthread_equal(id1, id2)
  92. -#endif /* _DECTHREADS_ */
  93. +#endif /* _DECTHREADS_ || linux */
  94. #if _CMA_VENDOR_ == _CMA__IBM
  95. #ifdef DEBUG /* too much of a hack to enable normally */
  96. /* see also cma__obj_set_name() */
  97. diff -u --recursive XF3.2.orig/xc/lib/X11/util/makekeys.c XF3.2/xc/lib/X11/util/makekeys.c
  98. --- XF3.2.orig/xc/lib/X11/util/makekeys.c Mon Apr 18 02:22:22 1994
  99. +++ XF3.2/xc/lib/X11/util/makekeys.c Sat Nov 9 00:44:14 1996
  100. @@ -73,7 +73,7 @@
  101. register char c;
  102. int first;
  103. int best_max_rehash;
  104. - int best_z;
  105. + int best_z = 0;
  106. int num_found;
  107. KeySym val;
  108. diff -u --recursive XF3.2.orig/xc/lib/XThrStub/Imakefile XF3.2/xc/lib/XThrStub/Imakefile
  109. --- XF3.2.orig/xc/lib/XThrStub/Imakefile Sun Nov 10 17:08:12 1996
  110. +++ XF3.2/xc/lib/XThrStub/Imakefile Sat Nov 9 19:04:51 1996
  111. @@ -25,7 +25,7 @@
  112. DEFINES = $(ALLOC_DEFINES)
  113. INCLUDES =
  114. SRCS = $(STUBSRCS)
  115. - OBJS = $(STUBOBJS
  116. + OBJS = $(STUBOBJS)
  117. LINTLIBS = $(LINTXLIB)
  118. #include <Library.tmpl>
  119. diff -u --recursive XF3.2.orig/xc/lib/XThrStub/UIThrStubs.c XF3.2/xc/lib/XThrStub/UIThrStubs.c
  120. --- XF3.2.orig/xc/lib/XThrStub/UIThrStubs.c Sun Nov 10 17:08:12 1996
  121. +++ XF3.2/xc/lib/XThrStub/UIThrStubs.c Sun Nov 10 15:14:55 1996
  122. @@ -37,16 +37,43 @@
  123. * specificies the thread library on the link line.
  124. */
  125. +#if defined(linux)
  126. +#include <pthread.h>
  127. +#else
  128. #include <thread.h>
  129. #include <synch.h>
  130. +#endif
  131. +#if defined(linux)
  132. +static pthread_t no_thread_id;
  133. +#endif /* defined(linux) */
  134. +
  135. +#if defined(linux)
  136. +#pragma weak pthread_self = _Xthr_self_stub_
  137. +pthread_t
  138. +_Xthr_self_stub_()
  139. +{
  140. + return(no_thread_id);
  141. +}
  142. +#else /* defined(linux) */
  143. #pragma weak thr_self = _Xthr_self_stub_
  144. thread_t
  145. _Xthr_self_stub_()
  146. {
  147. return((thread_t)0);
  148. }
  149. +#endif /* defined(linux) */
  150. +#if defined(linux)
  151. +#pragma weak pthread_mutex_init = _Xmutex_init_stub_
  152. +int
  153. +_Xmutex_init_stub_(m, a)
  154. + pthread_mutex_t *m;
  155. + __const pthread_mutexattr_t *a;
  156. +{
  157. + return(0);
  158. +}
  159. +#else /* defined(linux) */
  160. #pragma weak mutex_init = _Xmutex_init_stub_
  161. int
  162. _Xmutex_init_stub_(m, t, a)
  163. @@ -56,7 +83,17 @@
  164. {
  165. return(0);
  166. }
  167. +#endif /* defined(linux) */
  168. +#if defined(linux)
  169. +#pragma weak pthread_mutex_destroy = _Xmutex_destroy_stub_
  170. +int
  171. +_Xmutex_destroy_stub_(m)
  172. + pthread_mutex_t *m;
  173. +{
  174. + return(0);
  175. +}
  176. +#else /* defined(linux) */
  177. #pragma weak mutex_destroy = _Xmutex_destroy_stub_
  178. int
  179. _Xmutex_destroy_stub_(m)
  180. @@ -64,7 +101,17 @@
  181. {
  182. return(0);
  183. }
  184. +#endif /* defined(linux) */
  185. +#if defined(linux)
  186. +#pragma weak pthread_mutex_lock = _Xmutex_lock_stub_
  187. +int
  188. +_Xmutex_lock_stub_(m)
  189. + pthread_mutex_t *m;
  190. +{
  191. + return(0);
  192. +}
  193. +#else /* defined(linux) */
  194. #pragma weak mutex_lock = _Xmutex_lock_stub_
  195. int
  196. _Xmutex_lock_stub_(m)
  197. @@ -72,7 +119,17 @@
  198. {
  199. return(0);
  200. }
  201. +#endif /* defined(linux) */
  202. +#if defined(linux)
  203. +#pragma weak pthread_mutex_unlock = _Xmutex_unlock_stub_
  204. +int
  205. +_Xmutex_unlock_stub_(m)
  206. + pthread_mutex_t *m;
  207. +{
  208. + return(0);
  209. +}
  210. +#else /* defined(linux) */
  211. #pragma weak mutex_unlock = _Xmutex_unlock_stub_
  212. int
  213. _Xmutex_unlock_stub_(m)
  214. @@ -80,7 +137,18 @@
  215. {
  216. return(0);
  217. }
  218. +#endif /* defined(linux) */
  219. +#if defined(linux)
  220. +#pragma weak pthread_cond_init = _Xcond_init_stub_
  221. +int
  222. +_Xcond_init_stub_(c, a)
  223. + pthread_cond_t *c;
  224. + __const pthread_condattr_t *a;
  225. +{
  226. + return(0);
  227. +}
  228. +#else /* defined(linux) */
  229. #pragma weak cond_init = _Xcond_init_stub_
  230. int
  231. _Xcond_init_stub_(c, t, a)
  232. @@ -90,7 +158,17 @@
  233. {
  234. return(0);
  235. }
  236. +#endif /* defined(linux) */
  237. +#if defined(linux)
  238. +#pragma weak pthread_cond_destroy = _Xcond_destroy_stub_
  239. +int
  240. +_Xcond_destroy_stub_(c)
  241. + pthread_cond_t *c;
  242. +{
  243. + return(0);
  244. +}
  245. +#else /* defined(linux) */
  246. #pragma weak cond_destroy = _Xcond_destroy_stub_
  247. int
  248. _Xcond_destroy_stub_(c)
  249. @@ -98,7 +176,18 @@
  250. {
  251. return(0);
  252. }
  253. +#endif /* defined(linux) */
  254. +#if defined(linux)
  255. +#pragma weak pthread_cond_wait = _Xcond_wait_stub_
  256. +int
  257. +_Xcond_wait_stub_(c,m)
  258. + pthread_cond_t *c;
  259. + pthread_mutex_t *m;
  260. +{
  261. + return(0);
  262. +}
  263. +#else /* defined(linux) */
  264. #pragma weak cond_wait = _Xcond_wait_stub_
  265. int
  266. _Xcond_wait_stub_(c,m)
  267. @@ -107,7 +196,17 @@
  268. {
  269. return(0);
  270. }
  271. +#endif /* defined(linux) */
  272. +#if defined(linux)
  273. +#pragma weak pthread_cond_signal = _Xcond_signal_stub_
  274. +int
  275. +_Xcond_signal_stub_(c)
  276. + pthread_cond_t *c;
  277. +{
  278. + return(0);
  279. +}
  280. +#else /* defined(linux) */
  281. #pragma weak cond_signal = _Xcond_signal_stub_
  282. int
  283. _Xcond_signal_stub_(c)
  284. @@ -115,7 +214,17 @@
  285. {
  286. return(0);
  287. }
  288. +#endif /* defined(linux) */
  289. +#if defined(linux)
  290. +#pragma weak pthread_cond_broadcast = _Xcond_broadcast_stub_
  291. +int
  292. +_Xcond_broadcast_stub_(c)
  293. + pthread_cond_t *c;
  294. +{
  295. + return(0);
  296. +}
  297. +#else /* defined(linux) */
  298. #pragma weak cond_broadcast = _Xcond_broadcast_stub_
  299. int
  300. _Xcond_broadcast_stub_(c)
  301. @@ -123,3 +232,15 @@
  302. {
  303. return(0);
  304. }
  305. +#endif /* defined(linux) */
  306. +
  307. +#if defined(linux)
  308. +#pragma weak pthread_equal = _Xthr_equal_stub_
  309. +int
  310. +_Xthr_equal_stub_(t1, t2)
  311. + pthread_t t1;
  312. + pthread_t t2;
  313. +{
  314. + return(1);
  315. +}
  316. +#endif /* defined(linux) */
  317. -------------------------------------------------------------------------