Re-add libXThrStub for FreeBSD that requires thread stubs. Between 6.7 and 6.8

I had moved libXThrStub into libX11, because it seemed unnecessary.  However,
because libc_r symbols are also weak, the weak stubs in libX11 would interfere,
however they don't if they are in a library linked by libX11.  The most common
manifestation of the problem was:
GThread-ERROR **: file gthread-posix.c: line 137 (g_thread_impl_init): error
'Invalid argument' during 'pthread_getschedparam (pthread_self(), &policy,
&sched)'
in glib apps.

PR:		ports/75477
Submitted by:	KIMURA Yasuhiro, yasu at utahime dot org
Testing by:	marcus
This commit is contained in:
Eric Anholt 2004-12-31 09:02:27 +00:00
parent 0223e24934
commit df0e9fb363
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=125589
10 changed files with 256 additions and 32 deletions

View file

@ -1,5 +1,5 @@
--- config/cf/FreeBSD.cf.orig Sat Aug 14 17:03:36 2004
+++ config/cf/FreeBSD.cf Sat Sep 11 15:18:01 2004
+++ config/cf/FreeBSD.cf Wed Dec 29 13:40:20 2004
@@ -78,6 +78,7 @@
#define HasIssetugid YES
#define HasPoll YES
@ -8,37 +8,49 @@
#if OSMajorVersion >= 4
#define HasGetIfAddrs YES
@@ -117,14 +118,8 @@
@@ -116,15 +117,14 @@
# endif
# if (OSRelVersion < 500043)
# define NeedUIThrStubs YES
# endif
-# endif
-# if (OSRelVersion >= 502102)
-# define ThreadsLibraries -lpthread
-# elif (OSRelVersion >= 500016)
-# define ThreadsLibraries -lc_r
-# else
+# define BuildThreadStubLibrary YES
+# define SharedX11Reqs $(LDPRELIB) $(XTHRSTUBLIB)
+# define SharedXtReqs $(LDPRELIB) $(XONLYLIB) $(SMLIB) $(ICELIB) $(XTHRSTUBLIB)
# else
-# define ThreadsLibraries -pthread
-# endif
+# define BuildThreadStubLibrary NO
# endif
-# define SystemMTDefines -D_THREAD_SAFE
+# define ThreadsLibraries FreeBSDPTHREAD_LIBS
+# define SystemMTDefines FreeBSDPTHREAD_CFLAGS
#endif
/* This fixes linking C programs against libGLU on FreeBSD 3.x */
@@ -173,10 +168,10 @@
@@ -172,12 +172,14 @@
#endif
#endif
#ifndef CcCmd
-#ifndef CcCmd
-#define CcCmd cc
+#define CcCmd FreeBSDCC
#endif
#ifndef CplusplusCmd
-#endif
-#ifndef CplusplusCmd
-#define CplusplusCmd c++
+#if BuildThreadStubLibrary && (!defined(UseInstalledX11) || !UseInstalledX11)
+#define CcCmd $(CLIENTENVSETUP) FreeBSDCC
+#define CplusplusCmd $(CLIENTENVSETUP) FreeBSDCXX
+#else
+#define CcCmd FreeBSDCC
+#define CplusplusCmd FreeBSDCXX
#endif
+
#define CppCmd /usr/bin/cpp
#define PreProcessCmd CppCmd
@@ -338,7 +333,7 @@
#define StandardCppOptions -traditional
@@ -338,7 +340,7 @@
#ifndef LibraryRpathLoadFlags
# if UseRpath
# if UseElfFormat
@ -47,7 +59,7 @@
# else
# define LibraryRpathLoadFlags -R $(USRLIBDIRPATH)
# endif
@@ -463,18 +458,8 @@
@@ -463,18 +465,8 @@
#define XawI18nDefines -DUSE_XWCHAR_STRING -DUSE_XMBTOWC
#endif

View file

