This commit is contained in:
Er2 2023-12-30 10:46:53 +01:00 committed by GitHub
commit 1751fb3c76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 118 additions and 206 deletions

View File

@ -118,7 +118,7 @@ bool CSteamApplication::Create( )
m_pFileSystem = (IFileSystem*)AddSystem( fileSystemModule, FILESYSTEM_INTERFACE_VERSION ); m_pFileSystem = (IFileSystem*)AddSystem( fileSystemModule, FILESYSTEM_INTERFACE_VERSION );
if ( !m_pFileSystem ) if ( !m_pFileSystem )
{ {
Error( "Unable to load %s", pFileSystemDLL ); Error( "Unable to load %s\n", pFileSystemDLL );
return false; return false;
} }

View File

@ -360,12 +360,9 @@ void CDedicatedAppSystemGroup::Destroy()
bool GetExecutableName( char *out, int nMaxLen ) bool GetExecutableName( char *out, int nMaxLen )
{ {
#ifdef _WIN32 #ifdef _WIN32
if ( !::GetModuleFileName( ( HINSTANCE )GetModuleHandle( NULL ), out, nMaxLen ) ) return !!::GetModuleFileName( ( HINSTANCE )GetModuleHandle( NULL ), out, nMaxLen );
return false; #else
return true; return false;
#elif POSIX
Q_strncpy( out, g_szEXEName, nMaxLen );
return true;
#endif #endif
} }

View File

@ -188,33 +188,13 @@ static void WaitForDebuggerConnect( int argc, char *argv[], int time )
int main( int argc, char *argv[] ) int main( int argc, char *argv[] )
{ {
// Must add 'bin' to the path.... void *dedicated = dlopen( "libdedicated" DLL_EXT_STRING, RTLD_NOW );
char* pPath = getenv("LD_LIBRARY_PATH");
char szBuffer[4096];
char cwd[ MAX_PATH ];
if ( !getcwd( cwd, sizeof(cwd)) )
{
printf( "getcwd failed (%s)", strerror(errno));
}
snprintf( szBuffer, sizeof( szBuffer ) - 1, "LD_LIBRARY_PATH=%s/bin:%s", cwd, pPath );
int ret = putenv( szBuffer );
if ( ret )
{
printf( "%s\n", strerror(errno) );
}
void *tier0 = dlopen( "libtier0" DLL_EXT_STRING, RTLD_NOW );
void *vstdlib = dlopen( "libvstdlib" DLL_EXT_STRING, RTLD_NOW );
const char *pBinaryName = "bin/dedicated" DLL_EXT_STRING;
void *dedicated = dlopen( pBinaryName, RTLD_NOW );
if ( !dedicated ) if ( !dedicated )
dedicated = dlopen( "bin/libdedicated" DLL_EXT_STRING, RTLD_NOW ); dedicated = dlopen( "dedicated" DLL_EXT_STRING, RTLD_NOW );
if ( !dedicated ) if ( !dedicated )
{ {
printf( "Failed to open %s (%s)\n", pBinaryName, dlerror()); printf( "Failed to open dedicated" DLL_EXT_STRING " (%s)\n", dlerror());
return -1; return -1;
} }
DedicatedMain_t dedicated_main = (DedicatedMain_t)dlsym( dedicated, "DedicatedMain" ); DedicatedMain_t dedicated_main = (DedicatedMain_t)dlsym( dedicated, "DedicatedMain" );
@ -226,9 +206,8 @@ int main( int argc, char *argv[] )
WaitForDebuggerConnect( argc, argv, 30 ); WaitForDebuggerConnect( argc, argv, 30 );
ret = dedicated_main( argc,argv ); int ret = dedicated_main( argc,argv );
dlclose( dedicated ); dlclose( dedicated );
dlclose( vstdlib ); return ret;
dlclose( tier0 );
} }
#endif #endif

View File

