From df0e9fb3631b972a11189fa8a702afc67006f7d5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 31 Dec 2004 09:02:27 +0000 Subject: [PATCH] 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 --- .../xorg-server-snap/files/patch-FreeBSD.cf | 36 ++++++++---- .../xorg-server-snap/files/patch-X11.tmpl | 58 +++++++++++++++++-- .../xorg-server/files/patch-FreeBSD.cf | 36 ++++++++---- x11-servers/xorg-server/files/patch-X11.tmpl | 58 +++++++++++++++++-- x11/xorg-libraries/Makefile | 9 +++ x11/xorg-libraries/files/XThrStub-Imakefile | 35 +++++++++++ .../files/patch-GL-GL-Imakefile | 20 +++++++ x11/xorg-libraries/files/patch-X11-Imakefile | 12 ++++ x11/xorg-libraries/files/patch-lib-Imakefile | 22 +++++++ x11/xorg-libraries/pkg-plist | 2 + 10 files changed, 256 insertions(+), 32 deletions(-) create mode 100644 x11/xorg-libraries/files/XThrStub-Imakefile create mode 100644 x11/xorg-libraries/files/patch-GL-GL-Imakefile create mode 100644 x11/xorg-libraries/files/patch-X11-Imakefile create mode 100644 x11/xorg-libraries/files/patch-lib-Imakefile diff --git a/x11-servers/xorg-server-snap/files/patch-FreeBSD.cf b/x11-servers/xorg-server-snap/files/patch-FreeBSD.cf index 391afe1b7cae..b2c195f77b75 100644 --- a/x11-servers/xorg-server-snap/files/patch-FreeBSD.cf +++ b/x11-servers/xorg-server-snap/files/patch-FreeBSD.cf @@ -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 diff --git a/x11-servers/xorg-server-snap/files/patch-X11.tmpl b/x11-servers/xorg-server-snap/files/patch-X11.tmpl index bdd12fbbb3e2..c27d14d8e1ec 100644 --- a/x11-servers/xorg-server-snap/files/patch-X11.tmpl +++ b/x11-servers/xorg-server-snap/files/patch-X11.tmpl @@ -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 diff --git a/x11-servers/xorg-server/files/patch-FreeBSD.cf b/x11-servers/xorg-server/files/patch-FreeBSD.cf index 391afe1b7cae..b2c195f77b75 100644 --- a/x11-servers/xorg-server/files/patch-FreeBSD.cf +++ b/x11-servers/xorg-server/files/patch-FreeBSD.cf @@ -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 diff --git a/x11-servers/xorg-server/files/patch-X11.tmpl b/x11-servers/xorg-server/files/patch-X11.tmpl index bdd12fbbb3e2..c27d14d8e1ec 100644 --- a/x11-servers/xorg-server/files/patch-X11.tmpl +++ b/x11-servers/xorg-server/files/patch-X11.tmpl @@ -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 diff --git a/x11/xorg-libraries/Makefile b/x11/xorg-libraries/Makefile index 70a214ea89a2..138e45a9bc1d 100644 --- a/x11/xorg-libraries/Makefile +++ b/x11/xorg-libraries/Makefile @@ -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 diff --git a/x11/xorg-libraries/files/XThrStub-Imakefile b/x11/xorg-libraries/files/XThrStub-Imakefile new file mode 100644 index 000000000000..83e850325c9a --- /dev/null +++ b/x11/xorg-libraries/files/XThrStub-Imakefile @@ -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 + +#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 + +DependTarget() + +LinkSourceFile(UIThrStubs.c,$(XTOP)/lib/X11) diff --git a/x11/xorg-libraries/files/patch-GL-GL-Imakefile b/x11/xorg-libraries/files/patch-GL-GL-Imakefile new file mode 100644 index 000000000000..69f1eb2c40d7 --- /dev/null +++ b/x11/xorg-libraries/files/patch-GL-GL-Imakefile @@ -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 + diff --git a/x11/xorg-libraries/files/patch-X11-Imakefile b/x11/xorg-libraries/files/patch-X11-Imakefile new file mode 100644 index 000000000000..f8bba66d39ed --- /dev/null +++ b/x11/xorg-libraries/files/patch-X11-Imakefile @@ -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 diff --git a/x11/xorg-libraries/files/patch-lib-Imakefile b/x11/xorg-libraries/files/patch-lib-Imakefile new file mode 100644 index 000000000000..9db3ac355f73 --- /dev/null +++ b/x11/xorg-libraries/files/patch-lib-Imakefile @@ -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) \ diff --git a/x11/xorg-libraries/pkg-plist b/x11/xorg-libraries/pkg-plist index 22b530f0ce65..46c44c9b6ff6 100644 --- a/x11/xorg-libraries/pkg-plist +++ b/x11/xorg-libraries/pkg-plist @@ -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