@ -1,5 +1,5 @@
--- config/cf/X11.tmpl.orig Fri Sep 3 09:18:18 2004
+++ config/cf/X11.tmpl Fri Sep 10 20:29:12 2004
--- X11.tmpl.orig Fri Sep 3 09:18:18 2004
+++ config/cf/X11.tmpl Wed Dec 29 13:42:37 2004
@@ -616,7 +616,7 @@
#define BuildXft1Library BuildRenderLibrary
#endif
@ -9,7 +9,17 @@
#endif
#ifndef BuildFontconfigLibrary
#define BuildFontconfigLibrary (UseFontconfig && !HasFontconfig)
@@ -1606,7 +1606,7 @@
@@ -773,6 +773,9 @@
#ifndef ThreadedProject
#define ThreadedProject ThreadedX
#endif
+#ifndef BuildThreadStubLibrary
+#define BuildThreadStubLibrary NO
+#endif
#ifndef NeedUIThrStubs
#define NeedUIThrStubs NO
#endif
@@ -1606,7 +1609,7 @@
#endif
#ifndef PsWrap
@ -18,7 +28,7 @@
# define PsWrap $(PSWRAPSRC)/pswrap
# else
# define PsWrap pswrap
@@ -1683,7 +1683,7 @@
@@ -1683,7 +1686,7 @@
INSTAPPFLAGS = $(INSTDATFLAGS) /* XXX - this should go away - XXX */
@ -27,3 +37,43 @@
RGB = $(XBINDIR)/rgb
FONTC = $(XBINDIR)/bdftopcf
MKFONTSCALE = $(XBINDIR)/mkfontscale
@@ -1843,6 +1846,39 @@
DEPXLIBONLY = $(DEPXONLYLIB)
XLIBONLY = $(XONLYLIB)
LINTXONLYLIB = $(LINTXONLY)
+
+#if BuildThreadStubLibrary
+#ifndef SharedLibXThrStub
+#define SharedLibXThrStub YES
+#endif
+#ifndef NormalLibXThrStub
+#define NormalLibXThrStub NO
+#endif
+#ifndef DebugLibXThrStub
+#define DebugLibXThrStub NO
+#endif
+#ifndef ProfileLibXThrStub
+#define ProfileLibXThrStub NO
+#endif
+ XTHRSTUBLIBSRC = $(LIBSRC)/XThrStub
+#if SharedLibXThrStub
+#ifndef SharedXThrStubRev
+#define SharedXThrStubRev 6.1
+#endif
+SharedLibReferences(XTHRSTUB,XThrStub,$(XTHRSTUBLIBSRC),SOXTHRSTUBREV,SharedXThrStubRev)
+#else
+ProjectUnsharedLibReferences(XTHRSTUB,XThrStub,$(XTHRSTUBSRC),XBuildLibDir)
+#endif
+#else
+#undef SharedLibXThrStub
+#define SharedLibXThrStub NO
+#undef NormalLibXThrStub
+#define NormalLibXThrStub NO
+#undef DebugLibXThrStub
+#define DebugLibXThrStub NO
+#undef ProfileLibXThrStub
+#define ProfileLibXThrStub NO
+#endif
#if BuildScreenSaverLibrary
#ifndef SharedLibXss

View file

@ -1,5 +1,5 @@
--- config/cf/FreeBSD.cf.orig Sat Aug 14 17:03:36 2004
+++ config/cf/FreeBSD.cf Sat Sep 11 15:18:01 2004
+++ config/cf/FreeBSD.cf Wed Dec 29 13:40:20 2004
@@ -78,6 +78,7 @@
#define HasIssetugid YES
#define HasPoll YES
@ -8,37 +8,49 @@
#if OSMajorVersion >= 4
#define HasGetIfAddrs YES
@@ -117,14 +118,8 @@
@@ -116,15 +117,14 @@
# endif
# if (OSRelVersion < 500043)
# define NeedUIThrStubs YES
# endif
-# endif
-# if (OSRelVersion >= 502102)
-# define ThreadsLibraries -lpthread
-# elif (OSRelVersion >= 500016)
-# define ThreadsLibraries -lc_r
-# else
+# define BuildThreadStubLibrary YES
+# define SharedX11Reqs $(LDPRELIB) $(XTHRSTUBLIB)
+# define SharedXtReqs $(LDPRELIB) $(XONLYLIB) $(SMLIB) $(ICELIB) $(XTHRSTUBLIB)
# else
-# define ThreadsLibraries -pthread
-# endif
+# define BuildThreadStubLibrary NO
# endif
-# define SystemMTDefines -D_THREAD_SAFE
+# define ThreadsLibraries FreeBSDPTHREAD_LIBS
+# define SystemMTDefines FreeBSDPTHREAD_CFLAGS
#endif
/* This fixes linking C programs against libGLU on FreeBSD 3.x */
@@ -173,10 +168,10 @@
@@ -172,12 +172,14 @@
#endif
#endif
#ifndef CcCmd
-#ifndef CcCmd
-#define CcCmd cc
+#define CcCmd FreeBSDCC
#endif
#ifndef CplusplusCmd
-#endif
-#ifndef CplusplusCmd
-#define CplusplusCmd c++
+#if BuildThreadStubLibrary && (!defined(UseInstalledX11) || !UseInstalledX11)
+#define CcCmd $(CLIENTENVSETUP) FreeBSDCC
+#define CplusplusCmd $(CLIENTENVSETUP) FreeBSDCXX
+#else
+#define CcCmd FreeBSDCC
+#define CplusplusCmd FreeBSDCXX
#endif
+
#define CppCmd /usr/bin/cpp
#define PreProcessCmd CppCmd
@@ -338,7 +333,7 @@
#define StandardCppOptions -traditional
@@ -338,7 +340,7 @@
#ifndef LibraryRpathLoadFlags
# if UseRpath
# if UseElfFormat
@ -47,7 +59,7 @@
# else
# define LibraryRpathLoadFlags -R $(USRLIBDIRPATH)
# endif
@@ -463,18 +458,8 @@
@@ -463,18 +465,8 @@
#define XawI18nDefines -DUSE_XWCHAR_STRING -DUSE_XMBTOWC
#endif

