opengl: Improve libGL linking and Mesa optional package

* Move compiled binaries into lib.haiku within Mesa optional
  pacakge, this enables us to use Make or scons to build Mesa
* Untangle libGL linking and order library inclusion
* Remove zmuldef hacks
* Compile libgallium into the libGL on Mesa 8.0 / gcc4 images
* Don't Mesa calculate cpu optimizations due to visibility
  issues, use Mesa cpu functions for this.
* Don't allow undefined symbols in libGL.so to ensure sanity.
* Move Mesa optional packages to haiku-files
This commit is contained in:
Alexander von Gluck IV
2012-01-17 14:57:49 +00:00
parent ec4f80739e
commit 3c0d5dcaf1
5 changed files with 29 additions and 75 deletions
+14 -18
View File
@@ -171,13 +171,18 @@ if $(HAIKU_BUILD_FEATURE_CLUCENE) {
# Mesa
local mesaBaseURL = http://pub.haikufire.com/mesa ;
local mesaBaseURL = http://haiku-files.org/files/optional-packages ;
if $(TARGET_ARCH) = x86 {
local glslObject ;
local galliumObjects ;
local zipFile ;
if $(HAIKU_GCC_VERSION[1]) >= 4 {
HAIKU_MESA_FILE = mesa-8.0-devel-gcc4-x86.zip ;
#HAIKU_MESA_FILE = mesa-8.0dev-x86-gcc4-2012-01-17.zip ;
HAIKU_MESA_FILE = mesa-8.0devdbg-x86-gcc4-2012-01-17.zip ;
glslObject = lib.haiku/libglsl.a ;
galliumObjects = lib.haiku/libgallium.a ;
} else {
HAIKU_MESA_FILE = mesa-7.8.2-gcc2-x86.zip ;
HAIKU_MESA_FILE = mesa-7.8.2-x86-gcc2-2012-01-17.zip ;
}
zipFile = [ DownloadFile $(HAIKU_MESA_FILE)
@@ -189,24 +194,15 @@ if $(TARGET_ARCH) = x86 {
HAIKU_MESA_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_MESA_DIR)
: include/ : $(zipFile) : extracted-mesa ] ;
if $(HAIKU_GCC_VERSION[1]) >= 4 {
HAIKU_MESA_LIBS = [ ExtractArchive $(HAIKU_MESA_DIR)
HAIKU_MESA_LIBS = [ ExtractArchive $(HAIKU_MESA_DIR)
:
src/mesa/libmesa.a
src/mapi/glapi/libglapi.a
lib/libGLU.a
lib.haiku/libglu.a
$(galliumObjects)
lib.haiku/libglapi.a
$(glslObject)
lib.haiku/libmesa.a
: $(zipFile)
: extracted-mesa ] ;
} else {
# Older Mesa 7.8
HAIKU_MESA_LIBS = [ ExtractArchive $(HAIKU_MESA_DIR)
:
src/mesa/libmesa.a
src/mesa/libglapi.a
lib/libGLU.a
: $(zipFile)
: extracted-mesa ] ;
}
HAIKU_MESA_HEADERS = [ FDirName $(HAIKU_MESA_DIR) include ] ;
@@ -49,6 +49,8 @@ UseHeaders [ FDirName $(HAIKU_MESA_DIR) src mesa tnl ] ;
UseHeaders [ FDirName $(HAIKU_MESA_DIR) src mesa x86 ] ;
Addon Mesa\ Software\ Renderer :
MesaSoftwareRenderer.cpp
: libGL.so be $(TARGET_LIBSUPC++)
MesaSoftwareRenderer.cpp :
libGL.so
be
$(TARGET_LIBSUPC++)
;
@@ -30,6 +30,7 @@ extern "C" {
#include "drivers/common/driverfuncs.h"
#include "drivers/common/meta.h"
#include "main/colormac.h"
#include "main/cpuinfo.h"
#include "main/buffers.h"
#include "main/formats.h"
#include "main/framebuffer.h"
@@ -600,60 +601,19 @@ MesaSoftwareRenderer::_Error(gl_context* ctx)
const GLubyte*
MesaSoftwareRenderer::_GetString(gl_context* ctx, GLenum name)
{
switch (name) {
case GL_VENDOR:
return (const GLubyte*) "Mesa Project";
case GL_RENDERER: {
_mesa_get_cpu_features();
static char buffer[256] = { '\0' };
if (!buffer[0]) {
char* cpuInfo = _mesa_get_cpu_string();
// Let's build an renderer string
strncat(buffer, "Software Rasterizer", sizeof(buffer));
// Append any CPU-specific information.
#ifdef USE_X86_ASM
if (_mesa_x86_cpu_features)
strncat(buffer, ", optimized for x86", sizeof(buffer));
#ifdef USE_MMX_ASM
if (cpu_has_mmx) {
strncat(buffer, (cpu_has_mmxext) ? "/MMX+" : "/MMX",
sizeof(buffer));
}
#endif
#ifdef USE_3DNOW_ASM
if (cpu_has_3dnow) {
strncat(buffer, (cpu_has_3dnowext) ? "/3DNow!+" : "/3DNow!",
sizeof(buffer));
}
#endif
#ifdef USE_SSE_ASM
if (cpu_has_xmm) {
strncat(buffer, (cpu_has_xmm2) ? "/SSE2" : "/SSE",
sizeof(buffer));
}
#endif
#elif defined(USE_SPARC_ASM)
strncat(buffer, ", optimized for SPARC", sizeof(buffer));
#elif defined(USE_PPC_ASM)
if (_mesa_ppc_cpu_features) {
strncat(buffer, (cpu_has_64) ? ", optimized for "
"PowerPC 64" : ", optimized for PowerPC",
sizeof(buffer));
}
#ifdef USE_VMX_ASM
if (cpu_has_vmx)
strncat(buffer, "/Altivec", sizeof(buffer));
#endif
if (! cpu_has_fpu)
strncat(buffer, "/No FPU", sizeof(buffer));
#endif
sprintf(buffer, "Software Rasterizer for %s", cpuInfo);
free(cpuInfo);
}
return (const GLubyte*) buffer;
}
-4
View File
@@ -67,10 +67,6 @@ extern "C" {
return (dispatch->func) args
#if __GNUC__ > 2
#include "glapitemp.h"
#endif
#endif /* USE_X86_ASM */
}
+5 -5
View File
@@ -32,7 +32,7 @@ UseHeaders [ FDirName $(HAIKU_MESA_DIR) src mapi glapi ] ;
UseHeaders [ FDirName $(HAIKU_MESA_DIR) src mesa glapi ] ;
LINKFLAGS on libGL.so = [ on libGL.so return $(LINKFLAGS) ]
-Xlinker --strip-debug -Xlinker --whole-archive -Xlinker -zmuldefs ;
-Xlinker --whole-archive -Xlinker --no-undefined -fvisibility=default ;
# For GCC2
if $(HAIKU_GCC_VERSION[1]) < 3 {
@@ -41,15 +41,15 @@ if $(HAIKU_GCC_VERSION[1]) < 3 {
SharedLibrary libGL.so : $(sources) :
# Glut
<opengl>glut.o
# Mesa libraries (from Mesa optional package):
$(HAIKU_MESA_LIBS)
# Glut
<opengl>glut.o
# External libraries:
be
game # BWindowScreen needed by BGLScreen stub class
network
be
$(TARGET_LIBSTDC++)
;