Add support for non-native ABI on hybrid build,

by following the steps taken by TranslatorRoster and LocaleRoster.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37900 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Houdoin 2010-08-04 14:05:59 +00:00
parent 3426ce1404
commit 39f372d1d7
2 changed files with 35 additions and 5 deletions

View File

@ -33,7 +33,8 @@ GLRendererRoster::GLRendererRoster(BGLView *view, ulong options)
: fNextID(0),
fView(view),
fOptions(options),
fSafeMode(false)
fSafeMode(false),
fABISubDirectory(NULL)
{
char parameter[32];
size_t parameterLength = sizeof(parameter);
@ -62,6 +63,23 @@ GLRendererRoster::GLRendererRoster(BGLView *view, ulong options)
fSafeMode = true;
}
// We might run in compatibility mode on a system with a different ABI. The
// renderers matching our ABI can usually be found in respective
// subdirectories of the opengl add-ons directories.
system_info info;
if (get_system_info(&info) == B_OK
&& (info.abi & B_HAIKU_ABI_MAJOR)
!= (B_HAIKU_ABI & B_HAIKU_ABI_MAJOR)) {
switch (B_HAIKU_ABI & B_HAIKU_ABI_MAJOR) {
case B_HAIKU_ABI_GCC_2:
fABISubDirectory = "gcc2";
break;
case B_HAIKU_ABI_GCC_4:
fABISubDirectory = "gcc4";
break;
}
}
AddDefaultPaths();
}
@ -111,6 +129,16 @@ GLRendererRoster::AddPath(const char* path)
if (status < B_OK)
return status;
// if a subdirectory for our ABI exists, use that instead
if (fABISubDirectory != NULL) {
BEntry entry(&directory, fABISubDirectory);
if (entry.IsDirectory()) {
status = directory.SetTo(&entry);
if (status != B_OK)
return status;
}
}
node_ref nodeRef;
status = directory.GetNodeRef(&nodeRef);
if (status < B_OK)

View File

@ -36,6 +36,8 @@ class GLRendererRoster {
BGLView *fView;
ulong fOptions;
bool fSafeMode;
const char* fABISubDirectory;
};
#endif /* _GLRENDERER_ROSTER_H */