From dc28a5021999d7fcf56816edad38fb2640fc08d4 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 27 Nov 2009 14:12:32 +0000 Subject: [PATCH] Hacked up mesa/x86/gen_matypes.c so it no longer generates a header file, but a file suitable for the CreateAsmStructOffsetsHeader rule. The file is then used to generate the actual matypes.h header. This fixes issues when cross-compiling from a 64 bit platform. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34312 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/libs/mesa/mesa/Jamfile | 37 +++++++++++++++++----------- src/libs/mesa/mesa/x86/gen_matypes.c | 37 ++++++++++++++++++++++++++-- 2 files changed, 58 insertions(+), 16 deletions(-) diff --git a/src/libs/mesa/mesa/Jamfile b/src/libs/mesa/mesa/Jamfile index 50716dfb07..23ddfe784f 100644 --- a/src/libs/mesa/mesa/Jamfile +++ b/src/libs/mesa/mesa/Jamfile @@ -41,12 +41,21 @@ UsePublicObjectHeaders gen_matypes : opengl ; BuildPlatformMain gen_matypes : gen_matypes.c ; -rule MkMaTypes +rule MkMaTypes header { - MakeLocateArch $(<) ; - Depends $(<) : gen_matypes ; - MkMaTypes1 $(<) : gen_matypes ; - LocalClean clean : $(<) ; + header = [ FGristFiles $(header) ] ; + + # generate the intermediate header + local intermediateHeader = $(header:S=.h.cpp) ; + MakeLocateArch $(intermediateHeader) ; + Depends $(intermediateHeader) : gen_matypes ; + MkMaTypes1 $(intermediateHeader) : gen_matypes ; + LocalClean clean : $(intermediateHeader) ; + + # generate the final header + TARGET_HDRS on $(header) = [ on $(header) return $(TARGET_HDRS) ] + $(TARGET_PRIVATE_SYSTEM_HEADERS) ; + CreateAsmStructOffsetsHeader $(header) : $(intermediateHeader) ; } actions MkMaTypes1 @@ -78,9 +87,9 @@ actions MkMaTypes1 local arch_sources ; if $(TARGET_ARCH) = x86 { - MkMaTypes matypes.h ; + MkMaTypes matypes.h ; - arch_sources = + arch_sources = common_x86.c common_x86_asm.S @@ -109,13 +118,13 @@ if $(TARGET_ARCH) = x86 { x86sse.c ; - Includes [ FGristFiles $(arch_sources) ] : matypes.h ; + Includes [ FGristFiles $(arch_sources) ] : [ FGristFiles matypes.h ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) x86 rtasm ] ; } else if $(TARGET_ARCH) = ppc { - arch_sources = + arch_sources = common_ppc.c ; @@ -123,10 +132,10 @@ if $(TARGET_ARCH) = x86 { } else if $(TARGET_ARCH) = sparc { - arch_sources = - sparc.c + arch_sources = + sparc.c clip.S - norm.S + norm.S xform.S ; @@ -135,7 +144,7 @@ if $(TARGET_ARCH) = x86 { } -StaticLibrary libmesa.a : +StaticLibrary libmesa.a : # main api_arrayelt.c @@ -273,7 +282,7 @@ StaticLibrary libmesa.a : # swrast_setup ss_context.c - ss_triangle.c + ss_triangle.c # shader arbprogparse.c diff --git a/src/libs/mesa/mesa/x86/gen_matypes.c b/src/libs/mesa/mesa/x86/gen_matypes.c index 8c690b4f88..4804abe2e9 100644 --- a/src/libs/mesa/mesa/x86/gen_matypes.c +++ b/src/libs/mesa/mesa/x86/gen_matypes.c @@ -61,7 +61,12 @@ do { \ printf( "\n" ); \ } while (0) -#if defined(__BEOS__) || defined(__HAIKU__) || defined(_LP64) +#if 1 +// Haiku build system: support for cross-compilation +#define OFFSET( s, t, m ) \ + printf( "#undef %s\n", s); \ + printf( "DEFINE_COMPUTED_ASM_MACRO(%s, offsetof(%s, %s));\n", s, #t, #m ); +#elif defined(__BEOS__) || defined(__HAIKU__) || defined(_LP64) #define OFFSET( s, t, m ) \ printf( "#define %s\t%ld\n", s, offsetof( t, m ) ); #else @@ -69,7 +74,12 @@ do { \ printf( "#define %s\t%d\n", s, offsetof( t, m ) ); #endif -#if defined(__BEOS__) || defined(__HAIKU__) || defined(_LP64) +#if 1 +// Haiku build system: support for cross-compilation +#define SIZEOF( s, t ) \ + printf( "#undef %s\n", s); \ + printf( "DEFINE_COMPUTED_ASM_MACRO(%s, sizeof(%s));\n", s, #t ); +#elif defined(__BEOS__) || defined(__HAIKU__) || defined(_LP64) #define SIZEOF( s, t ) \ printf( "#define %s\t%ld\n", s, sizeof(t) ); #else @@ -77,8 +87,16 @@ do { \ printf( "#define %s\t%d\n", s, sizeof(t) ); #endif +#if 1 +// Haiku build system: support for cross-compilation +#define DEFINE( s, d ) \ + printf( "#undef %s\n", s); \ + printf( "#define %s\t0x%x\n", s, d ); \ + printf( "DEFINE_COMPUTED_ASM_MACRO(%s, %#x);\n", s, d ); +#else #define DEFINE( s, d ) \ printf( "#define %s\t0x%x\n", s, d ); +#endif @@ -93,6 +111,16 @@ int main( int argc, char **argv ) printf( "#define __ASM_TYPES_H__\n" ); printf( "\n" ); + #if 1 + // Haiku build system: support for cross-compilation + printf("#include "); + printf( "\n" ); + printf( "#include \"main/glheader.h\"\n" ); + printf( "#include \"main/mtypes.h\"\n" ); + printf( "#include \"tnl/t_context.h\"" ); + printf( "\n" ); + printf( "void dummy() {\n" ); + #endif /* GLcontext offsets: */ @@ -239,6 +267,11 @@ int main( int argc, char **argv ) OFFSET( "LIGHT_MODEL_TWO_SIDE ", struct gl_lightmodel, TwoSide ); OFFSET( "LIGHT_MODEL_COLOR_CONTROL ", struct gl_lightmodel, ColorControl ); + #if 1 + // Haiku build system: support for cross-compilation + printf("}"); + printf( "\n" ); + #endif printf( "\n" ); printf( "\n" );