mirror of
https://github.com/nillerusr/source-engine.git
synced 2025-05-06 20:28:04 +00:00
Allow installation to global directories.
This commit now install everything with FHS-compliant structure (/usr/local/bin/hl2_launcher and lib/libtier0.so lib/lib...). Binaries and libraries now uses rpath and not depends on local bin/ directory unlike original Valve's Source.
This commit is contained in:
parent
1a584655d9
commit
12f4148608
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,6 +188,7 @@ static void WaitForDebuggerConnect( int argc, char *argv[], int time )
|
|||||||
|
|
||||||
int main( int argc, char *argv[] )
|
int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
// Must add 'bin' to the path....
|
// Must add 'bin' to the path....
|
||||||
char* pPath = getenv("LD_LIBRARY_PATH");
|
char* pPath = getenv("LD_LIBRARY_PATH");
|
||||||
char szBuffer[4096];
|
char szBuffer[4096];
|
||||||
@ -203,14 +204,11 @@ int main( int argc, char *argv[] )
|
|||||||
{
|
{
|
||||||
printf( "%s\n", strerror(errno) );
|
printf( "%s\n", strerror(errno) );
|
||||||
}
|
}
|
||||||
void *tier0 = dlopen( "libtier0" DLL_EXT_STRING, RTLD_NOW );
|
#endif
|
||||||
void *vstdlib = dlopen( "libvstdlib" DLL_EXT_STRING, RTLD_NOW );
|
|
||||||
|
|
||||||
const char *pBinaryName = "bin/dedicated" DLL_EXT_STRING;
|
void *dedicated = dlopen( "libdedicated", RTLD_NOW );
|
||||||
|
|
||||||
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 )
|
||||||
{
|
{
|
||||||
@ -228,7 +226,5 @@ int main( int argc, char *argv[] )
|
|||||||
|
|
||||||
ret = dedicated_main( argc,argv );
|
ret = dedicated_main( argc,argv );
|
||||||
dlclose( dedicated );
|
dlclose( dedicated );
|
||||||
dlclose( vstdlib );
|
|
||||||
dlclose( tier0 );
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1715,6 +1715,7 @@ bool ClientDLL_Load()
|
|||||||
{
|
{
|
||||||
Assert ( !g_ClientDLLModule );
|
Assert ( !g_ClientDLLModule );
|
||||||
|
|
||||||
|
#if 0
|
||||||
// Check the signature on the client dll. If this fails we load it anyway but put this client
|
// Check the signature on the client dll. If this fails we load it anyway but put this client
|
||||||
// into insecure mode so it won't connect to secure servers and get VAC banned
|
// into insecure mode so it won't connect to secure servers and get VAC banned
|
||||||
if ( !Host_AllowLoadModule( "client.dll", "GAMEBIN", true ) )
|
if ( !Host_AllowLoadModule( "client.dll", "GAMEBIN", true ) )
|
||||||
@ -1723,8 +1724,23 @@ bool ClientDLL_Load()
|
|||||||
Host_DisallowSecureServers();
|
Host_DisallowSecureServers();
|
||||||
Host_AllowLoadModule( "client.dll","GAMEBIN", true );
|
Host_AllowLoadModule( "client.dll","GAMEBIN", true );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
g_ClientDLLModule = g_pFileSystem->LoadModule( "client", "GAMEBIN", false );
|
g_ClientDLLModule = g_pFileSystem->LoadModule( "client", "GAMEBIN", false );
|
||||||
|
#else
|
||||||
|
char clientPath[MAX_PATH];
|
||||||
|
const char *modName = CommandLine()->ParmValue("-game");
|
||||||
|
|
||||||
|
Q_snprintf(clientPath, MAX_PATH, "%s/libclient", modName);
|
||||||
|
g_ClientDLLModule = Sys_LoadModule(clientPath);
|
||||||
|
|
||||||
|
if (!g_ClientDLLModule)
|
||||||
|
{
|
||||||
|
Q_snprintf(clientPath, MAX_PATH, "%s/client", modName);
|
||||||
|
g_ClientDLLModule = Sys_LoadModule(clientPath);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if ( g_ClientDLLModule )
|
if ( g_ClientDLLModule )
|
||||||
{
|
{
|
||||||
g_ClientFactory = Sys_GetFactory( g_ClientDLLModule );
|
g_ClientFactory = Sys_GetFactory( g_ClientDLLModule );
|
||||||
|
@ -464,7 +464,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,12 +1117,12 @@ 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 )
|
||||||
{
|
{
|
||||||
CSysModule *pDLL = NULL;
|
CSysModule *pDLL = NULL;
|
||||||
|
|
||||||
|
#if 0
|
||||||
// check signature, don't let users with modified binaries connect to secure servers, they will get VAC banned
|
// check signature, don't let users with modified binaries connect to secure servers, they will get VAC banned
|
||||||
if ( !Host_AllowLoadModule( szDllFilename, "GAMEBIN", true, bIsServerOnly ) )
|
if ( !Host_AllowLoadModule( szDllFilename, "GAMEBIN", true, bIsServerOnly ) )
|
||||||
{
|
{
|
||||||
@ -1134,6 +1134,16 @@ static bool LoadThisDll( char *szDllFilename, bool bIsServerOnly )
|
|||||||
// ensures that the game.dll is running under Steam
|
// ensures that the game.dll is running under Steam
|
||||||
// this will have to be undone when we want mods to be able to run
|
// this will have to be undone when we want mods to be able to run
|
||||||
if ((pDLL = g_pFileSystem->LoadModule(szDllFilename, "GAMEBIN", false)) == NULL)
|
if ((pDLL = g_pFileSystem->LoadModule(szDllFilename, "GAMEBIN", false)) == NULL)
|
||||||
|
#endif
|
||||||
|
char dllPath[MAX_PATH];
|
||||||
|
const char *modName = CommandLine()->ParmValue("-game");
|
||||||
|
Q_snprintf(dllPath, MAX_PATH, "%s/lib%s", modName, szDllFilename);
|
||||||
|
if (!(pDLL = Sys_LoadModule(dllPath)))
|
||||||
|
{
|
||||||
|
Q_snprintf(dllPath, MAX_PATH, "%s/%s",modName, szDllFilename);
|
||||||
|
pDLL = Sys_LoadModule(dllPath);
|
||||||
|
}
|
||||||
|
if (!pDLL)
|
||||||
{
|
{
|
||||||
ConMsg("Failed to load %s\n", szDllFilename);
|
ConMsg("Failed to load %s\n", szDllFilename);
|
||||||
goto IgnoreThisDLL;
|
goto IgnoreThisDLL;
|
||||||
@ -1255,7 +1265,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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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':
|
||||||
|
@ -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"]
|
||||||
|
@ -216,6 +216,7 @@ static void WaitForDebuggerConnect( int argc, char *argv[], int time )
|
|||||||
|
|
||||||
int main( int argc, char *argv[] )
|
int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
char ld_path[4196];
|
char ld_path[4196];
|
||||||
char *path = "bin/";
|
char *path = "bin/";
|
||||||
char *ld_env;
|
char *ld_env;
|
||||||
@ -234,13 +235,14 @@ int main( int argc, char *argv[] )
|
|||||||
setenv("NO_EXECVE_AGAIN", "1", 1);
|
setenv("NO_EXECVE_AGAIN", "1", 1);
|
||||||
execve(argv[0], argv, environ);
|
execve(argv[0], argv, environ);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void *launcher = dlopen( "bin/liblauncher" DLL_EXT_STRING, RTLD_NOW );
|
void *launcher = dlopen( "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 )
|
||||||
{
|
{
|
||||||
|
@ -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) )
|
||||||
|
@ -305,96 +305,13 @@ static bool Sys_GetExecutableName( char *out, int len )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileSystem_GetExecutableDir( char *exedir, int exeDirLen )
|
|
||||||
{
|
|
||||||
#ifdef ANDROID
|
|
||||||
Q_snprintf( exedir, exeDirLen, "%s", getenv("APP_LIB_PATH") );
|
|
||||||
#else
|
|
||||||
exedir[0] = 0;
|
|
||||||
|
|
||||||
if ( s_bUseVProjectBinDir )
|
|
||||||
{
|
|
||||||
const char *pProject = GetVProjectCmdLineValue();
|
|
||||||
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
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
strncpy(baseDir, getenv("VALVE_GAME_PATH"), baseDirLen);
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
if ( FileSystem_GetExecutableDir( baseDir, baseDirLen ) )
|
return getcwd(baseDir, baseDirLen) != NULL;
|
||||||
{
|
|
||||||
Q_StripFilename( baseDir );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void LaunchVConfig()
|
|
||||||
{
|
|
||||||
#if defined( _WIN32 ) && !defined( _X360 )
|
|
||||||
char vconfigExe[MAX_PATH];
|
|
||||||
FileSystem_GetExecutableDir( vconfigExe, sizeof( vconfigExe ) );
|
|
||||||
Q_AppendSlash( vconfigExe, sizeof( vconfigExe ) );
|
|
||||||
Q_strncat( vconfigExe, "vconfig.exe", sizeof( vconfigExe ), COPY_ALL_CHARACTERS );
|
|
||||||
|
|
||||||
char *argv[] =
|
|
||||||
{
|
|
||||||
vconfigExe,
|
|
||||||
"-allowdebug",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
_spawnv( _P_NOWAIT, vconfigExe, argv );
|
|
||||||
#elif defined( _X360 )
|
|
||||||
Msg( "Launching vconfig.exe not supported\n" );
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,13 +329,6 @@ FSReturnCode_t SetupFileSystemError( bool bRunVConfig, FSReturnCode_t retVal, co
|
|||||||
|
|
||||||
Warning( "%s\n", g_FileSystemError );
|
Warning( "%s\n", g_FileSystemError );
|
||||||
|
|
||||||
// Run vconfig?
|
|
||||||
// Don't do it if they specifically asked for it not to, or if they manually specified a vconfig with -game or -vproject.
|
|
||||||
if ( bRunVConfig && g_FileSystemErrorMode == FS_ERRORMODE_VCONFIG && !CommandLine()->FindParm( CMDLINEOPTION_NOVCONFIG ) && !GetVProjectCmdLineValue() )
|
|
||||||
{
|
|
||||||
LaunchVConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( g_FileSystemErrorMode == FS_ERRORMODE_AUTO || g_FileSystemErrorMode == FS_ERRORMODE_VCONFIG )
|
if ( g_FileSystemErrorMode == FS_ERRORMODE_AUTO || g_FileSystemErrorMode == FS_ERRORMODE_VCONFIG )
|
||||||
{
|
{
|
||||||
Error( "%s\n", g_FileSystemError );
|
Error( "%s\n", g_FileSystemError );
|
||||||
@ -1012,32 +922,6 @@ bool DoesPathExistAlready( const char *pPathEnvVar, const char *pTestPath )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FSReturnCode_t GetSteamCfgPath( char *steamCfgPath, int steamCfgPathLen )
|
|
||||||
{
|
|
||||||
steamCfgPath[0] = 0;
|
|
||||||
char executablePath[MAX_PATH];
|
|
||||||
if ( !FileSystem_GetExecutableDir( executablePath, sizeof( executablePath ) ) )
|
|
||||||
{
|
|
||||||
return SetupFileSystemError( false, FS_INVALID_PARAMETERS, "FileSystem_GetExecutableDir failed." );
|
|
||||||
}
|
|
||||||
Q_strncpy( steamCfgPath, executablePath, steamCfgPathLen );
|
|
||||||
while ( 1 )
|
|
||||||
{
|
|
||||||
if ( DoesFileExistIn( steamCfgPath, "steam.cfg" ) )
|
|
||||||
break;
|
|
||||||
|
|
||||||
if ( !Q_StripLastDir( steamCfgPath, steamCfgPathLen) )
|
|
||||||
{
|
|
||||||
// the file isnt found, thats ok, its not mandatory
|
|
||||||
return FS_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Q_AppendSlash( steamCfgPath, steamCfgPathLen );
|
|
||||||
Q_strncat( steamCfgPath, "steam.cfg", steamCfgPathLen, COPY_ALL_CHARACTERS );
|
|
||||||
|
|
||||||
return FS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetSteamAppUser( KeyValues *pSteamInfo, const char *steamInstallPath, CSteamEnvVars &steamEnvVars )
|
void SetSteamAppUser( KeyValues *pSteamInfo, const char *steamInstallPath, CSteamEnvVars &steamEnvVars )
|
||||||
{
|
{
|
||||||
// Always inherit the Steam user if it's already set, since it probably means we (or the
|
// Always inherit the Steam user if it's already set, since it probably means we (or the
|
||||||
@ -1092,19 +976,7 @@ void SetSteamUserPassphrase( KeyValues *pSteamInfo, CSteamEnvVars &steamEnvVars
|
|||||||
|
|
||||||
FSReturnCode_t FileSystem_SetBasePaths( IFileSystem *pFileSystem )
|
FSReturnCode_t FileSystem_SetBasePaths( IFileSystem *pFileSystem )
|
||||||
{
|
{
|
||||||
pFileSystem->RemoveSearchPaths( "EXECUTABLE_PATH" );
|
// Er2: Deprecated. Used only in hammer
|
||||||
|
|
||||||
char executablePath[MAX_PATH];
|
|
||||||
if ( !FileSystem_GetExecutableDir( executablePath, sizeof( executablePath ) ) )
|
|
||||||
return SetupFileSystemError( false, FS_INVALID_PARAMETERS, "FileSystem_GetExecutableDir failed." );
|
|
||||||
|
|
||||||
pFileSystem->AddSearchPath( executablePath, "EXECUTABLE_PATH" );
|
|
||||||
|
|
||||||
if ( !FileSystem_GetBaseDir( executablePath, sizeof( executablePath ) ) )
|
|
||||||
return SetupFileSystemError( false, FS_INVALID_PARAMETERS, "FileSystem_GetBaseDir failed." );
|
|
||||||
|
|
||||||
pFileSystem->AddSearchPath( executablePath, "BASE_PATH" );
|
|
||||||
|
|
||||||
return FS_OK;
|
return FS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1113,43 +985,14 @@ FSReturnCode_t FileSystem_SetBasePaths( IFileSystem *pFileSystem )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
FSReturnCode_t FileSystem_GetFileSystemDLLName( char *pFileSystemDLL, int nMaxLen, bool &bSteam )
|
FSReturnCode_t FileSystem_GetFileSystemDLLName( char *pFileSystemDLL, int nMaxLen, bool &bSteam )
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
bSteam = false;
|
|
||||||
|
|
||||||
// Inside of here, we don't have a filesystem yet, so we have to assume that the filesystem_stdio or filesystem_steam
|
|
||||||
// is in this same directory with us.
|
|
||||||
char executablePath[MAX_PATH];
|
|
||||||
if ( !FileSystem_GetExecutableDir( executablePath, sizeof( executablePath ) ) )
|
|
||||||
return SetupFileSystemError( false, FS_INVALID_PARAMETERS, "FileSystem_GetExecutableDir failed." );
|
|
||||||
|
|
||||||
// Assume we'll use local files
|
// Assume we'll use local files
|
||||||
Q_snprintf( pFileSystemDLL, nMaxLen, "%s%cfilesystem_stdio" DLL_EXT_STRING, executablePath, CORRECT_PATH_SEPARATOR );
|
#ifdef POSIX
|
||||||
|
Q_strncpy( pFileSystemDLL, "libfilesystem_stdio" DLL_EXT_STRING, nMaxLen );
|
||||||
#if !defined( _X360 )
|
|
||||||
|
|
||||||
// Use filsystem_steam if it exists?
|
|
||||||
#if defined( OSX ) || defined( LINUX )
|
|
||||||
struct stat statBuf;
|
|
||||||
#endif
|
|
||||||
if (
|
|
||||||
#if defined( OSX ) || defined( LINUX )
|
|
||||||
stat( pFileSystemDLL, &statBuf ) != 0
|
|
||||||
#else
|
|
||||||
_access( pFileSystemDLL, 0 ) != 0
|
|
||||||
#endif
|
|
||||||
) {
|
|
||||||
Q_snprintf( pFileSystemDLL, nMaxLen, "%s%cfilesystem_steam" DLL_EXT_STRING, executablePath, CORRECT_PATH_SEPARATOR );
|
|
||||||
bSteam = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
char executablePath[MAX_PATH];
|
Q_strncpy( pFileSystemDLL, "filesystem_stdio" DLL_EXT_STRING, nMaxLen );
|
||||||
if ( !FileSystem_GetExecutableDir( executablePath, sizeof( executablePath ) ) )
|
#endif
|
||||||
return SetupFileSystemError( false, FS_INVALID_PARAMETERS, "FileSystem_GetExecutableDir failed." );
|
|
||||||
|
|
||||||
// Assume we'll use local files
|
|
||||||
Q_snprintf( pFileSystemDLL, nMaxLen, "%s%clibfilesystem_stdio" DLL_EXT_STRING, executablePath, CORRECT_PATH_SEPARATOR );
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
#if !defined( _X360 )
|
#if !defined( _X360 )
|
||||||
// Use filsystem_steam if it exists?
|
// Use filsystem_steam if it exists?
|
||||||
#if defined( OSX ) || defined( LINUX )
|
#if defined( OSX ) || defined( LINUX )
|
||||||
@ -1162,10 +1005,9 @@ FSReturnCode_t FileSystem_GetFileSystemDLLName( char *pFileSystemDLL, int nMaxLe
|
|||||||
_access( pFileSystemDLL, 0 ) != 0
|
_access( pFileSystemDLL, 0 ) != 0
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
Q_snprintf( pFileSystemDLL, nMaxLen, "%s%cfilesystem_stdio" DLL_EXT_STRING, executablePath, CORRECT_PATH_SEPARATOR );
|
Q_snprintf( pFileSystemDLL, nMaxLen, "filesystem_stdio" DLL_EXT_STRING );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return FS_OK;
|
return FS_OK;
|
||||||
|
@ -199,16 +199,11 @@ void FileSystem_AddSearchPath_Platform( IFileSystem *pFileSystem, const char *sz
|
|||||||
// See FSErrorMode_t. If you don't specify one here, then the default is FS_ERRORMODE_VCONFIG.
|
// See FSErrorMode_t. If you don't specify one here, then the default is FS_ERRORMODE_VCONFIG.
|
||||||
void FileSystem_SetErrorMode( FSErrorMode_t errorMode = FS_ERRORMODE_VCONFIG );
|
void FileSystem_SetErrorMode( FSErrorMode_t errorMode = FS_ERRORMODE_VCONFIG );
|
||||||
|
|
||||||
bool FileSystem_GetExecutableDir( char *exedir, int exeDirLen );
|
|
||||||
|
|
||||||
// Clear SteamAppUser, SteamUserPassphrase, and SteamAppId from this process's environment.
|
// Clear SteamAppUser, SteamUserPassphrase, and SteamAppId from this process's environment.
|
||||||
// TODO: always do this after LoadFileSysteModule.. there's no reason it should be
|
// TODO: always do this after LoadFileSysteModule.. there's no reason it should be
|
||||||
// in the environment.
|
// in the environment.
|
||||||
void FileSystem_ClearSteamEnvVars();
|
void FileSystem_ClearSteamEnvVars();
|
||||||
|
|
||||||
// Find the steam.cfg above you for optional stuff
|
|
||||||
FSReturnCode_t GetSteamCfgPath( char *steamCfgPath, int steamCfgPathLen );
|
|
||||||
|
|
||||||
// Returns the last error.
|
// Returns the last error.
|
||||||
const char *FileSystem_GetLastErrorString();
|
const char *FileSystem_GetLastErrorString();
|
||||||
|
|
||||||
|
@ -4,4 +4,4 @@ git submodule init && git submodule update
|
|||||||
./waf configure -T release --sanitize=address,undefined --disable-warns --tests -8 --prefix=out/ $* &&
|
./waf configure -T release --sanitize=address,undefined --disable-warns --tests -8 --prefix=out/ $* &&
|
||||||
./waf install &&
|
./waf install &&
|
||||||
cd out &&
|
cd out &&
|
||||||
DYLD_LIBRARY_PATH=bin/ ./unittest || exit 1
|
./bin/unittest || exit 1
|
||||||
|
@ -7,4 +7,4 @@ sudo apt-get install -y libbz2-dev
|
|||||||
./waf configure -T release --sanitize=address,undefined --disable-warns --tests --prefix=out/ --64bits $* &&
|
./waf configure -T release --sanitize=address,undefined --disable-warns --tests --prefix=out/ --64bits $* &&
|
||||||
./waf install &&
|
./waf install &&
|
||||||
cd out &&
|
cd out &&
|
||||||
LD_LIBRARY_PATH=bin/ ./unittest
|
./bin/unittest
|
||||||
|
@ -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 --sanitize=address,undefined --disable-warns --tests --prefix=out/ $* &&
|
PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig ./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
|
||||||
|
@ -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);
|
||||||
|
@ -79,7 +79,7 @@ def build(bld):
|
|||||||
'../common'
|
'../common'
|
||||||
]
|
]
|
||||||
|
|
||||||
defines = []
|
defines = ['LIBDIR="%s"' % bld.env.LIBDIR]
|
||||||
|
|
||||||
libs = []
|
libs = []
|
||||||
if bld.env.DEST_OS == 'win32':
|
if bld.env.DEST_OS == 'win32':
|
||||||
|
2
waf
vendored
2
waf
vendored
@ -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
|
||||||
#
|
#
|
||||||
|
27
wscript
27
wscript
@ -1,4 +1,5 @@
|
|||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
|
# vim: noexpandtab
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
# nillerusr
|
# nillerusr
|
||||||
|
|
||||||
@ -461,6 +462,12 @@ 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
|
||||||
|
else:
|
||||||
|
conf.env.LIBDIR = conf.env.LIBDIR + '/srceng'
|
||||||
|
conf.env.TESTDIR = conf.env.BINDIR + 'tests'
|
||||||
|
|
||||||
flags = []
|
flags = []
|
||||||
|
|
||||||
@ -468,12 +475,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']
|
||||||
|
linkflags += ['-Wl,-rpath=%s' % 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/',
|
||||||
@ -484,7 +493,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']:
|
||||||
@ -495,9 +507,6 @@ def configure(conf):
|
|||||||
if conf.env.DEST_CPU == 'arm':
|
if conf.env.DEST_CPU == 'arm':
|
||||||
flags += ['-mfpu=neon-vfpv4']
|
flags += ['-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
|
||||||
@ -571,14 +580,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')
|
||||||
|
Loading…
Reference in New Issue
Block a user