@ -342,33 +342,34 @@ bool Sys_MessageBox(const char *title, const char *info, bool bShowOkAndCancel)
return true; return true;
} }
return false; return false;
#elif defined( USE_SDL )
int buttonid = 0;
SDL_MessageBoxData messageboxdata = { 0 };
SDL_MessageBoxButtonData buttondata[] =
{
{ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, 1, "OK" },
{ SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT, 0, "Cancel" },
};
messageboxdata.window = GetAssertDialogParent();
messageboxdata.title = title;
messageboxdata.message = info;
messageboxdata.numbuttons = bShowOkAndCancel ? 2 : 1;
messageboxdata.buttons = buttondata;
SDL_ShowMessageBox( &messageboxdata, &buttonid );
return ( buttonid == 1 );
#elif defined( POSIX )
Warning( "%s\n", info );
return true;
#else #else
#error "implement me" #if defined( USE_SDL )
SDL_Window *dialogParent = GetAssertDialogParent();
if (dialogParent)
{
int buttonid = 0;
SDL_MessageBoxData messageboxdata = { 0 };
SDL_MessageBoxButtonData buttondata[] =
{
{ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, 1, "OK" },
{ SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT, 0, "Cancel" },
};
messageboxdata.window = GetAssertDialogParent();
messageboxdata.title = title;
messageboxdata.message = info;
messageboxdata.numbuttons = bShowOkAndCancel ? 2 : 1;
messageboxdata.buttons = buttondata;
SDL_ShowMessageBox( &messageboxdata, &buttonid );
return ( buttonid == 1 );
}
else
#endif
{
Warning( "%s\n", info );
return true;
}
#endif #endif
} }
@ -464,7 +465,7 @@ void Sys_Error_Internal( bool bMinidump, const char *error, va_list argsList )
// Doing this doesn't quite work the way we want because there is no "crashing" thread // Doing this doesn't quite work the way we want because there is no "crashing" thread
// and we see "No thread was identified as the cause of the crash; No signature could be created because we do not know which thread crashed" on the back end // and we see "No thread was identified as the cause of the crash; No signature could be created because we do not know which thread crashed" on the back end
//SteamAPI_WriteMiniDump( 0, NULL, build_number() ); //SteamAPI_WriteMiniDump( 0, NULL, build_number() );
printf("\n ##### Sys_Error: %s", text ); printf("\n ##### Sys_Error: %s\n", text );
fflush(stdout ); fflush(stdout );
raise(SIGTRAP); raise(SIGTRAP);
@ -1117,7 +1118,6 @@ void Sys_ShutdownGame( void )
CreateInterfaceFn g_ServerFactory; CreateInterfaceFn g_ServerFactory;
#pragma optimize( "g", off ) #pragma optimize( "g", off )
static bool LoadThisDll( char *szDllFilename, bool bIsServerOnly ) static bool LoadThisDll( char *szDllFilename, bool bIsServerOnly )
{ {
@ -1255,7 +1255,7 @@ void LoadEntityDLLs( const char *szBaseDir, bool bIsServerOnly )
if ( serverGameDLL ) if ( serverGameDLL )
{ {
Msg("server%s loaded for \"%s\"\n", DLL_EXT_STRING, (char *)serverGameDLL->GetGameDescription()); Msg("server" DLL_EXT_STRING " loaded for \"%s\"\n", (char *)serverGameDLL->GetGameDescription());
} }
} }

View File

@ -5057,20 +5057,17 @@ CSysModule *CBaseFileSystem::LoadModule( const char *pFileName, const char *pPat
if ( FilterByPathID( &m_SearchPaths[i], lookup ) ) if ( FilterByPathID( &m_SearchPaths[i], lookup ) )
continue; continue;
Q_snprintf( tempPathID, sizeof(tempPathID), "%s%s", m_SearchPaths[i].GetPathString(), pFileName ); // append the path to this dir.
pModule = Sys_LoadModule( tempPathID );
if ( pModule )
{
// we found the binary in one of our search paths
return pModule;
}
#ifdef POSIX #ifdef POSIX
Q_snprintf( tempPathID, sizeof(tempPathID), "%slib%s", m_SearchPaths[i].GetPathString(), pFileName ); // append the path to this dir. Q_snprintf( tempPathID, sizeof(tempPathID), "%slib%s", m_SearchPaths[i].GetPathString(), pFileName ); // append the path to this dir.
pModule = Sys_LoadModule( tempPathID ); pModule = Sys_LoadModule( tempPathID );
if ( pModule ) if ( pModule )
return pModule; return pModule;
#endif #endif
Q_snprintf( tempPathID, sizeof(tempPathID), "%s%s", m_SearchPaths[i].GetPathString(), pFileName ); // append the path to this dir.
pModule = Sys_LoadModule( tempPathID );
if ( pModule )
return pModule;
} }
#endif #endif