View file

@ -1,5 +1,5 @@
--- config/cf/X11.tmpl.orig Fri Sep 3 09:18:18 2004
+++ config/cf/X11.tmpl Fri Sep 10 20:29:12 2004
--- X11.tmpl.orig Fri Sep 3 09:18:18 2004
+++ config/cf/X11.tmpl Wed Dec 29 13:42:37 2004
@@ -616,7 +616,7 @@
#define BuildXft1Library BuildRenderLibrary
#endif
@ -9,7 +9,17 @@
#endif
#ifndef BuildFontconfigLibrary
#define BuildFontconfigLibrary (UseFontconfig && !HasFontconfig)
@@ -1606,7 +1606,7 @@
@@ -773,6 +773,9 @@
#ifndef ThreadedProject
#define ThreadedProject ThreadedX
#endif
+#ifndef BuildThreadStubLibrary
+#define BuildThreadStubLibrary NO
+#endif
#ifndef NeedUIThrStubs
#define NeedUIThrStubs NO
#endif
@@ -1606,7 +1609,7 @@
#endif
#ifndef PsWrap
@ -18,7 +28,7 @@
# define PsWrap $(PSWRAPSRC)/pswrap
# else
# define PsWrap pswrap
@@ -1683,7 +1683,7 @@
@@ -1683,7 +1686,7 @@
INSTAPPFLAGS = $(INSTDATFLAGS) /* XXX - this should go away - XXX */
@ -27,3 +37,43 @@
RGB = $(XBINDIR)/rgb
FONTC = $(XBINDIR)/bdftopcf
MKFONTSCALE = $(XBINDIR)/mkfontscale
@@ -1843,6 +1846,39 @@
DEPXLIBONLY = $(DEPXONLYLIB)
XLIBONLY = $(XONLYLIB)
LINTXONLYLIB = $(LINTXONLY)
+
+#if BuildThreadStubLibrary
+#ifndef SharedLibXThrStub
+#define SharedLibXThrStub YES
+#endif
+#ifndef NormalLibXThrStub
+#define NormalLibXThrStub NO
+#endif
+#ifndef DebugLibXThrStub
+#define DebugLibXThrStub NO
+#endif
+#ifndef ProfileLibXThrStub
+#define ProfileLibXThrStub NO
+#endif
+ XTHRSTUBLIBSRC = $(LIBSRC)/XThrStub
+#if SharedLibXThrStub
+#ifndef SharedXThrStubRev
+#define SharedXThrStubRev 6.1
+#endif
+SharedLibReferences(XTHRSTUB,XThrStub,$(XTHRSTUBLIBSRC),SOXTHRSTUBREV,SharedXThrStubRev)
+#else
+ProjectUnsharedLibReferences(XTHRSTUB,XThrStub,$(XTHRSTUBSRC),XBuildLibDir)
+#endif
+#else
+#undef SharedLibXThrStub
+#define SharedLibXThrStub NO
+#undef NormalLibXThrStub
+#define NormalLibXThrStub NO
+#undef DebugLibXThrStub
+#define DebugLibXThrStub NO
+#undef ProfileLibXThrStub
+#define ProfileLibXThrStub NO
+#endif
#if BuildScreenSaverLibrary
#ifndef SharedLibXss

View file

@ -7,6 +7,7 @@
PORTNAME= xorg-libraries
PORTVERSION= 6.8.1
PORTREVISION= 1
CATEGORIES= x11
MASTER_SITES= ${MASTER_SITE_XORG}
MASTER_SITE_SUBDIR= X11R6.8.1/tars
@ -38,6 +39,8 @@ INSTALLS_SHLIB= yes
post-patch:
${CP} ${FILESDIR}/nls-Compose-microsoft-cp1251 ${WRKSRC}/nls/Compose/microsoft-cp1251
${MKDIR} ${WRKSRC}/lib/XThrStub
${CP} ${FILESDIR}/XThrStub-Imakefile ${WRKSRC}/lib/XThrStub/Imakefile
post-install:
${MKDIR} ${PREFIX}/libdata/pkgconfig
@ -58,4 +61,10 @@ PLIST_SUB+= OSMESA:="@comment "
PLIST_SUB+= OSMESA:=""
.endif
.if ${OSVERSION} >= 500043
PLIST_SUB+= XTHRSTUB:="@comment "
.else
PLIST_SUB+= XTHRSTUB:=""
.endif
.include <bsd.port.post.mk>

