Browse Source

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.
pull/246/head
Er2 2 years ago
parent
commit
12f4148608
  1. 2
      appframework/posixapp.cpp
  2. 12
      dedicated_main/main.cpp
  3. 16
      engine/cdll_engine_int.cpp
  4. 16
      engine/sys_dll.cpp
  5. 13
      filesystem/basefilesystem.cpp
  6. 4
      game/client/wscript
  7. 4
      game/server/wscript
  8. 10
      launcher_main/main.cpp
  9. 2
      materialsystem/cmaterialsystem.cpp
  10. 174
      public/filesystem_init.cpp
  11. 5
      public/filesystem_init.h
  12. 2
      scripts/tests-macos-amd64.sh
  13. 2
      scripts/tests-ubuntu-amd64.sh
  14. 2
      scripts/tests-ubuntu-i386.sh
  15. 24
      tier1/interface.cpp
  16. 2
      tier1/wscript
  17. 2
      waf
  18. 27
      wscript

2
appframework/posixapp.cpp

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

12
dedicated_main/main.cpp

@ -188,6 +188,7 @@ static void WaitForDebuggerConnect( int argc, char *argv[], int time ) @@ -188,6 +188,7 @@ static void WaitForDebuggerConnect( int argc, char *argv[], int time )
int main( int argc, char *argv[] )
{
#if 0
// Must add 'bin' to the path....
char* pPath = getenv("LD_LIBRARY_PATH");
char szBuffer[4096];
@ -203,14 +204,11 @@ int main( int argc, char *argv[] ) @@ -203,14 +204,11 @@ int main( int argc, char *argv[] )
{
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;
#endif
void *dedicated = dlopen( pBinaryName, RTLD_NOW );
void *dedicated = dlopen( "libdedicated", RTLD_NOW );
if ( !dedicated )
dedicated = dlopen( "bin/libdedicated" DLL_EXT_STRING, RTLD_NOW );
dedicated = dlopen( "dedicated" DLL_EXT_STRING, RTLD_NOW );
if ( !dedicated )
{
@ -228,7 +226,5 @@ int main( int argc, char *argv[] ) @@ -228,7 +226,5 @@ int main( int argc, char *argv[] )
ret = dedicated_main( argc,argv );
dlclose( dedicated );
dlclose( vstdlib );
dlclose( tier0 );
}
#endif

16
engine/cdll_engine_int.cpp

@ -1715,6 +1715,7 @@ bool ClientDLL_Load() @@ -1715,6 +1715,7 @@ bool ClientDLL_Load()
{
Assert ( !g_ClientDLLModule );
#if 0
// 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
if ( !Host_AllowLoadModule( "client.dll", "GAMEBIN", true ) )
@ -1723,8 +1724,23 @@ bool ClientDLL_Load() @@ -1723,8 +1724,23 @@ bool ClientDLL_Load()
Host_DisallowSecureServers();
Host_AllowLoadModule( "client.dll","GAMEBIN", true );
}
#endif
#if 0
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 )
{
g_ClientFactory = Sys_GetFactory( g_ClientDLLModule );

16
engine/sys_dll.cpp

@ -464,7 +464,7 @@ void Sys_Error_Internal( bool bMinidump, const char *error, va_list argsList ) @@ -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
// 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() );
printf("\n ##### Sys_Error: %s", text );
printf("\n ##### Sys_Error: %s\n", text );
fflush(stdout );
raise(SIGTRAP);
@ -1117,12 +1117,12 @@ void Sys_ShutdownGame( void ) @@ -1117,12 +1117,12 @@ void Sys_ShutdownGame( void )
CreateInterfaceFn g_ServerFactory;
#pragma optimize( "g", off )
static bool LoadThisDll( char *szDllFilename, bool bIsServerOnly )
{
CSysModule *pDLL = NULL;
#if 0
// 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 ) )
{
@ -1134,6 +1134,16 @@ static bool LoadThisDll( char *szDllFilename, bool bIsServerOnly ) @@ -1134,6 +1134,16 @@ static bool LoadThisDll( char *szDllFilename, bool bIsServerOnly )
// ensures that the game.dll is running under Steam
// this will have to be undone when we want mods to be able to run
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);
goto IgnoreThisDLL;
@ -1255,7 +1265,7 @@ void LoadEntityDLLs( const char *szBaseDir, bool bIsServerOnly ) @@ -1255,7 +1265,7 @@ void LoadEntityDLLs( const char *szBaseDir, bool bIsServerOnly )
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());
}
}

13
filesystem/basefilesystem.cpp

