Bug 632148 - Port bug 630628 - Extract d3dx9_??.dll and d3dcompiler_??.dll from DirectX SDK at build time, and ship them with the build; r=Callek
authorMark Banner <bugzilla@standard8.plus.com>
Fri, 18 Mar 2011 13:53:38 +0000
changeset 7366 a5aaf273af00ce997c6f461cbc352a5a91a18082
parent 7365 e0a553b5ca12bab81fc316d38f551dbcad347ec6
child 7367 afd1d64f20a5dba6fe8a29e3c07710528fbb09f0
push idunknown
push userunknown
push dateunknown
reviewersCallek
bugs632148, 630628
Bug 632148 - Port bug 630628 - Extract d3dx9_??.dll and d3dcompiler_??.dll from DirectX SDK at build time, and ship them with the build; r=Callek
config/autoconf.mk.in
configure.in
mail/installer/Makefile.in
mail/installer/package-manifest.in
suite/installer/package-manifest.in
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -137,16 +137,24 @@ MOZ_FASTSTART = @MOZ_FASTSTART@
 MOZ_URL_CLASSIFIER = @MOZ_URL_CLASSIFIER@
 MOZ_ZIPWRITER = @MOZ_ZIPWRITER@
 MOZ_MORK = @MOZ_MORK@
 MOZ_MORKREADER = @MOZ_MORKREADER@
 MOZ_NO_FAST_LOAD = @MOZ_NO_FAST_LOAD@
 NS_PRINTING = @NS_PRINTING@
 MOZ_CRASHREPORTER = @MOZ_CRASHREPORTER@
 MOZ_HELP_VIEWER = @MOZ_HELP_VIEWER@
+MOZ_ANGLE = @MOZ_ANGLE@
+MOZ_DIRECTX_SDK_PATH = @MOZ_DIRECTX_SDK_PATH@
+MOZ_DIRECTX_SDK_CPU_SUFFIX = @MOZ_DIRECTX_SDK_CPU_SUFFIX@
+MOZ_D3DX9_VERSION = @MOZ_D3DX9_VERSION@
+MOZ_D3DX9_CAB = @MOZ_D3DX9_CAB@
+MOZ_D3DCOMPILER_CAB = @MOZ_D3DCOMPILER_CAB@
+MOZ_D3DX9_DLL = @MOZ_D3DX9_DLL@
+MOZ_D3DCOMPILER_DLL = @MOZ_D3DCOMPILER_DLL@
 
 TAR=@TAR@
 
 MAKENSISU=@MAKENSISU@
 
 RM = rm -f
 
 # The MOZ_UI_LOCALE var is used to build a particular locale. Do *not*
--- a/configure.in
+++ b/configure.in
@@ -5288,16 +5288,97 @@ dnl = Universalchardet
 dnl ========================================================
 MOZ_ARG_DISABLE_BOOL(universalchardet,
 [  --disable-universalchardet
                           Disable universal encoding detection],
   MOZ_UNIVERSALCHARDET=,
   MOZ_UNIVERSALCHARDET=1 )
 
 dnl ========================================================