View file

@ -0,0 +1,35 @@
#define DoNormalLib NormalLibXThrStub
#define DoSharedLib SharedLibXThrStub
#define DoExtraLib SharedLibXThrStub
#define DoDebugLib DebugLibXThrStub
#define DoProfileLib ProfileLibXThrStub
#define LibName XThrStub
#define SoRev SOXTHRSTUBREV
#define LibHeaders NO
#include <Threads.tmpl>
#ifdef SharedXThrStubReqs
REQUIREDLIBS = SharedXThrStubReqs
#endif
#if NeedUIThrStubs
STUBSRCS = UIThrStubs.c
STUBOBJS = UIThrStubs.o
#endif
#if Malloc0ReturnsNull
ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
DEFINES = $(ALLOC_DEFINES)
INCLUDES =
SRCS = $(STUBSRCS)
OBJS = $(STUBOBJS)
LINTLIBS = $(LINTXLIB)
#include <Library.tmpl>
DependTarget()
LinkSourceFile(UIThrStubs.c,$(XTOP)/lib/X11)

View file

@ -0,0 +1,20 @@
Index: lib/GL/GL/Imakefile
===================================================================
RCS file: /cvs/xorg/xc/lib/GL/GL/Imakefile,v
retrieving revision 1.5
diff -u -r1.5 Imakefile
--- lib/GL/GL/Imakefile 23 Jul 2004 05:25:39 -0000 1.5
+++ lib/GL/GL/Imakefile 29 Dec 2004 20:51:25 -0000
@@ -209,8 +209,12 @@
POBJS = $(GLXPOBJS) $(DRIPOBJS) $(DRVPOBJS) $(DRMPOBJS)
#if LocalThreads
+#if NeedUIThrStubs
+ THREADOBJS = $(LDPRELIB) $(XTHRSTUBLIB)
+#else
THREADOBJS = $(THREADS_LIBS)
#endif
+#endif
#include <Library.tmpl>

View file

@ -0,0 +1,12 @@
--- lib/X11/Imakefile.orig Wed Dec 29 13:44:54 2004
+++ lib/X11/Imakefile Wed Dec 29 13:46:19 2004
@@ -126,8 +126,7 @@
K5INCL = Krb5Includes
K5DEFS = Krb5Defines
#endif
-#if (defined(FreeBSDArchitecture) && OSRelVersion < 500016) || \
- defined(OpenBSDArchitecture)
+#if (defined(OpenBSDArchitecture))
THRSTUBSRCS = UIThrStubs.c
THRSTUBOBJS = UIThrStubs.o
#endif

View file

@ -0,0 +1,22 @@
--- lib/Imakefile.orig Wed Sep 1 18:10:28 2004
+++ lib/Imakefile Wed Dec 29 13:43:31 2004
@@ -36,6 +36,10 @@
XKBUILIBDIR = xkbui
#endif
+#if BuildThreadStubLibrary && BuildLibraries
+THRSTUBLIBDIR = XThrStub
+#endif
+
#if BuildXInputLib
XINPUTLIBDIR = Xi
#endif
@@ -223,7 +227,7 @@
#endif
-LINTSUBDIRS = $(XAULIBDIR) $(XDMCPLIBDIR) $(X11LIBDIR) \
+LINTSUBDIRS = $(XAULIBDIR) $(XDMCPLIBDIR) $(THRSTUBLIBDIR) $(X11LIBDIR) \
$(OLDXLIBDIR) $(ICELIBDIR) $(SMLIBDIR) $(XEXTLIBDIR) $(XTLIBDIR) \
$(SSLIBDIR) $(XF86MISCLIBDIR) $(XF86VMLIBDIR) $(XF86DGALIBDIR) \
$(XF86RUSHLIBDIR) $(XMULIBDIR) $(XMUULIBDIR) $(XPMLIBDIR) \

View file

@ -559,6 +559,8 @@ lib/libXRes.so.1
lib/libXTrap.a
lib/libXTrap.so
lib/libXTrap.so.6
%%XTHRSTUB:%%lib/libXThrStub.so
%%XTHRSTUB:%%lib/libXThrStub.so.6
lib/libXau.a
lib/libXau.so
lib/libXau.so.0