View File

@ -65,9 +65,9 @@ def build(bld):
'ZLIB' 'ZLIB'
] ]
install_path = bld.env.PREFIX install_path = bld.env.LIBDIR
if bld.env.DEST_OS != 'android': if bld.env.DEST_OS != 'android':
install_path += '/'+bld.env.GAMES+'/bin' install_path += '/'+bld.env.GAMES
source = [ 'in_touch.cpp' ] source = [ 'in_touch.cpp' ]
if bld.env.DEST_OS == 'win32': if bld.env.DEST_OS == 'win32':

View File

@ -59,9 +59,9 @@ def build(bld):
if bld.env.DEST_OS == 'win32': if bld.env.DEST_OS == 'win32':
libs += ['USER32'] libs += ['USER32']
install_path = bld.env.PREFIX install_path = bld.env.LIBDIR
if bld.env.DEST_OS != 'android': if bld.env.DEST_OS != 'android':
install_path += '/'+bld.env.GAMES+'/bin' install_path += '/'+bld.env.GAMES
source = game["sources"] + ['../../public/tier0/memoverride.cpp'] source = game["sources"] + ['../../public/tier0/memoverride.cpp']
includes += game["includes"] includes += game["includes"]

View File

@ -239,11 +239,7 @@ void SetGameDirectory( const char *game )
bool GetExecutableName( char *out, int outSize ) bool GetExecutableName( char *out, int outSize )
{ {
#ifdef WIN32 #ifdef WIN32
if ( !::GetModuleFileName( ( HINSTANCE )GetModuleHandle( NULL ), out, outSize ) ) return !!::GetModuleFileName( ( HINSTANCE )GetModuleHandle( NULL ), out, outSize );
{
return false;
}
return true;
#else #else
return false; return false;
#endif #endif

View File

@ -216,31 +216,12 @@ static void WaitForDebuggerConnect( int argc, char *argv[], int time )
int main( int argc, char *argv[] ) int main( int argc, char *argv[] )
{ {
char ld_path[4196]; void *launcher = dlopen( "liblauncher" DLL_EXT_STRING, RTLD_NOW );
char *path = "bin/";
char *ld_env;
if( (ld_env = getenv("LD_LIBRARY_PATH")) != NULL )
{
snprintf(ld_path, sizeof(ld_path), "%s:bin/", ld_env);
path = ld_path;
}
setenv("LD_LIBRARY_PATH", path, 1);
extern char** environ;
if( getenv("NO_EXECVE_AGAIN") == NULL )
{
setenv("NO_EXECVE_AGAIN", "1", 1);
execve(argv[0], argv, environ);
}
void *launcher = dlopen( "bin/liblauncher" DLL_EXT_STRING, RTLD_NOW );
if ( !launcher ) if ( !launcher )
{
fprintf( stderr, "%s\nFailed to load the launcher\n", dlerror() ); fprintf( stderr, "%s\nFailed to load the launcher\n", dlerror() );
launcher = dlopen( "launcher" DLL_EXT_STRING, RTLD_NOW );
if( !launcher ) }
launcher = dlopen( "bin/launcher" DLL_EXT_STRING, RTLD_NOW );
if ( !launcher ) if ( !launcher )
{ {

View File

@ -672,7 +672,7 @@ bool CMaterialSystem::Connect( CreateInterfaceFn factory )
g_pLauncherMgr = (ILauncherMgr *)factory( "SDLMgrInterface001" /*SDL_MGR_INTERFACE_VERSION*/, NULL ); g_pLauncherMgr = (ILauncherMgr *)factory( "SDLMgrInterface001" /*SDL_MGR_INTERFACE_VERSION*/, NULL );
if ( !g_pLauncherMgr ) if ( !g_pLauncherMgr )
{ {
return false; Warning("Cannot connect SDL\n");
} }
#endif // USE_SDL #endif // USE_SDL
#endif // !DEDICATED #endif // !DEDICATED
@ -3102,8 +3102,6 @@ void CMaterialSystem::ResetTempHWMemory( bool bExitingLevel )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CMaterialSystem::CacheUsedMaterials( ) void CMaterialSystem::CacheUsedMaterials( )
{ {
printf("Cache materials\n");
g_pShaderAPI->EvictManagedResources(); g_pShaderAPI->EvictManagedResources();
for (MaterialHandle_t i = FirstMaterial(); i != InvalidMaterial(); i = NextMaterial(i) ) for (MaterialHandle_t i = FirstMaterial(); i != InvalidMaterial(); i = NextMaterial(i) )

View File

@ -308,54 +308,13 @@ static bool Sys_GetExecutableName( char *out, int len )
bool FileSystem_GetExecutableDir( char *exedir, int exeDirLen ) bool FileSystem_GetExecutableDir( char *exedir, int exeDirLen )
{ {
#ifdef ANDROID #ifdef ANDROID
Q_snprintf( exedir, exeDirLen, "%s", getenv("APP_LIB_PATH") ); Q_strncpy( exedir, getenv("APP_LIB_PATH"), exeDirLen );
#else #else
exedir[0] = 0; # ifdef _WIN32
Q_strncpy( exedir, "./bin", exeDirLen );
if ( s_bUseVProjectBinDir ) # else
{ Q_strncpy( exedir, LIBDIR, exeDirLen );
const char *pProject = GetVProjectCmdLineValue(); # endif
if ( !pProject )
{
// Check their registry.
pProject = getenv( GAMEDIR_TOKEN );
}
if ( pProject )
{
Q_snprintf( exedir, exeDirLen, "%s%c..%cbin", pProject, CORRECT_PATH_SEPARATOR, CORRECT_PATH_SEPARATOR );
return true;
}
return false;
}
if ( !Sys_GetExecutableName( exedir, exeDirLen ) )
return false;
Q_StripFilename( exedir );
if ( IsX360() )
{
// The 360 can have its exe and dlls reside on different volumes
// use the optional basedir as the exe dir
if ( CommandLine()->FindParm( "-basedir" ) )
{
strcpy( exedir, CommandLine()->ParmValue( "-basedir", "" ) );
}
}
Q_FixSlashes( exedir );
const char* libDir = "bin";
// Return the bin directory as the executable dir if it's not in there
// because that's really where we're running from...
char ext[MAX_PATH];
Q_StrRight( exedir, 4, ext, sizeof( ext ) );
if ( ext[0] != CORRECT_PATH_SEPARATOR || Q_stricmp( ext+1, libDir ) != 0 )
{
Q_strncat( exedir, CORRECT_PATH_SEPARATOR_S, exeDirLen, COPY_ALL_CHARACTERS );
Q_strncat( exedir, libDir, exeDirLen, COPY_ALL_CHARACTERS );
Q_FixSlashes( exedir );
}
#endif #endif
return true; return true;
@ -364,17 +323,15 @@ bool FileSystem_GetExecutableDir( char *exedir, int exeDirLen )
static bool FileSystem_GetBaseDir( char *baseDir, int baseDirLen ) static bool FileSystem_GetBaseDir( char *baseDir, int baseDirLen )
{ {
#ifdef ANDROID #ifdef ANDROID
strncpy(baseDir, getenv("VALVE_GAME_PATH"), baseDirLen); Q_strncpy(baseDir, getenv("VALVE_GAME_PATH"), baseDirLen);
return true;
#else #else
if ( FileSystem_GetExecutableDir( baseDir, baseDirLen ) ) // get relative base dir which appends to other paths
{ // allows to run from everywhere
Q_StripFilename( baseDir ); // "hl2/portal" -> "hl2"; "hl2" -> ""
return true; Q_strncpy( baseDir, CommandLine()->ParmValue("-game", ""), baseDirLen );
} Q_StripFilename( baseDir );
return false;
#endif #endif
return true;
} }
void LaunchVConfig() void LaunchVConfig()
@ -1094,16 +1051,23 @@ FSReturnCode_t FileSystem_SetBasePaths( IFileSystem *pFileSystem )
{ {
pFileSystem->RemoveSearchPaths( "EXECUTABLE_PATH" ); pFileSystem->RemoveSearchPaths( "EXECUTABLE_PATH" );
char executablePath[MAX_PATH]; char path[MAX_PATH];
if ( !FileSystem_GetExecutableDir( executablePath, sizeof( executablePath ) ) ) if ( !FileSystem_GetExecutableDir( path, MAX_PATH ) )
return SetupFileSystemError( false, FS_INVALID_PARAMETERS, "FileSystem_GetExecutableDir failed." ); return SetupFileSystemError( false, FS_INVALID_PARAMETERS, "FileSystem_GetExecutableDir failed." );
pFileSystem->AddSearchPath( executablePath, "EXECUTABLE_PATH" ); pFileSystem->AddSearchPath( path, "EXECUTABLE_PATH" );
if ( !FileSystem_GetBaseDir( executablePath, sizeof( executablePath ) ) ) if ( !FileSystem_GetBaseDir( path, MAX_PATH ) )
return SetupFileSystemError( false, FS_INVALID_PARAMETERS, "FileSystem_GetBaseDir failed." ); return SetupFileSystemError( false, FS_INVALID_PARAMETERS, "FileSystem_GetBaseDir failed." );
pFileSystem->AddSearchPath( executablePath, "BASE_PATH" ); pFileSystem->AddSearchPath( path, "BASE_PATH" );
// path for client/server libraries
// "hl2/portal" -> "LIBDIR/portal"; "hl2" -> "LIBDIR/hl2"
char gamePath[MAX_PATH];
V_FileBase( CommandLine()->ParmValue("-game"), gamePath, MAX_PATH );
Q_snprintf( path, MAX_PATH, "%s/%s", LIBDIR, gamePath );
pFileSystem->AddSearchPath( path, "GAMEBIN" );
return FS_OK; return FS_OK;
} }

View File

@ -4,4 +4,4 @@ git submodule init && git submodule update
./waf configure -T release --sanitize=address,undefined --disable-warns --tests --prefix=out/ $* && ./waf configure -T release --sanitize=address,undefined --disable-warns --tests --prefix=out/ $* &&
./waf install && ./waf install &&
cd out && cd out &&
DYLD_LIBRARY_PATH=bin/ ./unittest || exit 1 ./bin/unittest || exit 1

View File

@ -7,4 +7,4 @@ sudo apt-get install -y libbz2-dev
./waf configure -T release --sanitize=address,undefined --disable-warns --tests --prefix=out/ $* && ./waf configure -T release --sanitize=address,undefined --disable-warns --tests --prefix=out/ $* &&
./waf install && ./waf install &&
cd out && cd out &&
LD_LIBRARY_PATH=bin/ ./unittest ./bin/unittest

View File

@ -8,4 +8,4 @@ sudo apt-get install -y g++-multilib gcc-multilib libbz2-dev:i386
PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig ./waf configure -T release --32bits --sanitize=address,undefined --disable-warns --tests --prefix=out/ $* && PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig ./waf configure -T release --32bits --sanitize=address,undefined --disable-warns --tests --prefix=out/ $* &&
./waf install && ./waf install &&
cd out && cd out &&
LD_LIBRARY_PATH=bin/ ./unittest ./bin/unittest

View File

@ -369,6 +369,16 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent()
{ {
return g_SDLWindow; return g_SDLWindow;
} }
#elif !defined( _WIN32 )
DBG_INTERFACE void SetAssertDialogParent( void *window)
{
(void)window;
}
DBG_INTERFACE void * GetAssertDialogParent()
{
return NULL;
}
#endif #endif
DBG_INTERFACE bool ShouldUseNewAssertDialog() DBG_INTERFACE bool ShouldUseNewAssertDialog()

View File

@ -269,12 +269,6 @@ static bool s_bRunningWithDebugModules = false;
#ifdef POSIX #ifdef POSIX
#ifdef ANDROID
#define DEFAULT_LIB_PATH ""
#else
#define DEFAULT_LIB_PATH "bin/"
#endif
bool foundLibraryWithPrefix( char *pModuleAbsolutePath, size_t AbsolutePathSize, const char *pPath, const char *pModuleName ) bool foundLibraryWithPrefix( char *pModuleAbsolutePath, size_t AbsolutePathSize, const char *pPath, const char *pModuleName )
{ {
char str[1024]; char str[1024];
@ -283,21 +277,9 @@ bool foundLibraryWithPrefix( char *pModuleAbsolutePath, size_t AbsolutePathSize,
bool bFound = false; bool bFound = false;
struct stat statBuf; struct stat statBuf;
Q_snprintf(pModuleAbsolutePath, AbsolutePathSize, "%s/" DEFAULT_LIB_PATH "lib%s", pPath, str); Q_snprintf(pModuleAbsolutePath, AbsolutePathSize, "%s/lib%s", pPath, str);
bFound |= stat(pModuleAbsolutePath, &statBuf) == 0; bFound |= stat(pModuleAbsolutePath, &statBuf) == 0;
if( !bFound )
{
Q_snprintf(pModuleAbsolutePath, AbsolutePathSize, "%s/" DEFAULT_LIB_PATH "%s", pPath, str);
bFound |= stat(pModuleAbsolutePath, &statBuf) == 0;
}
if( !bFound )
{
Q_snprintf(pModuleAbsolutePath, AbsolutePathSize, "%s/lib%s", pPath, str);
bFound |= stat(pModuleAbsolutePath, &statBuf) == 0;
}
if( !bFound ) if( !bFound )
{ {
Q_snprintf(pModuleAbsolutePath, AbsolutePathSize, "%s/%s", pPath, str); Q_snprintf(pModuleAbsolutePath, AbsolutePathSize, "%s/%s", pPath, str);
@ -321,7 +303,7 @@ CSysModule *Sys_LoadModule( const char *pModuleName, Sys_Flags flags /* = SYS_NO
// prior to the call to this routine. // prior to the call to this routine.
char szCwd[1024]; char szCwd[1024];
#ifdef POSIX #ifdef POSIX
char szModuleName[1024] = { 0 }; char szModuleName[1024] = { '\0' };
#endif #endif
HMODULE hDLL = NULL; HMODULE hDLL = NULL;
@ -367,7 +349,7 @@ CSysModule *Sys_LoadModule( const char *pModuleName, Sys_Flags flags /* = SYS_NO
} }
#elif defined( POSIX ) #elif defined( POSIX )
if( !foundLibraryWithPrefix(szAbsoluteModuleName, sizeof(szAbsoluteModuleName), szCwd, pModuleName) ) if( !foundLibraryWithPrefix(szAbsoluteModuleName, sizeof(szAbsoluteModuleName), LIBDIR, pModuleName) )
{ {
Warning("Can't find module - %s\n", pModuleName); Warning("Can't find module - %s\n", pModuleName);
return reinterpret_cast<CSysModule *>(hDLL); return reinterpret_cast<CSysModule *>(hDLL);

View File

@ -94,7 +94,7 @@ bool CUnitTestApp::Create()
#ifdef WIN32 #ifdef WIN32
WIN32_FIND_DATA findFileData; WIN32_FIND_DATA findFileData;
HANDLE hFind= FindFirstFile("tests/*.dll", &findFileData); HANDLE hFind= FindFirstFile("bin/tests/*.dll", &findFileData);
while (hFind != INVALID_HANDLE_VALUE) while (hFind != INVALID_HANDLE_VALUE)
{ {
@ -122,7 +122,7 @@ bool CUnitTestApp::Create()
#elif POSIX #elif POSIX
DIR *d; DIR *d;
struct dirent *dir; struct dirent *dir;
d = opendir("tests"); d = opendir(LIBDIR "/tests");
if (d) if (d)
{ {
while ((dir = readdir(d)) != NULL) while ((dir = readdir(d)) != NULL)

2
waf vendored
View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# encoding: latin-1 # encoding: latin-1
# Thomas Nagy, 2005-2018 # Thomas Nagy, 2005-2018
# #

34
wscript
View File

@ -1,4 +1,5 @@
#! /usr/bin/env python #! /usr/bin/env python
# vim: noexpandtab
# encoding: utf-8 # encoding: utf-8
# nillerusr # nillerusr
@ -495,6 +496,19 @@ def configure(conf):
cflags, linkflags = conf.get_optimization_flags() cflags, linkflags = conf.get_optimization_flags()
# installation paths
if conf.env.DEST_OS == 'android':
conf.env.LIBDIR = conf.env.BINDIR = conf.env.PREFIX
elif conf.env.DEST_OS == 'win32':
# mustdie
conf.env.LIBDIR = conf.env.PREFIX + '/bin'
conf.env.BINDIR = conf.env.PREFIX
else:
conf.env.LIBDIR = conf.env.LIBDIR + '/srceng'
conf.env.TESTDIR = conf.env.LIBDIR + '/tests'
conf.define('BINDIR', conf.env.BINDIR)
conf.define('LIBDIR', conf.env.LIBDIR)
flags = [] flags = []
@ -502,12 +516,14 @@ def configure(conf):
flags += ['-fsanitize=%s'%conf.options.SANITIZE, '-fno-sanitize=vptr'] flags += ['-fsanitize=%s'%conf.options.SANITIZE, '-fno-sanitize=vptr']
if conf.env.DEST_OS != 'win32': if conf.env.DEST_OS != 'win32':
flags += ['-pipe', '-fPIC', '-L'+os.path.abspath('.')+'/lib/'+conf.env.DEST_OS+'/'+conf.env.DEST_CPU+'/'] flags += ['-pipe', '-fPIC']
conf.env.RPATH = [conf.env.LIBDIR]
if conf.env.COMPILER_CC != 'msvc': if conf.env.COMPILER_CC != 'msvc':
flags += ['-pthread'] flags += ['-pthread']
if conf.env.DEST_OS == 'android': if conf.env.DEST_OS == 'android':
flags += [ flags += [
'-L'+os.path.abspath('.')+'/lib/android/'+conf.env.DEST_CPU+'/',
'-I'+os.path.abspath('.')+'/thirdparty/curl/include', '-I'+os.path.abspath('.')+'/thirdparty/curl/include',
'-I'+os.path.abspath('.')+'/thirdparty/SDL', '-I'+os.path.abspath('.')+'/thirdparty/SDL',
'-I'+os.path.abspath('.')+'/thirdparty/openal-soft/include/', '-I'+os.path.abspath('.')+'/thirdparty/openal-soft/include/',
@ -518,7 +534,10 @@ def configure(conf):
] ]
flags += ['-funwind-tables', '-g'] flags += ['-funwind-tables', '-g']
elif conf.env.COMPILER_CC != 'msvc' and conf.env.DEST_OS != 'darwin' and conf.env.DEST_CPU in ['x86', 'x86_64']: elif conf.env.DEST_OS == 'win32':
flags += ['-L'+os.path.abspath('.')+'/lib/win32/'+conf.env.DEST_CPU+'/']
if conf.env.COMPILER_CC != 'msvc' and conf.env.DEST_OS != 'darwin' and conf.env.DEST_CPU in ['x86', 'x86_64']:
flags += ['-march=core2'] flags += ['-march=core2']
if conf.env.DEST_CPU in ['x86', 'x86_64']: if conf.env.DEST_CPU in ['x86', 'x86_64']:
@ -529,9 +548,6 @@ def configure(conf):
if conf.env.DEST_CPU == 'arm': if conf.env.DEST_CPU == 'arm':
flags += ['-march=armv7-a', '-mfpu=neon-vfpv4'] flags += ['-march=armv7-a', '-mfpu=neon-vfpv4']
if conf.env.DEST_OS == 'freebsd':
linkflags += ['-lexecinfo']
if conf.env.DEST_OS != 'win32': if conf.env.DEST_OS != 'win32':
cflags += flags cflags += flags
linkflags += flags linkflags += flags
@ -605,14 +621,6 @@ def configure(conf):
check_deps( conf ) check_deps( conf )
# indicate if we are packaging for Linux/BSD
if conf.env.DEST_OS != 'android':
conf.env.LIBDIR = conf.env.PREFIX+'/bin/'
conf.env.TESTDIR = conf.env.PREFIX+'/tests/'
conf.env.BINDIR = conf.env.PREFIX
else:
conf.env.LIBDIR = conf.env.BINDIR = conf.env.PREFIX
if conf.options.CCACHE: if conf.options.CCACHE:
conf.env.CC.insert(0, 'ccache') conf.env.CC.insert(0, 'ccache')
conf.env.CXX.insert(0, 'ccache') conf.env.CXX.insert(0, 'ccache')