From f350683e836fb7d0f663c6690bd118ffc9ef8882 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Mon, 5 Nov 2018 07:57:32 +0500 Subject: [PATCH 1/3] wscript: avoid linuxisms and gccisms. --- wscript | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/wscript b/wscript index ba81db89..242c17a8 100644 --- a/wscript +++ b/wscript @@ -87,14 +87,18 @@ def configure(conf): Logs.warn('WARNING: 64-bit engine may be unstable') if(conf.env.COMPILER_CC != 'msvc'): - if(conf.env.COMPILER_CC == 'gcc'): + if(conf.env.COMPILER_CC == 'gcc') or (conf.env.COMPILER_CC == 'clang'): conf.env.append_unique('LINKFLAGS', ['-Wl,--no-undefined']) if(conf.options.RELEASE): conf.env.append_unique('CFLAGS', ['-O2']) conf.env.append_unique('CXXFLAGS', ['-O2']) - else: + elif(conf.env.COMPILER_CC == 'gcc'): conf.env.append_unique('CFLAGS', ['-Og', '-g']) conf.env.append_unique('CXXFLAGS', ['-Og', '-g']) + else: + conf.env.append_unique('CFLAGS', ['-O0', '-g', '-gdwarf-2']) + conf.env.append_unique('CXXFLAGS', ['-O0', '-g', '-gdwarf-2']) + if conf.options.GCC_COLORS: conf.env.append_unique('CFLAGS', ['-fdiagnostics-color=always']) conf.env.append_unique('CXXFLAGS', ['-fdiagnostics-color=always']) @@ -113,8 +117,10 @@ def configure(conf): # TODO: wrapper around bld.stlib, bld.shlib and so on? conf.env.MSVC_SUBSYSTEM = 'WINDOWS,5.01' - if(conf.env.DEST_OS != 'win32'): + if(conf.env.DEST_OS == 'linux'): conf.check( lib='dl' ) + + if(conf.env.DEST_OS != 'win32'): conf.check( lib='m' ) conf.check( lib='pthread' ) From f36d1f5621323d170657b001e8e85b8cf6279b87 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Mon, 5 Nov 2018 08:01:43 +0500 Subject: [PATCH 2/3] Use execv instead of execve, because environ symbol breaks compilation with -Wl,--no-undefined flag under FreeBSD via Waf. --- engine/common/system.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engine/common/system.c b/engine/common/system.c index 53812312..38196435 100644 --- a/engine/common/system.c +++ b/engine/common/system.c @@ -29,7 +29,6 @@ GNU General Public License for more details. #include #ifndef __ANDROID__ -extern char **environ; #include #endif #endif @@ -299,7 +298,7 @@ void Sys_ShellExecute( const char *path, const char *parms, int shouldExit ) pid_t id = fork( ); if( id == 0 ) { - execve( xdgOpen, (char **)argv, environ ); + execv( xdgOpen, (char **)argv ); fprintf( stderr, "error opening %s %s", xdgOpen, path ); _exit( 1 ); } From d4e5e609afae044d9877072cc53e41d3696dfc78 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Mon, 5 Nov 2018 08:04:54 +0500 Subject: [PATCH 3/3] Do not break video subsystem initialization. --- engine/platform/sdl/vid_sdl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engine/platform/sdl/vid_sdl.c b/engine/platform/sdl/vid_sdl.c index 6718835c..1f6be59d 100644 --- a/engine/platform/sdl/vid_sdl.c +++ b/engine/platform/sdl/vid_sdl.c @@ -878,6 +878,8 @@ qboolean R_Init_Video( void ) } GL_InitExtensions(); + + return true; } #ifdef XASH_GLES