+dnl = ANGLE OpenGL->D3D translator for WebGL
+dnl = * only applies to win32
+dnl = * enabled by default (shipping build); requires explicit --disable to disable
+dnl ========================================================
+MOZ_ANGLE=
+MOZ_DIRECTX_SDK_PATH=
+MOZ_DIRECTX_SDK_CPU_SUFFIX=
+MOZ_D3DX9_VERSION=
+MOZ_D3DX9_CAB=
+MOZ_D3DCOMPILER_CAB=
+MOZ_D3DX9_DLL=
+MOZ_D3DCOMPILER_DLL=
+case "$target_os" in
+    *msvc*|*mks*|*cygwin*|*mingw*)
+        MOZ_ANGLE=1
+        ;;
+esac
+
+# The DirectX SDK libraries are split into x86 and x64 sub-directories
+case "${target_cpu}" in
+i*86)
+  MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
+  ;;
+x86_64)
+  MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
+  # currently we disable ANGLE in 64bit builds
+  MOZ_ANGLE=
+  ;;
+esac
+
+if test -n "$MOZ_ANGLE"; then
+MOZ_ARG_DISABLE_BOOL(angle,
+[  --disable-angle     Disable building of ANGLE for WebGL->D3D translation],
+    MOZ_ANGLE=,
+    MOZ_ANGLE=1)
+
+if test -n "$MOZ_ANGLE"; then
+  if test -z "$_WIN32_MSVC"; then
+    AC_MSG_ERROR([Building ANGLE requires MSVC.  To build without ANGLE, reconfigure with --disable-angle.])
+  fi
+
+  # Get the SDK path from the registry.
+  MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
+  MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's,  *, ,g' | cut -d' ' -f4-`
+
+  MOZ_ANGLE=
+
+  if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
+    if test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h && test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
+      AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
+      MOZ_ANGLE=1
+    fi
+  fi
+
+  if test -z "$MOZ_ANGLE" ; then
+    AC_MSG_WARN([Couldn't find the DirectX SDK, needed for ANGLE. Please install it (February 2010 or newer). To explicitly build without ANGLE, reconfigure with --disable-angle.])
+    AC_MSG_WARN([This will become an error in the future.])
+  fi
+
+  if test -n "$MOZ_ANGLE" ; then
+    # Get the SDK numeric version (e.g. 42 or 43) by looking at the dependencies of d3dx9.lib
+    MOZ_D3DX9_VERSION=`dumpbin //headers "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/d3dx9.lib | egrep d3dx9_[[0-9]][[0-9]]\.dll | head -n1 | sed 's/.*\([[0-9]][[0-9]]\).*/\\1/g'`
+
+    if test -z "$MOZ_D3DX9_VERSION" ; then
+      MOZ_ANGLE=
+      AC_MSG_WARN([Couldn't determine the D3DX9 version! Disabling ANGLE.])
+      AC_MSG_WARN([This will become an error in the future.])
+    fi
+
+    if test -n "$MOZ_ANGLE" ; then
+      MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
+      MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
+
+      MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
+      MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
+    fi
+  fi
+fi
+fi
+
+dnl ========================================================
 dnl = Breakpad crash reporting (on by default on supported platforms)
 dnl ========================================================
 
 case $target in
 i?86-*-mingw*|x86_64-*-mingw*)
   MOZ_CRASHREPORTER=1
   ;;
 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
@@ -6855,16 +6936,24 @@ AC_SUBST(BUILD_STATIC_LIBS)
 AC_SUBST(MOZ_ENABLE_LIBXUL)
 AC_SUBST(ENABLE_TESTS)
 AC_SUBST(IBMBIDI)
 AC_SUBST(MOZ_UNIVERSALCHARDET)
 AC_SUBST(ACCESSIBILITY)
 AC_SUBST(MOZ_SPELLCHECK)
 AC_SUBST(MOZ_USER_DIR)
 AC_SUBST(MOZ_CRASHREPORTER)
+AC_SUBST(MOZ_ANGLE)
+AC_SUBST(MOZ_DIRECTX_SDK_PATH)
+AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
+AC_SUBST(MOZ_D3DX9_VERSION)
+AC_SUBST(MOZ_D3DX9_CAB)
+AC_SUBST(MOZ_D3DCOMPILER_CAB)
+AC_SUBST(MOZ_D3DX9_DLL)
+AC_SUBST(MOZ_D3DCOMPILER_DLL)
 
 AC_SUBST(ENABLE_STRIP)
 AC_SUBST(PKG_SKIP_STRIP)
 AC_SUBST(USE_ELF_DYNSTR_GC)
 AC_SUBST(INCREMENTAL_LINKER)
 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
 
--- a/mail/installer/Makefile.in
+++ b/mail/installer/Makefile.in
@@ -71,16 +71,22 @@ DEFINES += -D_MSC_VER=$(_MSC_VER)
 endif
 
 ifeq ($(MOZ_CHROME_FILE_FORMAT), jar)
 DEFINES += -DJAREXT=.jar
 else
 DEFINES += -DJAREXT=
 endif
 
+ifdef MOZ_ANGLE
+DEFINES += -DMOZ_ANGLE=$(MOZ_ANGLE)
+DEFINES += -DMOZ_D3DX9_DLL=$(MOZ_D3DX9_DLL)
+DEFINES += -DMOZ_D3DCOMPILER_DLL=$(MOZ_D3DCOMPILER_DLL)
+endif
+
 ifdef MOZ_UPDATER
 DEFINES += -DMOZ_UPDATER=1
 endif
 
 ifdef MOZ_IPC
 include $(MOZILLA_SRCDIR)/ipc/app/defs.mk
 DEFINES += -DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME)
 endif
--- a/mail/installer/package-manifest.in
+++ b/mail/installer/package-manifest.in
@@ -72,16 +72,23 @@
 #endif
 #ifdef MOZ_IPC
 #ifdef XP_MACOSX
 @BINPATH@/@MOZ_CHILD_PROCESS_NAME@.app/
 #else
 @BINPATH@/@MOZ_CHILD_PROCESS_NAME@
 #endif
 #endif
+; ANGLE GLES-on-D3D rendering library
+#ifdef MOZ_ANGLE
+@BINPATH@/libEGL.dll
+@BINPATH@/libGLESv2.dll
+@BINPATH@/@MOZ_D3DX9_DLL@
+@BINPATH@/@MOZ_D3DCOMPILER_DLL@
+#endif
 
 ; Modules
 @BINPATH@/modules/*
 
 ; Optional RSS extension
 [newsblog]
 @BINPATH@/chrome/newsblog@JAREXT@
 @BINPATH@/chrome/newsblog.manifest
--- a/suite/installer/package-manifest.in
+++ b/suite/installer/package-manifest.in
@@ -60,16 +60,23 @@
 #endif
 #ifdef MOZ_IPC
 #ifdef XP_MACOSX
 @BINPATH@/@MOZ_CHILD_PROCESS_NAME@.app/
 #else
 @BINPATH@/@MOZ_CHILD_PROCESS_NAME@
 #endif
 #endif
+; ANGLE GLES-on-D3D rendering library
+#ifdef MOZ_ANGLE
+@BINPATH@/libEGL.dll
+@BINPATH@/libGLESv2.dll
+@BINPATH@/@MOZ_D3DX9_DLL@
+@BINPATH@/@MOZ_D3DCOMPILER_DLL@
+#endif
 #ifdef WINCE
 @BINPATH@/mozce_shunt.dll
 #elifdef XP_WIN32
 #ifndef MOZ_MEMORY
 #if _MSC_VER == 1400
 @BINPATH@/Microsoft.VC80.CRT.manifest
 @BINPATH@/msvcm80.dll
 @BINPATH@/msvcp80.dll