Basic infrastructure to build on *BSD

This commit is contained in:
dhewg 2011-12-07 17:12:44 +01:00
parent 98eed69848
commit 04832863e8
3 changed files with 32 additions and 11 deletions

View file

@ -158,7 +158,7 @@ if len(g_cpu) < 1:
if len(g_cpu) < 1:
g_cpu = 'cpu'
g_os = 'Linux'
g_os = commands.getoutput('uname -s')
# end system detection ---------------------------
@ -294,9 +294,12 @@ BASECPPFLAGS.append( '-Wno-unknown-pragmas' )
# this define is necessary to make sure threading support is enabled in X
CORECPPFLAGS.append( '-DXTHREADS' )
if ( g_os == 'Linux' ):
# gcc 4.x option only - only export what we mean to from the game SO
BASECPPFLAGS.append( '-fvisibility=hidden' )
# gcc 4.x option only - only export what we mean to from the game SO
BASECPPFLAGS.append( '-fvisibility=hidden' )
if ( "BSD" in g_os ):
BASECPPFLAGS.append( '-I/usr/local/include' )
BASELINKFLAGS.append('-L/usr/local/lib')
if ( g_sdk or SDK != '0' ):
BASECPPFLAGS.append( '-D_D3SDK' )

View file

@ -247,13 +247,16 @@ sound_env.Append( CPPPATH = '/usr/local/lib/oss/include' )
# store a local copy of the include headers as well for holy build
sound_env.Append( CPPPATH = '../linux/oss/include' )
sound_list = [ '../linux/sound.cpp' ]
if ( ALSA != '0' ):
if ( g_os == "Linux" and ALSA != '0' ):
sound_list.append( '../../sys/linux/sound_alsa.cpp' )
else:
sound_env.Append( CPPDEFINES = 'NO_ALSA' )
sound_lib = sound_env.StaticLibrary( 'sound', sound_list )
local_env.Append( LIBS = [ 'pthread', 'dl', 'jpeg', 'vorbisfile' ] )
local_env.Append( LIBS = [ 'pthread', 'jpeg', 'vorbisfile' ] )
if (g_os == "Linux"):
local_env.Append( LIBS = [ 'dl' ] )
if ( local_curl == 1 ):
local_env.Append( LIBS = [ 'curl', 'z' ] )

View file

@ -104,25 +104,40 @@ If you have questions concerning this license or the applicable additional terms
#endif
// Linux
#ifdef __linux__
// Unix
#ifdef __unix__
#define BUILD_OS_ID 2
#ifdef __linux__
#define BUILD_OS "linux"
#elif defined(__FreeBSD__)
#define BUILD_OS "FreeBSD"
#elif defined(__DragonFly__)
#define BUILD_OS "DragonFly"
#elif defined(__OpenBSD__)
#define BUILD_OS "OpenBSD"
#elif defined(__NetBSD__)
#define BUILD_OS "NetBSD"
#else
#error unknown operating system!
#endif
#ifdef __i386__
#define BUILD_STRING "linux-x86"
#define CPUSTRING "x86"
#define CPU_EASYARGS 1
#elif defined(__x86_64__)
#define BUILD_STRING "linux-x86_64"
#define CPUSTRING "x86_64"
#define CPU_EASYARGS 0
#elif defined(__ppc__)
#define BUILD_STRING "linux-ppc"
#define CPUSTRING "ppc"
#define CPU_EASYARGS 0
#else
#error unknown cpu architecture!
#endif
#define BUILD_STRING (BUILD_OS "-" CPUSTRING)
#define _alloca alloca
#define _alloca16( x ) ((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15))