@ -5057,20 +5057,17 @@ CSysModule *CBaseFileSystem::LoadModule( const char *pFileName, const char *pPat @@ -5057,20 +5057,17 @@ CSysModule *CBaseFileSystem::LoadModule( const char *pFileName, const char *pPat
if ( FilterByPathID( &m_SearchPaths[i], lookup ) )
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
Q_snprintf( tempPathID, sizeof(tempPathID), "%slib%s", m_SearchPaths[i].GetPathString(), pFileName ); // append the path to this dir.
pModule = Sys_LoadModule( tempPathID );
if ( pModule )
return pModule;
#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

4
game/client/wscript

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

4
game/server/wscript

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

10
launcher_main/main.cpp

@ -216,6 +216,7 @@ static void WaitForDebuggerConnect( int argc, char *argv[], int time ) @@ -216,6 +216,7 @@ static void WaitForDebuggerConnect( int argc, char *argv[], int time )
int main( int argc, char *argv[] )
{
#if 0
char ld_path[4196];
char *path = "bin/";
char *ld_env;
@ -234,13 +235,14 @@ int main( int argc, char *argv[] ) @@ -234,13 +235,14 @@ int main( int argc, char *argv[] )
setenv("NO_EXECVE_AGAIN", "1", 1);
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 )
{
fprintf( stderr, "%s\nFailed to load the launcher\n", dlerror() );
if( !launcher )
launcher = dlopen( "bin/launcher" DLL_EXT_STRING, RTLD_NOW );
launcher = dlopen( "launcher" DLL_EXT_STRING, RTLD_NOW );
}
if ( !launcher )
{

2
materialsystem/cmaterialsystem.cpp

@ -3102,8 +3102,6 @@ void CMaterialSystem::ResetTempHWMemory( bool bExitingLevel ) @@ -3102,8 +3102,6 @@ void CMaterialSystem::ResetTempHWMemory( bool bExitingLevel )
//-----------------------------------------------------------------------------
void CMaterialSystem::CacheUsedMaterials( )
{
printf("Cache materials\n");
g_pShaderAPI->EvictManagedResources();
for (MaterialHandle_t i = FirstMaterial(); i != InvalidMaterial(); i = NextMaterial(i) )

174
public/filesystem_init.cpp

@ -305,96 +305,13 @@ static bool Sys_GetExecutableName( char *out, int len ) @@ -305,96 +305,13 @@ static bool Sys_GetExecutableName( char *out, int len )
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 )
{
#ifdef ANDROID
strncpy(baseDir, getenv("VALVE_GAME_PATH"), baseDirLen);
return true;
#else
if ( FileSystem_GetExecutableDir( baseDir, baseDirLen ) )
{
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" );
return getcwd(baseDir, baseDirLen) != NULL;
#endif
}
@ -412,13 +329,6 @@ FSReturnCode_t SetupFileSystemError( bool bRunVConfig, FSReturnCode_t retVal, co @@ -412,13 +329,6 @@ FSReturnCode_t SetupFileSystemError( bool bRunVConfig, FSReturnCode_t retVal, co
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 )
{
Error( "%s\n", g_FileSystemError );
@ -1012,32 +922,6 @@ bool DoesPathExistAlready( const char *pPathEnvVar, const char *pTestPath ) @@ -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 )
{
// 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 @@ -1092,19 +976,7 @@ void SetSteamUserPassphrase( KeyValues *pSteamInfo, CSteamEnvVars &steamEnvVars
FSReturnCode_t FileSystem_SetBasePaths( IFileSystem *pFileSystem )
{
pFileSystem->RemoveSearchPaths( "EXECUTABLE_PATH" );
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" );
// Er2: Deprecated. Used only in hammer
return FS_OK;
}
@ -1113,43 +985,14 @@ FSReturnCode_t FileSystem_SetBasePaths( IFileSystem *pFileSystem ) @@ -1113,43 +985,14 @@ FSReturnCode_t FileSystem_SetBasePaths( IFileSystem *pFileSystem )
//-----------------------------------------------------------------------------
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
Q_snprintf( pFileSystemDLL, nMaxLen, "%s%cfilesystem_stdio" DLL_EXT_STRING, executablePath, CORRECT_PATH_SEPARATOR );
#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
#ifdef POSIX
Q_strncpy( pFileSystemDLL, "libfilesystem_stdio" DLL_EXT_STRING, nMaxLen );
#else
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
Q_snprintf( pFileSystemDLL, nMaxLen, "%s%clibfilesystem_stdio" DLL_EXT_STRING, executablePath, CORRECT_PATH_SEPARATOR );
Q_strncpy( pFileSystemDLL, "filesystem_stdio" DLL_EXT_STRING, nMaxLen );
#endif
#if 0
#if !defined( _X360 )
// Use filsystem_steam if it exists?
#if defined( OSX ) || defined( LINUX )
@ -1162,10 +1005,9 @@ FSReturnCode_t FileSystem_GetFileSystemDLLName( char *pFileSystemDLL, int nMaxLe @@ -1162,10 +1005,9 @@ FSReturnCode_t FileSystem_GetFileSystemDLLName( char *pFileSystemDLL, int nMaxLe
_access( pFileSystemDLL, 0 ) != 0
#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
return FS_OK;

5
public/filesystem_init.h

@ -199,16 +199,11 @@ void FileSystem_AddSearchPath_Platform( IFileSystem *pFileSystem, const char *sz @@ -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.
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.
// TODO: always do this after LoadFileSysteModule.. there's no reason it should be
// in the environment.
void FileSystem_ClearSteamEnvVars();
// Find the steam.cfg above you for optional stuff
FSReturnCode_t GetSteamCfgPath( char *steamCfgPath, int steamCfgPathLen );
// Returns the last error.
const char *FileSystem_GetLastErrorString();

2
scripts/tests-macos-amd64.sh

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

2
scripts/tests-ubuntu-amd64.sh

@ -7,4 +7,4 @@ sudo apt-get install -y libbz2-dev @@ -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 install &&
cd out &&
LD_LIBRARY_PATH=bin/ ./unittest
./bin/unittest

2
scripts/tests-ubuntu-i386.sh

@ -8,4 +8,4 @@ sudo apt-get install -y g++-multilib gcc-multilib libbz2-dev:i386 @@ -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/ $* &&
./waf install &&
cd out &&
LD_LIBRARY_PATH=bin/ ./unittest
./bin/unittest

24
tier1/interface.cpp

@ -269,12 +269,6 @@ static bool s_bRunningWithDebugModules = false; @@ -269,12 +269,6 @@ static bool s_bRunningWithDebugModules = false;
#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 )
{
char str[1024];
@ -283,21 +277,9 @@ bool foundLibraryWithPrefix( char *pModuleAbsolutePath, size_t AbsolutePathSize, @@ -283,21 +277,9 @@ bool foundLibraryWithPrefix( char *pModuleAbsolutePath, size_t AbsolutePathSize,
bool bFound = false;
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;
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 )
{
Q_snprintf(pModuleAbsolutePath, AbsolutePathSize, "%s/%s", pPath, str);
@ -321,7 +303,7 @@ CSysModule *Sys_LoadModule( const char *pModuleName, Sys_Flags flags /* = SYS_NO @@ -321,7 +303,7 @@ CSysModule *Sys_LoadModule( const char *pModuleName, Sys_Flags flags /* = SYS_NO
// prior to the call to this routine.
char szCwd[1024];
#ifdef POSIX
char szModuleName[1024] = { 0 };
char szModuleName[1024] = { '\0' };
#endif
HMODULE hDLL = NULL;
@ -367,7 +349,7 @@ CSysModule *Sys_LoadModule( const char *pModuleName, Sys_Flags flags /* = SYS_NO @@ -367,7 +349,7 @@ CSysModule *Sys_LoadModule( const char *pModuleName, Sys_Flags flags /* = SYS_NO
}
#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);
return reinterpret_cast<CSysModule *>(hDLL);

2
tier1/wscript

@ -79,7 +79,7 @@ def build(bld): @@ -79,7 +79,7 @@ def build(bld):
'../common'
]
defines = []
defines = ['LIBDIR="%s"' % bld.env.LIBDIR]
libs = []
if bld.env.DEST_OS == 'win32':

2
waf vendored

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

27
wscript

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
#! /usr/bin/env python
# vim: noexpandtab
# encoding: utf-8
# nillerusr
@ -461,6 +462,12 @@ def configure(conf): @@ -461,6 +462,12 @@ def configure(conf):
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 = []
@ -468,12 +475,14 @@ def configure(conf): @@ -468,12 +475,14 @@ def configure(conf):
flags += ['-fsanitize=%s'%conf.options.SANITIZE, '-fno-sanitize=vptr']
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':
flags += ['-pthread']
if conf.env.DEST_OS == 'android':
flags += [
'-L'+os.path.abspath('.')+'/lib/android/'+conf.env.DEST_CPU+'/',
'-I'+os.path.abspath('.')+'/thirdparty/curl/include',
'-I'+os.path.abspath('.')+'/thirdparty/SDL',
'-I'+os.path.abspath('.')+'/thirdparty/openal-soft/include/',
@ -484,7 +493,10 @@ def configure(conf): @@ -484,7 +493,10 @@ def configure(conf):
]
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']
if conf.env.DEST_CPU in ['x86', 'x86_64']:
@ -495,9 +507,6 @@ def configure(conf): @@ -495,9 +507,6 @@ def configure(conf):
if conf.env.DEST_CPU == 'arm':
flags += ['-mfpu=neon-vfpv4']
if conf.env.DEST_OS == 'freebsd':
linkflags += ['-lexecinfo']
if conf.env.DEST_OS != 'win32':
cflags += flags
linkflags += flags
@ -571,14 +580,6 @@ def configure(conf): @@ -571,14 +580,6 @@ def configure(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:
conf.env.CC.insert(0, 'ccache')
conf.env.CXX.insert(0, 'ccache')

Loading…
Cancel
Save