From d8a25946ef06217c10d6a5c7caf693f6bfd24c8b Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 13 Apr 2017 12:00:26 +0200 Subject: nx-X11/config/cf/gnu*: Re-introduce GNU/Hurd support to the nx-X11 buildflow. --- nx-X11/config/cf/gnu.cf | 183 ++++++++++++++++++++++++++++++++++++++++++ nx-X11/config/cf/gnuLib.rules | 172 +++++++++++++++++++++++++++++++++++++++ nx-X11/config/cf/gnuLib.tmpl | 6 ++ 3 files changed, 361 insertions(+) create mode 100644 nx-X11/config/cf/gnu.cf create mode 100644 nx-X11/config/cf/gnuLib.rules create mode 100644 nx-X11/config/cf/gnuLib.tmpl diff --git a/nx-X11/config/cf/gnu.cf b/nx-X11/config/cf/gnu.cf new file mode 100644 index 000000000..c7dd071fe --- /dev/null +++ b/nx-X11/config/cf/gnu.cf @@ -0,0 +1,183 @@ +#ifndef OSName +#define OSName DefaultOSName +#endif + +#ifndef OSVendor +#define OSVendor /**/ +#endif +#ifndef OSMajorVersion +#define OSMajorVersion DefaultOSMajorVersion +#endif +#ifndef OSMinorVersion +#define OSMinorVersion DefaultOSMinorVersion +#endif +#ifndef OSTeenyVersion +#define OSTeenyVersion DefaultOSTeenyVersion +#endif +XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVersion) + +#define GNUSourceDefines -D_POSIX_C_SOURCE=199309L \ + -D_POSIX_SOURCE -D_XOPEN_SOURCE \ + -D_DEFAULT_SOURCE + +XCOMM XXXMB: What about _GNU_SOURCE, see Linux/UseInstalled? + +#define XawI18nDefines -DHAS_WCHAR_H -DHAS_WCTYPE_H -DNO_WIDEC_H + +#define HasPosixThreads YES +#define ThreadedX YES +#define HasThreadSafeAPI YES +#define ThreadsLibraries -lpthread +#define SystemMTDefines -D_REENTRANT + +#ifndef HasLibCrypt +#define HasLibCrypt YES +#endif + +#ifndef BuildXF86RushExt +# define BuildXF86RushExt YES +#endif + +#define BuildLibPathVar LD_LIBRARY_PATH +#define GccUsesGas YES +#define UseGas YES +#define GnuCpp YES +#define HasDlopen YES +#ifndef HasShadowPasswd +# define HasShadowPasswd YES +#endif +#define HasPutenv YES + +XCOMM Not implemented and will always fail. +#ifndef HasShm +# define HasShm YES +#endif + +#define HasBSD44Sockets YES +#define HasSockets YES +#define HasSnprintf YES +#define HasMkstemp YES +#define HasUsableFileMmap YES +#ifndef HasNCurses +#define HasNCurses YES +#endif + +#define AvoidNullMakeCommand YES +#ifndef DebuggableLibraries +#define DebuggableLibraries NO +#endif +#define CompressAllFonts YES +#define Malloc0ReturnsNull YES +#define NeedConstPrototypes YES +#define NeedFunctionPrototypes YES +#define NeedNestedPrototypes YES +#define NeedVarargsPrototypes YES +#ifndef NeedWidePrototypes +#define NeedWidePrototypes NO +#endif +#define SetTtyGroup YES + +#ifndef UseStaticTermcapLib +#define UseStaticTermcapLib NO +#endif + +#define MkdirHierCmd mkdir -p +#ifndef CcCmd +#define CcCmd gcc +#endif +#ifndef AsCmd +#define AsCmd as +#endif +#ifndef LdCmd +#define LdCmd ld +#endif + +#define AsmDefines -D__ELF__ +#define CplusplusCmd c++ +#ifndef TermcapLibrary +#if UseStaticTermcapLib +#define TermcapLibrary StaticLibrary(/usr/lib,ncurses) +#else +#define TermcapLibrary -lncurses +#endif +#endif +#ifndef DoLoadableServer +#define DoLoadableServer YES +#endif +#ifndef CppCmd +#define CppCmd /lib/cpp +#endif +#define YaccCmd bison -y +#define LexCmd flex -l +#define HasFlex YES +#define LexLib -lfl +#define PreProcessCmd CcCmd -E +#define PostIncDir DefaultGccIncludeDir +#define LdCombineFlags -r +#ifndef LdPostLib +#define LdPostLib /* Never needed */ +#endif +#define HasWChar32 YES +#define StandardCppOptions -traditional +#define StandardCppDefines StandardDefines + +#define HasVarRun YES +#define VarDbDirectory $(VARDIR)/lib + +XCOMM i386Architecture +#define OptimizedCDebugFlags DefaultGcc2i386Opt +#define GNUMachineDefines -D__i386__ +#define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +#define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines +#define HasPlugin YES +#define VendorHasX11R6_3libXext YES + +#ifndef StandardDefines +#define StandardDefines GNUMachineDefines GNUSourceDefines +#endif + +#define DlLibrary -rdynamic -ldl + +#define ServerExtraSysLibs /**/ + +#define ConnectionFlags -DUNIXCONN -DTCPCONN + +/* Some of these man page defaults are overriden in the above OS sections */ +#ifndef ManSuffix +# define ManSuffix 1x +#endif +#ifndef ManDir +# define ManDir $(MANSOURCEPATH)1 +#endif +#ifndef LibManSuffix +# define LibManSuffix 3x +#endif +#ifndef LibmanDir +# define LibmanDir $(MANSOURCEPATH)3 +#endif +#ifndef FileManSuffix +# define FileManSuffix 5x +#endif +#ifndef FileManDir +# define FileManDir $(MANSOURCEPATH)5 +#endif + +#ifndef StaticLibrary +#define StaticLibrary(libpath,libname) -Wl,-Bstatic Concat(-L,libpath) Concat(-l,libname) -Wl,-Bdynamic +#endif + +#define HasGnuMake YES + +#define MakeNamedTargetSubdir(dir,flags,subname)\ + $(MAKE) -C dir $(MFLAGS) $(PARALLELMFLAGS) flags subname + +#define ArchitectureDefines -DGNU_ARCHITECTURE + +#define XserverNeedsSetUID NO + +#include + +XCOMM XXX Might need this if they are not careful with slashes. +XCOMM #define DirFailPrefix - + +#include diff --git a/nx-X11/config/cf/gnuLib.rules b/nx-X11/config/cf/gnuLib.rules new file mode 100644 index 000000000..0282bfb0f --- /dev/null +++ b/nx-X11/config/cf/gnuLib.rules @@ -0,0 +1,172 @@ +/* + * GNU/Hurd shared library rules + * + * $XFree86: xc/config/cf/gnuLib.rules,v 1.9 2003/10/11 09:40:13 herrb Exp $ + */ + +/* + * GNU/Hurd shared library rules + * Cloned from Linux (ELF) shared library rules + * + */ + +#ifndef HasSharedLibraries +#define HasSharedLibraries YES +#endif +#ifndef ForceNormalLib +#define ForceNormalLib NO +#endif + +XCOMM XXX To rpath or not to rpath... +#ifndef UseRpath +#define UseRpath YES +#endif + +#undef SpecialMalloc +#define SpecialMalloc NO + +#define BaseShLibReqs -lc + +#ifndef SharedDataSeparation +#define SharedDataSeparation NO +#endif +#ifndef SharedCodeDef +#define SharedCodeDef /**/ +#endif +#ifndef SharedLibraryDef +#define SharedLibraryDef /**/ +#endif +#ifndef ShLibIncludeFile +#define ShLibIncludeFile +#endif +#ifndef RpathLoadFlags +#if UseRpath +#define RpathLoadFlags -Wl,-rpath=$(USRLIBDIRPATH) +#else +#define RpathLoadFlags /**/ +#endif +#endif +#ifndef LibraryRpathLoadFlags +#define LibraryRpathLoadFlags RpathLoadFlags +#endif +#ifndef SharedLibraryLoadFlags +#define SharedLibraryLoadFlags -shared LibraryRpathLoadFlags +#endif +#ifndef PositionIndependentCFlags +#define PositionIndependentCFlags -fPIC +#endif +#ifndef PositionIndependentCplusplusFlags +#define PositionIndependentCplusplusFlags -fPIC +#endif +#ifndef ExtraLoadFlags +#ifdef UseInstalled +XCOMM XXX Maybe superfluous. +#define ExtraLoadFlags RpathLoadFlags -Wl,-rpath-link=$(USRLIBDIRPATH) +#else +#define ExtraLoadFlags RpathLoadFlags -Wl,-rpath-link=$(BUILDLIBDIR) +#endif +#endif + +/* + * InstallSharedLibrary - generate rules to install the shared library. + * NOTE: file must be executable, hence "INSTBINFLAGS" + */ +#ifndef InstallSharedLibrary +#define InstallSharedLibrary(libname,rev,dest) @@\ +install:: Concat(lib,libname.so.rev) @@\ + MakeDir($(DESTDIR)dest) @@\ + $(INSTALL) $(INSTALLFLAGS) $(INSTBINFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\ + @T=`echo Concat($(DESTDIR)dest/lib,libname.so.rev) | sed 's/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`;\ + set -x; $(RM) $$T && $(LN) Concat(lib,libname.so.rev) $$T @@\ + @if $(SOSYMLINK); then (set -x; \ + $(RM) Concat($(DESTDIR)dest/lib,libname.so); \ @@\ + $(LN) Concat(lib,libname.so.rev) Concat($(DESTDIR)dest/lib,libname.so)); fi +#endif /* InstallSharedLibrary */ + +/* + * InstallSharedLibraryData - generate rules to install the shared library data + */ +#ifndef InstallSharedLibraryData +#define InstallSharedLibraryData(libname,rev,dest) +#endif /* InstallSharedLibraryData */ + + +/* + * SharedLibraryTarget - generate rules to create a shared library; + * build it into a different name so that we do not hose people by having + * the library gone for long periods. + */ +#ifndef SharedLibraryTarget +#define SharedLibraryTarget(libname,rev,solist,down,up) @@\ +AllTarget(Concat(lib,libname.so.rev)) @@\ + @@\ +Concat(lib,libname.so.rev): solist $(EXTRALIBRARYDEPS) @@\ + $(RM) $@~ @@\ + @SONAME=`echo $@ | sed 's/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; set -x; \ @@\ + (cd down; $(CC) -o up/$@~ $(SHLIBLDFLAGS) -Wl,-soname,$$SONAME solist $(REQUIREDLIBS) BaseShLibReqs); \ @@\ + $(RM) $$SONAME; $(LN) $@ $$SONAME; \ @@\ + LinkBuildSonameLibrary($$SONAME) @@\ + $(RM) $@ @@\ + $(MV) $@~ $@ @@\ + @if $(SOSYMLINK); then (set -x; \ @@\ + $(RM) Concat(lib,libname.so); \ @@\ + $(LN) $@ Concat(lib,libname.so)); fi @@\ + LinkBuildLibrary($@) @@\ + LinkBuildLibraryMaybe(Concat(lib,libname.so),$(SOSYMLINK)) @@\ + @@\ +clean:: @@\ + @MAJREV=`echo rev | sed 's/\([0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; \ @@\ + set -x; $(RM) Concat(lib,libname.so.$$MAJREV) @@\ + $(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so) + +#endif /* SharedLibraryTarget */ + +/* + * SharedDepLibraryTarget - generate rules to create a shared library. + */ +#ifndef SharedDepLibraryTarget +#define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up) @@\ +AllTarget(Concat(lib,libname.so.rev)) @@\ + @@\ +Concat(lib,libname.so.rev): deplist $(EXTRALIBRARYDEPS) @@\ + $(RM) $@~ @@\ + @SONAME=`echo $@ | sed 's/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; set -x; \ @@\ + (cd down; $(CC) -o up/$@~ $(SHLIBLDFLAGS) -Wl,-soname,$$SONAME solist $(REQUIREDLIBS) BaseShLibReqs); \ @@\ + $(RM) $$SONAME; $(LN) $@ $$SONAME; \ @@\ + LinkBuildSonameLibrary($$SONAME) @@\ + $(RM) $@ @@\ + $(MV) $@~ $@ @@\ + @if $(SOSYMLINK); then (set -x; \ @@\ + $(RM) Concat(lib,libname.so); \ @@\ + $(LN) $@ Concat(lib,libname.so)); fi @@\ + LinkBuildLibrary($@) @@\ + LinkBuildLibraryMaybe(Concat(lib,libname.so),$(SOSYMLINK)) @@\ + @@\ +clean:: @@\ + @MAJREV=`echo rev | sed 's/\([0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; \ @@\ + set -x; $(RM) Concat(lib,libname.so.$$MAJREV) @@\ + $(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so) + +#endif /* SharedDepLibraryTarget */ + +#ifndef SharedDepModuleTarget +#define SharedDepModuleTarget(name,deps,solist) @@\ +AllTarget(name) @@\ + @@\ +name: deps @@\ + $(RM) $@~ @@\ + $(CC) -o $@~ $(SHLIBLDFLAGS) solist $(REQUIREDLIBS) BaseShLibReqs @@\ + $(RM) $@ @@\ + $(MV) $@~ $@ @@\ + @@\ +clean:: @@\ + $(RM) name + +#endif /* SharedDepModuleTarget */ + +/* + * SharedLibraryDataTarget - generate rules to create shlib data file; + */ +#ifndef SharedLibraryDataTarget +#define SharedLibraryDataTarget(libname,rev,salist) +#endif /* SharedLibraryTarget */ diff --git a/nx-X11/config/cf/gnuLib.tmpl b/nx-X11/config/cf/gnuLib.tmpl new file mode 100644 index 000000000..97917ba5a --- /dev/null +++ b/nx-X11/config/cf/gnuLib.tmpl @@ -0,0 +1,6 @@ +XCOMM +XCOMM GNU Hurd shared library template +XCOMM + +#define SharedX11Reqs +#define SharedXlibi18nReqs $(LDPRELIB) $(XONLYLIB) -- cgit v1.2.3 From 681069d7a42d955a3cbe302f40564f4266185908 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 13 Apr 2017 12:01:07 +0200 Subject: nxcompshad/Shadow.cpp: Use EBADF instead of EBADFD (which is not portable to GNU/Hurd and GNU/kFreeBSD). We use the error code (and its underlying message for generating log errors and their textual messages. So, in theory, we could use any error code here. Thus, choosing the once closest to EBADFD while being portable to non-Linux systems. --- nxcompshad/Shadow.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nxcompshad/Shadow.cpp b/nxcompshad/Shadow.cpp index 4a28f2c52..643a5a807 100644 --- a/nxcompshad/Shadow.cpp +++ b/nxcompshad/Shadow.cpp @@ -144,7 +144,7 @@ static int NXCreatePoller(Display *display, Display **shadowDisplay) if (input == NULL) { - logError("NXCreatePoller", ESET(EBADFD)); + logError("NXCreatePoller", ESET(EBADF)); return -1; } @@ -179,7 +179,7 @@ static int NXCreateUpdateManager() if (input == NULL || poller == NULL) { - logError("NXCreateUpdateManager", ESET(EBADFD)); + logError("NXCreateUpdateManager", ESET(EBADF)); return -1; } @@ -354,7 +354,7 @@ void NXShadowHandleInput() if (NXShadowNotInitialized()) { - logError("NXShadowHandleInput - NXShadow not properly initialized.", ESET(EBADFD)); + logError("NXShadowHandleInput - NXShadow not properly initialized.", ESET(EBADF)); return; } @@ -374,7 +374,7 @@ int NXShadowHasChanged(int (*callback)(void *), void *arg, int *suspended) if (NXShadowNotInitialized()) { - logError("NXShadowHasChanged - NXShadow not properly initialized.", ESET(EBADFD)); + logError("NXShadowHasChanged - NXShadow not properly initialized.", ESET(EBADF)); return -1; } @@ -415,7 +415,7 @@ void NXShadowExportChanges(long *numRects, char **pBox) if (NXShadowNotInitialized()) { - logError("NXShadowExportChanges - NXShadow not properly initialized.", ESET(EBADFD)); + logError("NXShadowExportChanges - NXShadow not properly initialized.", ESET(EBADF)); } updateManager -> update(); -- cgit v1.2.3