Bug 787653 - Allow compiling ANGLE on mingw-w64 (makefile part) r=bjacob,ted
authorJacek Caban <jacek@codeweavers.com>
Wed, 19 Sep 2012 10:58:31 +0200
changeset 107577 6eed25d2f2c959097c1e31d0b727c27b9b311f27
parent 107576 650b2238e845455d9642d8bc2c0cce93a20caba9
child 107578 ef528ae38f048cb638a6f8c51eb9b795e11b588c
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersbjacob, ted
bugs787653
milestone18.0a1
Bug 787653 - Allow compiling ANGLE on mingw-w64 (makefile part) r=bjacob,ted
configure.in
gfx/angle/Makefile.in
gfx/angle/angle-stdcall-alias.patch
gfx/angle/src/libEGL/Makefile.in
gfx/angle/src/libGLESv2/Makefile.in
gfx/angle/src/libGLESv2/libGLESv2.def
--- a/configure.in
+++ b/configure.in
@@ -2278,16 +2278,17 @@ ia64*-hpux*)
 
         if test $_MSC_VER -ge 1400; then
             LDFLAGS="$LDFLAGS -SAFESEH"
         fi
 
         if test -n "$GNU_CC"; then
             CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
             CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
+            LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup"
         else
             AC_DEFINE(HAVE_STDCALL)
             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
         fi
 
         MOZ_CHECK_HEADERS(mmintrin.h)
     	AC_DEFINE(_X86_)
 	;;
@@ -5720,17 +5721,17 @@ MOZ_ARG_DISABLE_BOOL(webgl,
     MOZ_WEBGL_DISABLED=1,
     MOZ_WEBGL_DISABLED=)
 
 if test -n "$MOZ_WEBGL_DISABLED"; then
   MOZ_WEBGL=
   MOZ_ANGLE_RENDERER=
 fi
 
-if test -n "$MOZ_ANGLE_RENDERER"; then
+if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
   # Get the SDK path from the registry.
   # First try to get the June 2010 SDK
   MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
   if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
     # Otherwise just take whatever comes first
     MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
   fi
 
--- a/gfx/angle/Makefile.in
+++ b/gfx/angle/Makefile.in
@@ -119,18 +119,22 @@ DEFINES += -DANGLE_COMPILE_OPTIMIZATION_
 DEFINES += -DANGLE_USE_NEW_PREPROCESSOR=1
 
 ifdef MOZ_ANGLE_RENDERER
 
 # libEGL depends on (links against!) libGLESv2!
 DIRS = src/libGLESv2 src/libEGL
 
 libs::
+ifdef MOZ_D3DX9_CAB
 	expand "$(MOZ_D3DX9_CAB)" -F:$(MOZ_D3DX9_DLL) "$(DIST)/bin"
+endif
+ifdef MOZ_D3DCOMPILER_CAB
 	expand "$(MOZ_D3DCOMPILER_CAB)" -F:$(MOZ_D3DCOMPILER_DLL) "$(DIST)/bin"
+endif
 
 endif
 
 include $(topsrcdir)/config/rules.mk
 
 # We have to filter out -pedantic, because of
 # comma-at-end-of-enumerator list failures.  We can try to get this fixed
 # upstream at some point.
new file mode 100644
--- /dev/null
+++ b/gfx/angle/angle-stdcall-alias.patch
@@ -0,0 +1,13 @@
+diff --git a/gfx/angle/src/libGLESv2/libGLESv2.def b/gfx/angle/src/libGLESv2/libGLESv2.def
+index 5f935c3..2324dcb 100644
+--- a/gfx/angle/src/libGLESv2/libGLESv2.def
++++ b/gfx/angle/src/libGLESv2/libGLESv2.def
+@@ -180,3 +180,8 @@ EXPORTS
+     glGetCurrentContext             @147 NONAME
+     glGetProcAddress                @148 NONAME
+     glBindTexImage                  @158 NONAME
++
++    ; GCC has problems with linking to undecored stdcall functions,
++    ; so we explicitly add aliases for APIs used by EGL
++    glGetProcAddress@4=glGetProcAddress
++    glBindTexImage@4=glBindTexImage
--- a/gfx/angle/src/libEGL/Makefile.in
+++ b/gfx/angle/src/libEGL/Makefile.in
@@ -63,14 +63,24 @@ CPPSRCS = \
   Surface.cpp \
   $(NULL)
 
 DEFFILE = $(srcdir)/libEGL.def
 RCFILE = $(srcdir)/libEGL.rc
 
 include $(topsrcdir)/config/rules.mk
 
+OS_LIBS += $(call EXPAND_LIBNAME,dwmapi)
+
+ifdef GNU_CC
+
+OS_CXXFLAGS := $(filter-out -fno-exceptions,$(OS_CXXFLAGS)) -fexceptions
+OS_LIBS += -ld3d9 -ldxguid -llibGLESv2
+
+else
+
 EXTRA_DSO_LDOPTS = "$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3d9.lib" \
                    "$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/dxguid.lib" \
 		   "$(DIST)/lib/libGLESv2.lib" \
-		   dwmapi.lib \
 		   delayimp.lib \
 		   /delayload:dwmapi.dll
+
+endif
--- a/gfx/angle/src/libGLESv2/Makefile.in
+++ b/gfx/angle/src/libGLESv2/Makefile.in
@@ -160,11 +160,27 @@ CPPSRCS += \
         VertexDataManager.cpp \
         $(NULL)
 
 DEFFILE = $(srcdir)/libGLESv2.def
 RCFILE = $(srcdir)/libGLESv2.rc
 
 include $(topsrcdir)/config/rules.mk
 
+ifdef GNU_CC
+
+TextureSSE2.$(OBJ_SUFFIX): CXXFLAGS+=-msse2
+
+OS_CXXFLAGS := $(filter-out -fno-exceptions,$(OS_CXXFLAGS)) -fexceptions
+OS_LIBS += -ld3d9
+ifdef MOZ_D3DX9_VERSION
+OS_LIBS += -ld3dx9_$(MOZ_D3DX9_VERSION) -ld3dcompiler_$(MOZ_D3DX9_VERSION)
+else
+OS_LIBS += -ld3dx9 -ld3dcompiler
+endif
+
+else
+
 EXTRA_DSO_LDOPTS = "$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3d9.lib" \
                    "$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3dx9.lib" \
                    "$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/D3DCompiler.lib"
+
+endif
--- a/gfx/angle/src/libGLESv2/libGLESv2.def
+++ b/gfx/angle/src/libGLESv2/libGLESv2.def
@@ -175,8 +175,13 @@ EXPORTS
 
     ; EGL dependencies
     glCreateContext                 @144 NONAME
     glDestroyContext                @145 NONAME
     glMakeCurrent                   @146 NONAME
     glGetCurrentContext             @147 NONAME
     glGetProcAddress                @148 NONAME
     glBindTexImage                  @158 NONAME
+
+    ; GCC has problems with linking to undecored stdcall functions,
+    ; so we explicitly add aliases for APIs used by EGL
+    glGetProcAddress@4=glGetProcAddress
+    glBindTexImage@4=glBindTexImage