diff --git a/SConscript.q3map2 b/SConscript.q3map2 index 8229b8c9..9a2c240d 100644 --- a/SConscript.q3map2 +++ b/SConscript.q3map2 @@ -4,13 +4,17 @@ # http://scons.org/ import os +import platform Import( [ 'utils', 'config', 'settings', 'lib_objects' ] ) env = Environment( ENV = os.environ ) settings.SetupEnvironment( env, config['name'] ) env.Prepend( CPPPATH = [ '#tools/quake3/common' ] ) -env.Append( LIBS = [ 'm', 'pthread', 'png', 'jpeg' ] ) +if platform.system() == "NetBSD": + env.Append( LIBS = [ 'm', 'pthread', 'jpeg', 'png16' ] ) +else: + env.Append( LIBS = [ 'm', 'pthread', 'jpeg', 'png' ] ) proj = utils.vcxproj( os.path.join( GetLaunchDir(), 'tools/quake3/q3map2/q3map2.vcxproj' ) ) objects = lib_objects objects += [ os.path.join( 'tools/quake3/q3map2', i ) for i in proj.getSourceFiles() ] diff --git a/SConscript.q3map2.urt b/SConscript.q3map2.urt index 50e1ad69..b9374f07 100644 --- a/SConscript.q3map2.urt +++ b/SConscript.q3map2.urt @@ -4,13 +4,17 @@ # http://scons.org/ import os +import platform Import( [ 'utils', 'config', 'settings', 'lib_objects' ] ) env = Environment( ENV = os.environ ) settings.SetupEnvironment( env, config['name'] ) env.Prepend( CPPPATH = [ '#tools/quake3/common', ] ) -env.Append( LIBS = [ 'm', 'pthread', 'png', 'jpeg' ] ) +if platform.system() == "NetBSD": + env.Append( LIBS = [ 'm', 'pthread', 'jpeg', 'png16' ] ) +else: + env.Append( LIBS = [ 'm', 'pthread', 'jpeg', 'png' ] ) proj = utils.vcxproj( os.path.join( GetLaunchDir(), 'tools/urt/tools/quake3/q3map2/q3map2_urt.vcxproj' ) ) objects = lib_objects diff --git a/SConscript.radiant b/SConscript.radiant index 66853d39..0196198b 100644 --- a/SConscript.radiant +++ b/SConscript.radiant @@ -11,7 +11,7 @@ Import( [ 'utils', 'config', 'settings', 'lib_objects' ] ) env = Environment( ENV = os.environ ) settings.SetupEnvironment( env, config[ 'name' ], useGtk = True, useGtkGL = True ) -if ( platform.system() != 'FreeBSD' ): +if ( platform.system() not in ['FreeBSD', 'OpenBSD', 'NetBSD'] ): env.Append( LIBS = [ 'dl' ] ) proj = utils.vcxproj( os.path.join( GetLaunchDir(), 'radiant/radiant.vcxproj' ) ) diff --git a/config.py b/config.py index 0751fa51..47339cc8 100644 --- a/config.py +++ b/config.py @@ -29,7 +29,7 @@ class Config: self.config_selected = [ 'release' ] # those are global to each config self.platform = platform.system() - if ( self.platform == 'FreeBSD' ): + if ( self.platform in ['FreeBSD', 'OpenBSD', 'NetBSD'] ): self.cc = 'cc' self.cxx = 'c++' else: @@ -236,7 +236,13 @@ class Config: env.ParseConfig( 'pkg-config --libs libxml-2.0' ) #Need to strip on xml2-config output. It has a stray \n and that completely screws up scons calling g++ baseflags = [ '-pipe', '-Wall', '-fmessage-length=0', '-fvisibility=hidden', xml2.strip().split( ' ' ) ] + if ( platform.system() == "OpenBSD" ): + baseflags = [ '-I/usr/X11R6/include', '-I/usr/local/include', '-pipe', '-Wall', '-fmessage-length=0', '-fvisibility=hidden', xml2.strip().split( ' ' ) ] + if ( platform.system() == "NetBSD" ) : + baseflags = [ '-I/usr/X11R7/include', '-I/usr/include', '-pipe', '-Wall', '-fmessage-length=0', '-fvisibility=hidden', xml2.strip().split( ' ' ) ] + if ( platform.system() in ['OpenBSD', 'FreeBSD', 'NetBSD'] ) : + baseflags += ['-D__BSD__'] if ( useGtk ): env.ParseConfig( 'pkg-config gtk+-2.0 --cflags --libs' ) env.ParseConfig( 'pkg-config x11 --cflags --libs' ) @@ -251,6 +257,8 @@ class Config: env.Append( LIBS = 'jpeg' ) if ( usePNG ): pnglibs = 'png' + if ( self.platform == 'NetBSD'): + pnglibs = 'png16' env.Append( LIBS = pnglibs.split( ' ' ) ) env.ParseConfig( 'pkg-config zlib --cflags --libs' ) if ( useZ ): diff --git a/contrib/bobtoolz/StdAfx.h b/contrib/bobtoolz/StdAfx.h index 5e90a887..dca84ce2 100644 --- a/contrib/bobtoolz/StdAfx.h +++ b/contrib/bobtoolz/StdAfx.h @@ -35,7 +35,7 @@ #include "time.h" -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) // Necessary for proper boolean type declaration #include "qertypes.h" @@ -116,7 +116,7 @@ typedef struct tagRECT typedef uint UINT; -#endif // defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#endif // defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include "synapse.h" #include "iplugin.h" diff --git a/contrib/bobtoolz/misc.cpp b/contrib/bobtoolz/misc.cpp index 4faa0fd5..4d565351 100644 --- a/contrib/bobtoolz/misc.cpp +++ b/contrib/bobtoolz/misc.cpp @@ -195,7 +195,7 @@ extern const char* PLUGIN_NAME; return buffer; }*/ -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) // the bCreateConsole parameter is ignored on linux .. bool Q_Exec( const char *pCmd, bool bCreateConsole ){ switch ( fork() ) diff --git a/contrib/camera/funchandlers.cpp b/contrib/camera/funchandlers.cpp index ddbea474..bb14402c 100644 --- a/contrib/camera/funchandlers.cpp +++ b/contrib/camera/funchandlers.cpp @@ -29,7 +29,7 @@ extern GtkWidget *g_pEditModeAddRadioButton; char* Q_realpath( const char *path, char *resolved_path, size_t size ){ -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) return realpath( path, resolved_path ); #else return _fullpath( resolved_path, path, size ); diff --git a/contrib/gtkgensurf/gensurf.h b/contrib/gtkgensurf/gensurf.h index 9bb24f0a..1607480c 100644 --- a/contrib/gtkgensurf/gensurf.h +++ b/contrib/gtkgensurf/gensurf.h @@ -35,7 +35,7 @@ #define PLUGIN #define Q3RADIANT -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) template inline T min( T x, T y ) { return ( x < y ) ? x : y; } template diff --git a/contrib/prtview/prtview.cpp b/contrib/prtview/prtview.cpp index cbbdcf75..b87b8334 100644 --- a/contrib/prtview/prtview.cpp +++ b/contrib/prtview/prtview.cpp @@ -73,7 +73,7 @@ void InitInstance(){ strcat( INIfn, fn_dir ); strcat( INIfn, fn_name ); strcat( INIfn, ".ini" ); -#else // if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#else // if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) strcpy( INIfn, g_get_home_dir() ); strcat( INIfn, "/.radiant/" ); strcat( INIfn, RADIANT_VERSION ); @@ -166,7 +166,7 @@ _QERQglTable g_QglTable; #define CONFIG_SECTION "Configuration" -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) static bool read_var( const char *filename, const char *section, const char *key, char *value ){ char line[1024], *ptr; @@ -316,7 +316,7 @@ static bool save_var( const char *filename, const char *section, const char *key #endif int INIGetInt( const char *key, int def ){ -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) char value[1024]; if ( read_var( INIfn, CONFIG_SECTION, key, value ) ) { @@ -339,7 +339,7 @@ void INISetInt( const char *key, int val, const char *comment /* = NULL */ ){ else{ sprintf( s, "%d", val ); } -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) save_var( INIfn, CONFIG_SECTION, key, s ); #else WritePrivateProfileString( CONFIG_SECTION, key, s, INIfn ); diff --git a/contrib/prtview/stdafx.h b/contrib/prtview/stdafx.h index 5b9d9093..33f294b6 100644 --- a/contrib/prtview/stdafx.h +++ b/contrib/prtview/stdafx.h @@ -24,7 +24,7 @@ #include #include -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include // Necessary for proper boolean type declaration @@ -46,7 +46,7 @@ typedef int BOOL; #define IDOK 1 #define IDCANCEL 2 -#endif // defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#endif // defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include "synapse.h" diff --git a/libs/cmdlib/cmdlib.cpp b/libs/cmdlib/cmdlib.cpp index 8736ddf8..72646318 100644 --- a/libs/cmdlib/cmdlib.cpp +++ b/libs/cmdlib/cmdlib.cpp @@ -28,7 +28,7 @@ #ifdef _WIN32 #include #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #endif @@ -36,7 +36,7 @@ // NOTE: we don't use this crap .. with the total mess of mixing win32/unix paths we need to recognize both '/' and '\\' #define PATHSEPERATOR '/' -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) bool Q_Exec( const char *cmd, char *cmdline, const char *execdir, bool bCreateConsole ){ char fullcmd[2048]; char *pCmd; diff --git a/libs/l_net/l_net.c b/libs/l_net/l_net.c index c34e9cbf..b4ff42c2 100644 --- a/libs/l_net/l_net.c +++ b/libs/l_net/l_net.c @@ -80,7 +80,7 @@ void Net_SetAddressPort( address_t *address, int port ){ int Net_AddressCompare( address_t *addr1, address_t *addr2 ){ #ifdef _WIN32 return stricmp( addr1->ip, addr2->ip ); -#elif defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#elif defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) return strcasecmp( addr1->ip, addr2->ip ); #else #error unknown architecture diff --git a/libs/pak/pakstuff.cpp b/libs/pak/pakstuff.cpp index b22fe998..57ca7782 100644 --- a/libs/pak/pakstuff.cpp +++ b/libs/pak/pakstuff.cpp @@ -23,7 +23,7 @@ #include #include #include -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #endif #ifdef _WIN32 @@ -71,7 +71,7 @@ struct PK3FileInfo #ifdef LOG_PAKFAIL -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #include #endif @@ -82,7 +82,7 @@ class LogFile public: FILE *m_pFile; LogFile( const char* pName ){ -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) // leo: use ~/.q3a/radiant/paklog instead of /tmp/paklog.txt char *home = NULL; @@ -869,7 +869,7 @@ void WINAPI InitPakFile( const char * pBasePath, const char *pName ){ if ( pName == NULL ) { //++timo FIXME: use some kind of compatibility lib here! -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) char cWork[WORK_LEN]; struct dirent *dirlist; DIR *dir; diff --git a/libs/splines/q_shared.h b/libs/splines/q_shared.h index f7e8ab85..56222e3b 100644 --- a/libs/splines/q_shared.h +++ b/libs/splines/q_shared.h @@ -199,7 +199,7 @@ void Sys_PumpEvents( void ); //======================= FreeBSD DEFINES ================================= -#elif defined( __FreeBSD__ ) +#elif defined( __BSD__ ) #define MAC_STATIC diff --git a/libs/str.h b/libs/str.h index 9722b76d..69319f05 100644 --- a/libs/str.h +++ b/libs/str.h @@ -40,7 +40,7 @@ #include #include -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__BSD__) #ifdef NULL #undef NULL #define NULL 0 @@ -75,7 +75,7 @@ inline char* Q_StrDup( const char* pStr ) { return strcpy( new char[strlen( pStr ) + 1], pStr ); } -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #define strcmpi strcasecmp #define stricmp strcasecmp #define strnicmp strncasecmp diff --git a/libs/synapse.h b/libs/synapse.h index e271980f..5a4b6dd4 100644 --- a/libs/synapse.h +++ b/libs/synapse.h @@ -48,7 +48,7 @@ #include #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #include #endif @@ -59,7 +59,7 @@ #if defined( _WIN32 ) #define SYNAPSE_DLL_EXPORT WINAPI -#elif defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) /* ydnar */ +#elif defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) /* ydnar */ #define SYNAPSE_DLL_EXPORT #else #error unknown architecture @@ -459,7 +459,7 @@ public: /*! \todo cleanup, make that private with accessors */ -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) void *mpDLL; ///< handle to the shared object (invalid if SYN_BUILTIN) #elif defined( _WIN32 ) HMODULE mpDLL; ///< handle to the shared object (invalid if SYN_BUILTIN) diff --git a/libs/synapse/synapse.cpp b/libs/synapse/synapse.cpp index 1adf6316..e45247f9 100644 --- a/libs/synapse/synapse.cpp +++ b/libs/synapse/synapse.cpp @@ -26,7 +26,7 @@ #include #include "synapse.h" -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #endif @@ -145,7 +145,7 @@ bool CSynapseServer::Initialize( const char* conf_file, PFN_SYN_PRINTF_VA pf ){ // too small to be isolated in win32/ and linux/ directories.. #if defined( _WIN32 ) const char* ext_so = ".dll"; -#elif defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#elif defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) const char* ext_so = ".so"; #endif const char* ext = strrchr( name, '.' ); @@ -221,7 +221,7 @@ void CSynapseClientSlot::ReleaseSO(){ mpDLL = NULL; } -#elif defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#elif defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) void CSynapseServer::EnumerateInterfaces( Str &soname ){ CSynapseClientSlot slot; slot.mpDLL = dlopen( soname.GetBuffer(), RTLD_NOW ); diff --git a/memcheck-amd64-openbsd.core b/memcheck-amd64-openbsd.core new file mode 100644 index 00000000..252e3536 Binary files /dev/null and b/memcheck-amd64-openbsd.core differ diff --git a/plugins/textool/StdAfx.h b/plugins/textool/StdAfx.h index cb79983b..2ffc6168 100644 --- a/plugins/textool/StdAfx.h +++ b/plugins/textool/StdAfx.h @@ -29,7 +29,7 @@ #include #include -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) // Necessary for proper boolean type declaration #include "qertypes.h" @@ -79,7 +79,7 @@ typedef struct tagRECT long bottom; } RECT, *PRECT, *LPRECT; -#endif // defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#endif // defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) // plugin // FIXME TTimo: drop this diff --git a/plugins/vfspak/vfs.cpp b/plugins/vfspak/vfs.cpp index 5b9221df..52a8d80c 100644 --- a/plugins/vfspak/vfs.cpp +++ b/plugins/vfspak/vfs.cpp @@ -43,7 +43,7 @@ #include #include -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #include #define WINAPI diff --git a/plugins/vfspk3/vfs.cpp b/plugins/vfspk3/vfs.cpp index 6518382f..29ceda6d 100644 --- a/plugins/vfspk3/vfs.cpp +++ b/plugins/vfspk3/vfs.cpp @@ -45,7 +45,7 @@ #include #include -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #include #else diff --git a/plugins/vfswad/vfs.cpp b/plugins/vfswad/vfs.cpp index eaaf0e04..25d1e5b9 100644 --- a/plugins/vfswad/vfs.cpp +++ b/plugins/vfswad/vfs.cpp @@ -44,7 +44,7 @@ #include #include -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #include #else @@ -119,7 +119,7 @@ int vfsBuildShortPathName( const char* pPath, char* pBuffer, int nBufferLen ){ strcpy( pBuffer, pPath ); // Use long filename } return nResult; -#elif defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#elif defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) // remove /../ from directories const char *scr = pPath; char *dst = pBuffer; diff --git a/radiant.bin.core b/radiant.bin.core new file mode 100644 index 00000000..94f89ae7 Binary files /dev/null and b/radiant.bin.core differ diff --git a/radiant/eclass.cpp b/radiant/eclass.cpp index 0b3dbed4..1d910907 100644 --- a/radiant/eclass.cpp +++ b/radiant/eclass.cpp @@ -21,7 +21,7 @@ #include "stdafx.h" #include -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #endif #include "assert.h" diff --git a/radiant/error.cpp b/radiant/error.cpp index 3de216aa..b30e2a72 100644 --- a/radiant/error.cpp +++ b/radiant/error.cpp @@ -22,7 +22,7 @@ #define UNICODE #include "stdafx.h" -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #endif @@ -52,7 +52,7 @@ void Error( const char *error, ... ){ strcat( text, "\n" ); -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) if ( errno != 0 ) { strcat( text, "errno: " ); strcat( text, strerror( errno ) ); diff --git a/radiant/gtkmisc.cpp b/radiant/gtkmisc.cpp index 05d49c77..cb8e15c8 100644 --- a/radiant/gtkmisc.cpp +++ b/radiant/gtkmisc.cpp @@ -35,7 +35,7 @@ #include #include -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #endif diff --git a/radiant/main.cpp b/radiant/main.cpp index 7df25766..418f0c36 100644 --- a/radiant/main.cpp +++ b/radiant/main.cpp @@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #include #include @@ -118,7 +118,7 @@ static void create_splash() { // ============================================================================= // Loki stuff -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) /* The directory where the data files can be found (run directory) */ static char datapath[PATH_MAX]; @@ -384,18 +384,22 @@ int mainRadiant( int argc, char* argv[] ) { // Use the same environment variable for resolving libGL as libgtkglext does. libgl = getenv("GDK_GL_LIBGL_PATH"); if ( libgl == NULL ) { - #if defined ( _WIN32 ) - libgl = "opengl32.dll"; - #elif defined ( __linux__ ) || defined ( __FreeBSD__ ) - libgl = "libGL.so.1"; - #elif defined ( __APPLE__ ) - libgl = "/opt/local/lib/libGL.dylib"; - #else - #error unknown architecture - #endif + #if defined ( _WIN32 ) + libgl = "opengl32.dll"; + #elif defined ( __linux__ ) || defined ( __FreeBSD__ ) + libgl = "libGL.so.1"; + #elif defined ( __OpenBSD__ ) + libgl = "libGL.so.18.0"; + #elif defined( __NetBSD__ ) + libgl = "libGL.so.3.0"; + #elif defined ( __APPLE__ ) + libgl = "/opt/local/lib/libGL.dylib"; + #else + #error unknown architecture + #endif } -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) // Give away unnecessary root privileges. // Important: must be done before calling gtk_init(). char *loginname; @@ -495,7 +499,7 @@ int mainRadiant( int argc, char* argv[] ) { #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) const char *xdg_state_home = getenv( "XDG_STATE_HOME" ); if ( xdg_state_home != nullptr ) { g_strTempPath = xdg_state_home; @@ -780,7 +784,7 @@ int mainRadiant( int argc, char* argv[] ) { return 1; } -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) if ( ( qglXQueryExtension == NULL ) || ( qglXQueryExtension( gdk_x11_get_default_xdisplay(), NULL, NULL ) != True ) ) { Sys_FPrintf( SYS_ERR, "glXQueryExtension failed\n" ); _exit( 1 ); @@ -1048,7 +1052,7 @@ void SaveWithRegion( char *name ){ Map_SaveFile( name, region_active ); } -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) typedef struct { pid_t pid; int status; @@ -1161,7 +1165,7 @@ ECHO.\n\ pause\n\ "; -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) // write qe3bsp.sh sprintf( batpath, "%sqe3bsp.sh", g_strTempPath.GetBuffer() ); @@ -1189,7 +1193,7 @@ pause\n\ Pointfile_Delete(); -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) bsp_child_process_t *process = ( bsp_child_process_t *) malloc( sizeof( bsp_child_process_t ) ); memset( process, 0, sizeof( *process ) ); diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 050b7185..80fff561 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -31,7 +31,7 @@ #include #include #include -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #endif #include "gtkmisc.h" @@ -2184,7 +2184,7 @@ void Clipboard_PasteMap(){ Platform-independent GTK clipboard support. \todo Using GDK_SELECTION_CLIPBOARD fails on win32, so we use the win32 API directly for now. */ -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) enum { @@ -3611,7 +3611,7 @@ void MainFrame::LoadCommandMap(){ int j; -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) strINI = g_PrefsDlg.m_rc_path->str; #elif defined( WIN32 ) strINI = g_strGameToolsPath; diff --git a/radiant/map.cpp b/radiant/map.cpp index 3696d4e8..048d84ab 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -22,7 +22,7 @@ #include "stdafx.h" #include #include -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #endif #include "preferences.h" diff --git a/radiant/missing.cpp b/radiant/missing.cpp index fa6bfddf..7ac2e09a 100644 --- a/radiant/missing.cpp +++ b/radiant/missing.cpp @@ -38,7 +38,7 @@ #include "qsysprintf.h" #include "qe3.h" -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #include @@ -64,20 +64,20 @@ bool radCopyFile( const char *lpExistingFileName, const char *lpNewFileName, boo src = fopen( realsrc, "rb" ); if ( !src ) { - if ( fatal_on_error ) { - Error( "Failed to open source for copy: %s\n", realsrc ); - } - Sys_Printf( "Failed to open source for copy: %s\n", realsrc ); - return false; + if ( fatal_on_error ) { + Error( "Failed to open source for copy: %s\n", realsrc ); + } + Sys_Printf( "Failed to open source for copy: %s\n", realsrc ); + return false; } dst = fopen( realdest, "wb" ); if ( !dst ) { - if ( fatal_on_error ) { - Error( "Failed to open destination for copy: %s\n", realdest ); - } - Sys_Printf( "Failed to open destination for copy: %s\n", realdest ); - fclose( src ); - return false; + if ( fatal_on_error ) { + Error( "Failed to open destination for copy: %s\n", realdest ); + } + Sys_Printf( "Failed to open destination for copy: %s\n", realdest ); + fclose( src ); + return false; } fseek( src, 0, SEEK_END ); @@ -93,11 +93,11 @@ bool radCopyFile( const char *lpExistingFileName, const char *lpNewFileName, boo } } if ( !ret ) { - if ( fatal_on_error ) { - Error( "short read or short write while copying %s to %s\n", realsrc, realdest ); - } - Sys_Printf( "short read or short write while copying %s to %s\n", realsrc, realdest ); - } + if ( fatal_on_error ) { + Error( "short read or short write while copying %s to %s\n", realsrc, realdest ); + } + Sys_Printf( "short read or short write while copying %s to %s\n", realsrc, realdest ); + } g_free( buf ); fclose( src ); diff --git a/radiant/pluginentities.cpp b/radiant/pluginentities.cpp index 833f3bed..74575dc1 100644 --- a/radiant/pluginentities.cpp +++ b/radiant/pluginentities.cpp @@ -28,7 +28,7 @@ #ifdef USEPLUGINENTITIES #include "stdafx.h" -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #endif //#include "qe3.h" diff --git a/radiant/pluginmanager.cpp b/radiant/pluginmanager.cpp index 559e6dff..529be2e0 100644 --- a/radiant/pluginmanager.cpp +++ b/radiant/pluginmanager.cpp @@ -24,7 +24,7 @@ ////////////////////////////////////////////////////////////////////// #include "stdafx.h" -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #include #endif @@ -1898,7 +1898,7 @@ void CPlugInManager::CommitPatchHandleToEntity( int index, patchMesh_t *pMesh, c #if 0 -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include XVisualInfo* QEX_ChooseVisual( bool zbuffer ){ diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index 79730cd3..0ae53a87 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -29,7 +29,7 @@ #include #include #include -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #include #include @@ -696,7 +696,7 @@ PrefsDlg::PrefsDlg (){ #define ENGINEPATH_ATTRIBUTE "enginepath_win32" #define MP_ENGINE_ATTRIBUTE "mp_engine_win32" #define PREFIX_ATTRIBUTE "prefix_win32" -#elif defined( __linux__ ) || defined ( __FreeBSD__ ) +#elif defined( __linux__ ) || defined ( __BSD__ ) #define TOOLS_ATTRIBUTE "gametools_linux" #define EXECUTABLES_ATTRIBUTE "executables_linux" #define ENGINE_ATTRIBUTE "engine_linux" @@ -796,7 +796,7 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){ if ( prop == NULL ) { #ifdef _WIN32 mEngine = "quake3.exe"; -#elif defined( __linux__ ) || defined( __FreeBSD__ ) +#elif defined( __linux__ ) || defined( __BSD__ ) mEngine = "quake3"; #elif __APPLE__ mEngine = "Quake3.app"; @@ -810,7 +810,7 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){ if ( prop == NULL ) { #ifdef _WIN32 mMultiplayerEngine = "quake3.exe"; -#elif defined( __linux__ ) || defined( __FreeBSD__ ) +#elif defined( __linux__ ) || defined( __BSD__ ) mMultiplayerEngine = "quake3"; #elif __APPLE__ mMultiplayerEngine = "Quake3.app"; @@ -1319,7 +1319,7 @@ void CGameDialog::Init(){ // Add the per-user game path on all platforms if ( m_pCurrentGameDescription->mUserPathPrefix.GetLength() ) { -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) g_qeglobals.m_strHomeGame = g_get_home_dir(); g_qeglobals.m_strHomeGame += "/"; g_qeglobals.m_strHomeGame += m_pCurrentGameDescription->mUserPathPrefix.GetBuffer(); @@ -3751,7 +3751,7 @@ void CGameInstall::Run() { break; } case GAME_QUETOO: { -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) fprintf( fg, " " ENGINE_ATTRIBUTE "=\"quetoo\"\n" ); fprintf( fg, " " PREFIX_ATTRIBUTE "=\".quetoo\"\n" ); #elif _WIN32 @@ -3804,7 +3804,7 @@ void CGameInstall::Run() { case GAME_ET: { #ifdef _WIN32 fprintf( fg, " " ENGINE_ATTRIBUTE "=\"ET.exe\"\n"); -#elif defined( __linux__ ) || defined( __FreeBSD__ ) +#elif defined( __linux__ ) || defined( __BSD__ ) fprintf( fg, " " ENGINE_ATTRIBUTE "=\"et\"\n" ); #endif fprintf( fg, " prefix=\".etwolf\"\n" ); diff --git a/radiant/qe3.cpp b/radiant/qe3.cpp index 4432b3d2..3be310ba 100644 --- a/radiant/qe3.cpp +++ b/radiant/qe3.cpp @@ -30,7 +30,7 @@ #include #include "gtkmisc.h" #include -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #include #include @@ -171,7 +171,7 @@ void Map_Snapshot(){ bGo = ( _mkdir( strOrgPath ) != -1 ); #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) bGo = ( mkdir( strOrgPath,0755 ) != -1 ); #endif } @@ -288,7 +288,7 @@ int BuildShortPathName( const char* pPath, char* pBuffer, int nBufferLen ){ } #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) int BuildShortPathName( const char* pPath, char* pBuffer, int nBufferLen ){ // remove /../ from directories const char *scr = pPath; char *dst = pBuffer; @@ -1212,7 +1212,7 @@ bool Sys_AltDown(){ return ( GetKeyState( VK_MENU ) & 0x8000 ) != 0; #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) char keys[32]; int x; @@ -1248,7 +1248,7 @@ bool Sys_ShiftDown(){ return ( GetKeyState( VK_SHIFT ) & 0x8000 ) != 0; #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) char keys[32]; int x; @@ -1333,7 +1333,7 @@ void Sys_SetCursorPos( int x, int y ){ } void Sys_Beep( void ){ -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) gdk_beep(); #else MessageBeep( MB_ICONASTERISK ); @@ -1706,7 +1706,7 @@ void Sys_LogFile( void ){ Str name; name = g_strTempPath; name += "radiant.log"; -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) g_qeglobals.hLogFile = open( name.GetBuffer(), O_TRUNC | O_CREAT | O_WRONLY, S_IREAD | S_IWRITE ); #endif #ifdef _WIN32 @@ -1733,7 +1733,7 @@ void Sys_LogFile( void ){ #ifdef _WIN32 _close( g_qeglobals.hLogFile ); #endif - #if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) + #if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) close( g_qeglobals.hLogFile ); #endif g_qeglobals.hLogFile = 0; @@ -1761,7 +1761,7 @@ extern "C" void Sys_FPrintf_VA( int level, const char *text, va_list args ) { _write( g_qeglobals.hLogFile, buf, length ); _commit( g_qeglobals.hLogFile ); #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) write( g_qeglobals.hLogFile, buf, length ); #endif } diff --git a/radiant/qgl.c b/radiant/qgl.c index 7a4f4657..7141e553 100644 --- a/radiant/qgl.c +++ b/radiant/qgl.c @@ -37,7 +37,7 @@ #include #include #include -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #endif @@ -88,7 +88,7 @@ BOOL ( WINAPI * qwglSwapIntervalEXT )( int interval ); #define WINAPI #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) void* g_hGLDLL; XVisualInfo* ( *qglXChooseVisual )( Display * dpy, int screen, int *attribList ); @@ -525,7 +525,7 @@ void QGL_Shutdown(){ FreeLibrary( g_hGLDLL ); #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) dlclose( g_hGLDLL ); #endif @@ -936,7 +936,7 @@ void QGL_Shutdown(){ qwglSetDeviceGammaRampEXT = NULL; #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) qglXChooseVisual = NULL; qglXCreateContext = NULL; qglXDestroyContext = NULL; @@ -986,7 +986,7 @@ static void* safe_dlsym( void *handle, char *symbol ){ return GetProcAddress( handle, symbol ); #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) void* ret = dlsym( handle, symbol ); const char *err = dlerror(); if ( err ) { @@ -1174,7 +1174,7 @@ int QGL_Init( const char *dllname, const char* gluname ){ g_hGLDLL = LoadLibrary( dllname ); #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) const char *err; // NOTE TTimo @@ -1623,7 +1623,7 @@ int QGL_Init( const char *dllname, const char* gluname ){ qglMTexCoord2fSGIS = 0; #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) qglXChooseVisual = safe_dlsym( g_hGLDLL, "glXChooseVisual" ); qglXCreateContext = safe_dlsym( g_hGLDLL, "glXCreateContext" ); qglXDestroyContext = safe_dlsym( g_hGLDLL, "glXDestroyContext" ); @@ -1704,7 +1704,7 @@ int GL_ExtensionSupported( const char *extension ){ } void* Sys_GLGetExtension( const char *symbol ){ -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) if ( qglXGetProcAddressARB == NULL ) { return NULL; } diff --git a/radiant/qgl.h b/radiant/qgl.h index ac3dfe72..955bce5d 100644 --- a/radiant/qgl.h +++ b/radiant/qgl.h @@ -30,7 +30,7 @@ #include -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #endif @@ -521,7 +521,7 @@ extern BOOL ( WINAPI * qwglSetDeviceGammaRampEXT )( const unsigned char *pRed, c #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) extern XVisualInfo* ( *qglXChooseVisual )( Display * dpy, int screen, int *attribList ); extern GLXContext ( *qglXCreateContext )( Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct ); extern void ( *qglXDestroyContext )( Display *dpy, GLXContext ctx ); diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 04cddcb4..99c0d3ab 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -32,7 +32,7 @@ - Make sure the interface is not dependent on gtk. */ -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #endif #include diff --git a/radiant/watchbsp.cpp b/radiant/watchbsp.cpp index 569d3070..afbf8685 100644 --- a/radiant/watchbsp.cpp +++ b/radiant/watchbsp.cpp @@ -41,7 +41,7 @@ #include #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #define SOCKET_ERROR -1 #endif @@ -421,7 +421,7 @@ void CWatchBSP::RoutineProcessing(){ #ifdef _WIN32 TIMEVAL tout = { 0, 0 }; #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) timeval tout; tout.tv_sec = 0; tout.tv_usec = 0; diff --git a/tools/quake2/common/cmdlib.c b/tools/quake2/common/cmdlib.c index ef867a50..19f4d0d7 100644 --- a/tools/quake2/common/cmdlib.c +++ b/tools/quake2/common/cmdlib.c @@ -32,7 +32,7 @@ #include #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #endif @@ -1180,7 +1180,7 @@ void Sys_Sleep( int n ){ #ifdef WIN32 Sleep( n ); #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) usleep( n * 1000 ); #endif } diff --git a/tools/quake2/common/path_init.c b/tools/quake2/common/path_init.c index d448c5cc..9ff187f1 100644 --- a/tools/quake2/common/path_init.c +++ b/tools/quake2/common/path_init.c @@ -28,7 +28,7 @@ /* marker */ #define PATH_INIT_C -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #define Q_UNIX #endif diff --git a/tools/quake2/common/threads.c b/tools/quake2/common/threads.c index 7081396e..832772d8 100644 --- a/tools/quake2/common/threads.c +++ b/tools/quake2/common/threads.c @@ -415,7 +415,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){ ======================================================================= */ -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #define USED // Setting default Threads to 1 @@ -571,7 +571,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){ Sys_Printf( " (%i)\n", end - start ); } } -#endif // if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#endif // if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) /* diff --git a/tools/quake2/q2map/q2map.h b/tools/quake2/q2map/q2map.h index a21791bb..1eabb739 100644 --- a/tools/quake2/q2map/q2map.h +++ b/tools/quake2/q2map/q2map.h @@ -21,7 +21,7 @@ // q2map.h /* platform-specific */ -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #define Q_UNIX #endif diff --git a/tools/quake2/qdata_heretic2/common/cmdlib.c b/tools/quake2/qdata_heretic2/common/cmdlib.c index 387a4abd..c42a10d2 100644 --- a/tools/quake2/qdata_heretic2/common/cmdlib.c +++ b/tools/quake2/qdata_heretic2/common/cmdlib.c @@ -32,7 +32,7 @@ #include #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #endif @@ -84,7 +84,7 @@ void *SafeMalloc( size_t n, char *desc ){ return p; } -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) void strlwr( char *conv_str ){ int i; @@ -1192,7 +1192,7 @@ void Sys_Sleep( int n ){ #ifdef WIN32 Sleep( n ); #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) usleep( n * 1000 ); #endif } diff --git a/tools/quake2/qdata_heretic2/common/path_init.c b/tools/quake2/qdata_heretic2/common/path_init.c index bbe4f0be..7e912688 100644 --- a/tools/quake2/qdata_heretic2/common/path_init.c +++ b/tools/quake2/qdata_heretic2/common/path_init.c @@ -29,7 +29,7 @@ /* marker */ #define PATH_INIT_C -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #define Q_UNIX #endif diff --git a/tools/quake2/qdata_heretic2/common/threads.c b/tools/quake2/qdata_heretic2/common/threads.c index 5f174da4..9c875be8 100644 --- a/tools/quake2/qdata_heretic2/common/threads.c +++ b/tools/quake2/qdata_heretic2/common/threads.c @@ -414,7 +414,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){ ======================================================================= */ -#if defined( __linux__ ) || defined( __FreeBSD__ ) +#if defined( __linux__ ) || defined( __BSD__ ) #define USED int numthreads = 4; @@ -569,7 +569,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){ Sys_Printf( " (%i)\n", end - start ); } } -#endif // if defined( __linux__ ) || defined( __FreeBSD__ ) +#endif // if defined( __linux__ ) || defined( __BSD__ ) /* diff --git a/tools/quake3/common/aselib.c b/tools/quake3/common/aselib.c index 6917fba0..1d1c5915 100644 --- a/tools/quake3/common/aselib.c +++ b/tools/quake3/common/aselib.c @@ -113,7 +113,7 @@ static char gl_filename[1024]; static void ASE_Process( void ); static void ASE_FreeGeomObject( int ndx ); -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) static char* strlwr( char* string ){ char *cp; diff --git a/tools/quake3/common/cmdlib.c b/tools/quake3/common/cmdlib.c index 04f3c740..2aa76aa8 100644 --- a/tools/quake3/common/cmdlib.c +++ b/tools/quake3/common/cmdlib.c @@ -39,7 +39,7 @@ #include #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #endif @@ -1083,7 +1083,7 @@ void Sys_Sleep( int n ){ #ifdef WIN32 Sleep( n ); #endif -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) usleep( n * 1000 ); #endif } diff --git a/tools/quake3/common/threads.c b/tools/quake3/common/threads.c index 43925cd8..88aadfde 100644 --- a/tools/quake3/common/threads.c +++ b/tools/quake3/common/threads.c @@ -416,7 +416,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){ ======================================================================= */ -#if defined( __linux__ ) || defined( __FreeBSD__ ) +#if defined( __linux__ ) || defined( __BSD__ ) #define USED int numthreads = 4; @@ -546,7 +546,11 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){ #if __GLIBC_MINOR__ == 1 if ( pthread_mutexattr_settype( &mattrib, PTHREAD_MUTEX_FAST_NP ) != 0 ) #else - if ( pthread_mutexattr_settype( &mattrib, PTHREAD_MUTEX_ADAPTIVE_NP ) != 0 ) +#if defined(__OpenBSD__) + if ( pthread_mutexattr_settype( &mattrib, PTHREAD_MUTEX_STRICT_NP) != 0 ) +#else + if ( pthread_mutexattr_settype( &mattrib, PTHREAD_MUTEX_ADAPTIVE_NP ) != 0 ) +#endif #endif { Error( "pthread_mutexattr_settype failed" ); } recursive_mutex_init( mattrib ); @@ -573,7 +577,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){ Sys_Printf( " (%i)\n", end - start ); } } -#endif // if defined( __linux__ ) || defined( __FreeBSD__ ) +#endif // if defined( __linux__ ) || defined( __BSD__ ) /* diff --git a/tools/quake3/common/trilib.c b/tools/quake3/common/trilib.c index b7002b8b..0c3abb9b 100644 --- a/tools/quake3/common/trilib.c +++ b/tools/quake3/common/trilib.c @@ -38,7 +38,7 @@ //#define NOISY 1 -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #define strlwr strlower #endif diff --git a/tools/quake3/common/vfs.c b/tools/quake3/common/vfs.c index 1d949053..f8eb569e 100644 --- a/tools/quake3/common/vfs.c +++ b/tools/quake3/common/vfs.c @@ -43,7 +43,7 @@ #include -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #include #include #else diff --git a/tools/quake3/q3data/md3lib.c b/tools/quake3/q3data/md3lib.c index d24de620..89949495 100644 --- a/tools/quake3/q3data/md3lib.c +++ b/tools/quake3/q3data/md3lib.c @@ -25,7 +25,7 @@ #endif #include "md3lib.h" -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #define filelength Q_filelength #endif diff --git a/tools/quake3/q3data/p3dlib.c b/tools/quake3/q3data/p3dlib.c index d71f1396..adb2f348 100644 --- a/tools/quake3/q3data/p3dlib.c +++ b/tools/quake3/q3data/p3dlib.c @@ -31,7 +31,7 @@ #define MAX_POLYSETS 64 -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #define _strcmpi Q_stricmp #define filelength Q_filelength #define strlwr strlower diff --git a/tools/quake3/q3data/q3data.c b/tools/quake3/q3data/q3data.c index ac35ae12..cd0fcfc3 100644 --- a/tools/quake3/q3data/q3data.c +++ b/tools/quake3/q3data/q3data.c @@ -40,7 +40,7 @@ qboolean g_skipmodel; // set true when a cd is not g_only // bogus externs for some TA hacks (common/ using them against q3map) char *moddir = NULL; -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #define strlwr strlower #endif diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 06d20c88..f7567da9 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -46,7 +46,7 @@ ------------------------------------------------------------------------------- */ /* platform-specific */ -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #define Q_UNIX #endif diff --git a/tools/urt/tools/quake3/q3map2/q3map2.h b/tools/urt/tools/quake3/q3map2/q3map2.h index 35238821..c4cccba4 100644 --- a/tools/urt/tools/quake3/q3map2/q3map2.h +++ b/tools/urt/tools/quake3/q3map2/q3map2.h @@ -47,7 +47,7 @@ ------------------------------------------------------------------------------- */ /* platform-specific */ -#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ ) +#if defined( __linux__ ) || defined( __BSD__ ) || defined( __APPLE__ ) #define Q_UNIX #endif diff --git a/utils.py b/utils.py index 330882a0..88953942 100644 --- a/utils.py +++ b/utils.py @@ -53,7 +53,7 @@ def CheckUnresolved( source, target, env ): if ( platform.system() == 'Darwin' ): return None # TODO: implement this for FreeBSD - if ( platform.system() == 'FreeBSD' ): + if ( platform.system() in ['FreeBSD', 'OpenBSD', 'NetBSD'] ): return None print( 'CheckUnresolved %s' % target[0].abspath ) if ( not os.path.isfile( target[0].abspath ) ):