Bug 757637: Rollup makesystem changes for webrtc r=khuey r=ted f=glandium
authorRandell Jesup <rjesup@jesup.org>
Wed, 20 Jun 2012 07:27:43 -0400
changeset 97254 a9aeaa818e646ffa4b0a60af38a390cf8bc18ecb
parent 97253 d622728e847af643b4974f164aa03f4631a8d262
child 97255 6e9af4a9bc38f51e6a2db73686d59b7c1cf9141d
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerskhuey, ted
bugs757637
milestone16.0a1
Bug 757637: Rollup makesystem changes for webrtc r=khuey r=ted f=glandium
build/unix/stdc++compat/stdc++compat.cpp
config/autoconf.mk.in
config/rules.mk
config/system-headers
configure.in
js/src/config/rules.mk
js/src/config/system-headers
layout/media/Makefile.in
layout/media/symbols.def.in
media/webrtc/Makefile.in
media/webrtc/shared_libs.mk
media/webrtc/trunk/src/build/common.gypi
media/webrtc/trunk/src/build/getsdksamplesdir.py
media/webrtc/trunk/tools/gyp/pylib/gyp/generator/make.py
media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py
parser/expat/expat_config.h
toolkit/library/Makefile.in
toolkit/toolkit-makefiles.sh
toolkit/toolkit-tiers.mk
--- a/build/unix/stdc++compat/stdc++compat.cpp
+++ b/build/unix/stdc++compat/stdc++compat.cpp
@@ -21,32 +21,37 @@
 namespace std {
 #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 9)
     /* Instantiate these templates to avoid GLIBCXX_3.4.9 symbol versions */
     template ostream& ostream::_M_insert(double);
     template ostream& ostream::_M_insert(long);
     template ostream& ostream::_M_insert(unsigned long);
     template ostream& ostream::_M_insert(long long);
     template ostream& ostream::_M_insert(unsigned long long);
+    template ostream& ostream::_M_insert(bool);
     template ostream& ostream::_M_insert(const void*);
     template ostream& __ostream_insert(ostream&, const char*, streamsize);
     template istream& istream::_M_extract(double&);
+    template istream& istream::_M_extract(float&);
+    template istream& istream::_M_extract(unsigned int&);
+    template istream& istream::_M_extract(unsigned long&);
 #endif
 #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14)
     /* Instantiate these templates to avoid GLIBCXX_3.4.14 symbol versions
      * depending on optimization level */
     template char *string::_S_construct_aux_2(size_type, char, allocator<char> const&);
 #ifdef _GLIBCXX_USE_WCHAR_T
     template wchar_t *wstring::_S_construct_aux_2(size_type, wchar_t, allocator<wchar_t> const&);
 #endif /* _GLIBCXX_USE_WCHAR_T */
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
     template string::basic_string(string&&);
     template string& string::operator=(string&&);
     template wstring::basic_string(wstring&&);
     template wstring& wstring::operator=(wstring&&);
+    template string& string::assign(string&&);
     template wstring& wstring::assign(wstring&&);
 #endif /* __GXX_EXPERIMENTAL_CXX0X__ */
 #endif /* (__GNUC__ == 4) && (__GNUC_MINOR__ >= 5) */
 }
 
 namespace std __attribute__((visibility("default"))) {
 #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14)
     /* Hack to avoid GLIBCXX_3.4.14 symbol versions */
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -132,16 +132,17 @@ MOZ_MEDIA = @MOZ_MEDIA@
 MOZ_VORBIS = @MOZ_VORBIS@
 MOZ_TREMOR = @MOZ_TREMOR@
 MOZ_NO_THEORA_ASM = @MOZ_NO_THEORA_ASM@
 MOZ_OPUS = @MOZ_OPUS@
 MOZ_WEBM = @MOZ_WEBM@
 MOZ_MEDIA_PLUGINS = @MOZ_MEDIA_PLUGINS@
 MOZ_OMX_PLUGIN = @MOZ_OMX_PLUGIN@
 MOZ_GSTREAMER = @MOZ_GSTREAMER@
+MOZ_VP8 = @MOZ_VP8@
 MOZ_VP8_ERROR_CONCEALMENT = @MOZ_VP8_ERROR_CONCEALMENT@
 MOZ_VP8_ENCODER = @MOZ_VP8_ENCODER@
 VPX_AS = @VPX_AS@
 VPX_ASFLAGS = @VPX_ASFLAGS@
 VPX_DASH_C_FLAG = @VPX_DASH_C_FLAG@
 VPX_AS_CONVERSION = @VPX_AS_CONVERSION@
 VPX_ASM_SUFFIX = @VPX_ASM_SUFFIX@
 VPX_X86_ASM = @VPX_X86_ASM@
@@ -165,16 +166,17 @@ MOZ_DIRECTX_SDK_PATH = @MOZ_DIRECTX_SDK_
 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@
 MOZ_GL_PROVIDER = @MOZ_GL_PROVIDER@
 MOZ_GL_DEFAULT_PROVIDER = @MOZ_GL_DEFAULT_PROVIDER@
+MOZ_WEBRTC = @MOZ_WEBRTC@
 
 
 JAVA=@JAVA@
 JAVAC=@JAVAC@
 JAR=@JAR@
 
 TAR=@TAR@
 
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -628,17 +628,20 @@ include $(topsrcdir)/config/makefiles/ta
 
 ifneq (,$(filter-out %.$(LIB_SUFFIX),$(SHARED_LIBRARY_LIBS)))
 $(error SHARED_LIBRARY_LIBS must contain .$(LIB_SUFFIX) files only)
 endif
 
 HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX),$(HOST_LIBS))
 
 # Dependencies which, if modified, should cause everything to rebuild
-GLOBAL_DEPS += Makefile Makefile.in $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk
+GLOBAL_DEPS += Makefile $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk
+ifndef NO_MAKEFILE_RULE
+GLOBAL_DEPS += Makefile.in
+endif
 
 ##############################################
 include $(topsrcdir)/config/makefiles/target_libs.mk
 
 ##############################################
 ifndef NO_PROFILE_GUIDED_OPTIMIZE
 ifdef MOZ_PROFILE_USE
 ifeq ($(OS_ARCH)_$(GNU_CC), WINNT_)
@@ -1142,26 +1145,30 @@ endif
 	$(JAR) cf $@ -C $(_JAVA_DIR) .
 
 GARBAGE_DIRS += $(_JAVA_DIR)
 
 ###############################################################################
 # Update Makefiles
 ###############################################################################
 
+ifndef NO_MAKEFILE_RULE
 # Note: Passing depth to make-makefile is optional.
 #       It saves the script some work, though.
 Makefile: Makefile.in
 	@$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH)
+endif
 
+ifndef NO_SUBMAKEFILES_RULE
 ifdef SUBMAKEFILES
 # VPATH does not work on some machines in this case, so add $(srcdir)
 $(SUBMAKEFILES): % : $(srcdir)/%.in
 	$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $@
 endif
+endif
 
 ifdef AUTOUPDATE_CONFIGURE
 $(topsrcdir)/configure: $(topsrcdir)/configure.in
 	(cd $(topsrcdir) && $(AUTOCONF)) && (cd $(DEPTH) && ./config.status --recheck)
 endif
 
 $(DEPTH)/config/autoconf.mk: $(topsrcdir)/config/autoconf.mk.in
 	cd $(DEPTH) && CONFIG_HEADERS= CONFIG_FILES=config/autoconf.mk ./config.status
--- a/config/system-headers
+++ b/config/system-headers
@@ -1054,8 +1054,10 @@ ogg/ogg.h
 ogg/os_types.h
 nestegg/nestegg.h
 cubeb/cubeb.h
 #endif
 gst/gst.h
 gst/app/gstappsink.h
 gst/app/gstappsrc.h
 gst/video/video.h
+sys/msg.h
+sys/ipc.h
--- a/configure.in
+++ b/configure.in
@@ -517,28 +517,32 @@ case "$target" in
             dnl Require VC8SP1 or newer.
             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
             if test "$_CC_RELEASE" -lt 50727 -o \
                     \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
               AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. You probably need to install Service Pack 1 of Visual Studio 2005. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
             fi
 
             _CC_SUITE=8
+            _MSVS_VERSION=2005
             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
         elif test "$_CC_MAJOR_VERSION" = "15"; then
             _CC_SUITE=9
+            _MSVS_VERSION=2008
             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
         elif test "$_CC_MAJOR_VERSION" = "16"; then
             _CC_SUITE=10
+            _MSVS_VERSION=2010
             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
         elif test "$_CC_MAJOR_VERSION" = "17"; then
             _CC_SUITE=11
+            _MSVS_VERSION=2011
             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
         else
             AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
         fi
 
         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
 
@@ -4245,19 +4249,22 @@ MOZ_SYDNEYAUDIO=
 MOZ_SPEEX_RESAMPLER=1
 MOZ_CUBEB=
 MOZ_VORBIS=
 MOZ_TREMOR=
 MOZ_WAVE=1
 MOZ_MEDIA=
 MOZ_OPUS=1
 MOZ_WEBM=1
+MOZ_WEBRTC=
+MOZ_WEBRTC_SIGNALING=
 MOZ_MEDIA_PLUGINS=
 MOZ_MEDIA_NAVIGATOR=
 MOZ_OMX_PLUGIN=
+MOZ_VP8=
 MOZ_VP8_ERROR_CONCEALMENT=
 MOZ_VP8_ENCODER=
 VPX_AS=
 VPX_ASFLAGS=
 VPX_AS_DASH_C_FLAG=
 VPX_AS_CONVERSION=
 VPX_ASM_SUFFIX=
 VPX_X86_ASM=
@@ -5267,16 +5274,35 @@ MOZ_ARG_DISABLE_BOOL(printing,
     NS_PRINTING=1)
 
 if test "$NS_PRINTING"; then
     AC_DEFINE(NS_PRINTING)
     AC_DEFINE(NS_PRINT_PREVIEW)
 fi
 
 dnl ========================================================
+dnl = Enable WebRTC code
+dnl ========================================================
+MOZ_ARG_ENABLE_BOOL(webrtc,
+[  --enable-webrtc        Enable support for WebRTC],
+    MOZ_WEBRTC=1,
+    MOZ_WEBRTC=)
+
+if test -n "$MOZ_WEBRTC"; then
+    AC_DEFINE(MOZ_WEBRTC)
+    MOZ_MEDIA=1
+    MOZ_RAW=1
+    MOZ_VP8=1
+    MOZ_VP8_ENCODER=1
+    MOZ_VP8_ERROR_CONCEALMENT=1
+fi
+
+AC_SUBST(MOZ_WEBRTC)
+
+dnl ========================================================
 dnl = Enable Raw Codecs
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(raw,
 [  --enable-raw           Enable support for RAW media],
     MOZ_RAW=1,
     MOZ_RAW=)
 
 if test -n "$MOZ_RAW"; then
@@ -5341,16 +5367,21 @@ MOZ_ARG_DISABLE_BOOL(opus,
 dnl ========================================================
 dnl = Disable VP8 decoder support
 dnl ========================================================
 MOZ_ARG_DISABLE_BOOL(webm,
 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
     MOZ_WEBM=,
     MOZ_WEBM=1)
 
+if test -n "$MOZ_WEBM"; then
+    AC_DEFINE(MOZ_WEBM)
+    MOZ_VP8=1
+fi;
+
 dnl ========================================================
 dnl = Disable media plugin support
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(media-plugins,
 [  --enable-media-plugins  Enable support for media plugins],
     MOZ_MEDIA_PLUGINS=1,
     MOZ_MEDIA_PLUGINS=)
 
@@ -5392,18 +5423,18 @@ dnl system libvpx Support
 dnl ========================================================
 MOZ_ARG_WITH_BOOL(system-libvpx,
 [  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
     MOZ_NATIVE_LIBVPX=1)
 
 MOZ_LIBVPX_INCLUDES=
 MOZ_LIBVPX_LIBS=
 
-if test -n "$MOZ_WEBM"; then
-    AC_DEFINE(MOZ_WEBM)
+if test -n "$MOZ_VP8"; then
+    AC_DEFINE(MOZ_VP8)
     if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
         AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
     fi
     if test -n "$MOZ_VP8_ENCODER" ; then
         AC_DEFINE(MOZ_VP8_ENCODER)
     fi
 
     if test -n "$MOZ_NATIVE_LIBVPX"; then
@@ -5420,29 +5451,31 @@ if test -n "$MOZ_WEBM"; then
          [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
     fi
 fi
 
 AC_SUBST(MOZ_NATIVE_LIBVPX)
 AC_SUBST(MOZ_LIBVPX_INCLUDES)
 AC_SUBST(MOZ_LIBVPX_LIBS)
 
-if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
+if test "$MOZ_WEBM"; then
     MOZ_SYDNEYAUDIO=1
     MOZ_CUBEB=1
     MOZ_MEDIA=1
     case "$target_cpu" in
     arm*)
         MOZ_TREMOR=1
     ;;
     *)
         MOZ_VORBIS=1
     ;;
     esac
-
+fi
+
+if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
 
     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
     dnl We currently require gcc on all arm platforms.
     VPX_AS=$YASM
     VPX_ASM_SUFFIX=asm
     VPX_NEED_OBJ_INT_EXTRACT=
 
@@ -8583,16 +8616,17 @@ AC_SUBST(MOZ_WAVE)
 AC_SUBST(MOZ_VORBIS)
 AC_SUBST(MOZ_TREMOR)
 AC_SUBST(MOZ_OPUS)
 AC_SUBST(MOZ_WEBM)
 AC_SUBST(MOZ_MEDIA_PLUGINS)
 AC_SUBST(MOZ_OMX_PLUGIN)
 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
 AC_SUBST(MOZ_VP8_ENCODER)
+AC_SUBST(MOZ_VP8)
 AC_SUBST(MOZ_OGG)
 AC_SUBST(MOZ_ALSA_LIBS)
 AC_SUBST(MOZ_ALSA_CFLAGS)
 AC_SUBST(VPX_AS)
 AC_SUBST(VPX_ASFLAGS)
 AC_SUBST(VPX_DASH_C_FLAG)
 AC_SUBST(VPX_AS_CONVERSION)
 AC_SUBST(VPX_ASM_SUFFIX)
@@ -8860,16 +8894,62 @@ fi
 rm conftest.sh
 
 echo $MAKEFILES > unallmakefiles
 
 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
 
 AC_OUTPUT($MAKEFILES)
 
+# Generate Makefiles for WebRTC directly from .gyp files
+if test "${OS_TARGET}" = "WINNT"; then
+   if test "$HAVE_64BIT_OS"; then
+      OS_BITS=64
+   else
+      OS_BITS=32
+   fi
+   EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
+fi
+
+if test -n "$MOZ_WEBRTC"; then
+   AC_MSG_RESULT("generating WebRTC Makefiles...")
+
+   GYP_WEBRTC_OPTIONS="--format=mozmake -D build_with_mozilla=1 -D enable_protobuf=0 -D include_internal_video_render=0 ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
+
+   $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
+     $GYP_WEBRTC_OPTIONS \
+     --generator-output=${_objdir}/media/webrtc/trunk \
+     ${srcdir}/media/webrtc/trunk/peerconnection.gyp
+   if test "$?" != 0; then
+      AC_MSG_ERROR([failed to generate WebRTC Makefiles])
+   fi
+
+   # XXX disable until we land the tranche with signaling
+   if test -n "$MOZ_WEBRTC_SIGNALING"; then
+     AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
+     $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
+       $GYP_WEBRTC_OPTIONS \
+       --generator-output=${_objdir}/media/webrtc/signaling \
+       ${srcdir}/media/webrtc/signaling/signaling.gyp
+     if test "$?" != 0; then
+        AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
+     fi
+   fi
+
+   AC_MSG_RESULT("generating gtest Makefiles...")
+   # Ok to pass some extra -D's that are ignored here
+   $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
+     $GYP_WEBRTC_OPTIONS \
+     --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
+     ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
+   if test "$?" != 0; then
+      AC_MSG_ERROR([failed to generate gtest Makefiles])
+   fi
+fi
+
 # Populate the virtualenv
 AC_MSG_RESULT([Populating Python virtualenv])
 $MAKE -C build/virtualenv MACOSX_DEPLOYMENT_TARGET=  || exit 1
 
 # Generate a JSON config file for unittest harnesses etc to read
 # build configuration details from in a standardized way.
 OS_TARGET=${OS_TARGET} TARGET_CPU=${TARGET_CPU} MOZ_DEBUG=${MOZ_DEBUG} \
 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -628,17 +628,20 @@ include $(topsrcdir)/config/makefiles/ta
 
 ifneq (,$(filter-out %.$(LIB_SUFFIX),$(SHARED_LIBRARY_LIBS)))
 $(error SHARED_LIBRARY_LIBS must contain .$(LIB_SUFFIX) files only)
 endif
 
 HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX),$(HOST_LIBS))
 
 # Dependencies which, if modified, should cause everything to rebuild
-GLOBAL_DEPS += Makefile Makefile.in $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk
+GLOBAL_DEPS += Makefile $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk
+ifndef NO_MAKEFILE_RULE
+GLOBAL_DEPS += Makefile.in
+endif
 
 ##############################################
 include $(topsrcdir)/config/makefiles/target_libs.mk
 
 ##############################################
 ifndef NO_PROFILE_GUIDED_OPTIMIZE
 ifdef MOZ_PROFILE_USE
 ifeq ($(OS_ARCH)_$(GNU_CC), WINNT_)
@@ -1142,26 +1145,30 @@ endif
 	$(JAR) cf $@ -C $(_JAVA_DIR) .
 
 GARBAGE_DIRS += $(_JAVA_DIR)
 
 ###############################################################################
 # Update Makefiles
 ###############################################################################
 
+ifndef NO_MAKEFILE_RULE
 # Note: Passing depth to make-makefile is optional.
 #       It saves the script some work, though.
 Makefile: Makefile.in
 	@$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH)
+endif
 
+ifndef NO_SUBMAKEFILES_RULE
 ifdef SUBMAKEFILES
 # VPATH does not work on some machines in this case, so add $(srcdir)
 $(SUBMAKEFILES): % : $(srcdir)/%.in
 	$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $@
 endif
+endif
 
 ifdef AUTOUPDATE_CONFIGURE
 $(topsrcdir)/configure: $(topsrcdir)/configure.in
 	(cd $(topsrcdir) && $(AUTOCONF)) && (cd $(DEPTH) && ./config.status --recheck)
 endif
 
 $(DEPTH)/config/autoconf.mk: $(topsrcdir)/config/autoconf.mk.in
 	cd $(DEPTH) && CONFIG_HEADERS= CONFIG_FILES=config/autoconf.mk ./config.status
--- a/js/src/config/system-headers
+++ b/js/src/config/system-headers
@@ -1054,8 +1054,10 @@ ogg/ogg.h
 ogg/os_types.h
 nestegg/nestegg.h
 cubeb/cubeb.h
 #endif
 gst/gst.h
 gst/app/gstappsink.h
 gst/app/gstappsrc.h
 gst/video/video.h
+sys/msg.h
+sys/ipc.h
--- a/layout/media/Makefile.in
+++ b/layout/media/Makefile.in
@@ -60,18 +60,23 @@ SHARED_LIBRARY_LIBS += \
   $(DEPTH)/media/libopus/$(LIB_PREFIX)opus.$(LIB_SUFFIX) \
   $(NULL)
 endif
 
 ifdef MOZ_WEBM
 SHARED_LIBRARY_LIBS 	+= \
 	$(DEPTH)/media/libnestegg/src/$(LIB_PREFIX)nestegg.$(LIB_SUFFIX) \
 	$(NULL)
+endif
+
+ifdef MOZ_VP8
 ifndef MOZ_NATIVE_LIBVPX
-SHARED_LIBRARY_LIBS 	+= $(DEPTH)/media/libvpx/$(LIB_PREFIX)vpx.$(LIB_SUFFIX)
+SHARED_LIBRARY_LIBS 	+= \
+	$(DEPTH)/media/libvpx/$(LIB_PREFIX)vpx.$(LIB_SUFFIX) \
+	$(NULL)
 endif
 endif
 
 ifdef MOZ_SYDNEYAUDIO
 SHARED_LIBRARY_LIBS 	+= \
 	$(DEPTH)/media/libsydneyaudio/src/$(LIB_PREFIX)sydneyaudio.$(LIB_SUFFIX) \
 	$(NULL)
 endif
@@ -103,28 +108,39 @@ endif
 SHARED_LIBRARY_LIBS 	+= \
 	$(DEPTH)/gfx/angle/$(LIB_PREFIX)angle.$(LIB_SUFFIX) \
 	$(DEPTH)/parser/expat/lib/$(LIB_PREFIX)mozexpat_s.$(LIB_SUFFIX) \
 	$(NULL)
 
 SHARED_LIBRARY_LIBS 	+= \
 	$(DEPTH)/gfx/2d/$(LIB_PREFIX)gfx2d.$(LIB_SUFFIX) \
 	$(NULL)
-  
+
+ifdef MOZ_WEBRTC
+include $(topsrcdir)/media/webrtc/shared_libs.mk
+endif
+
 ifdef MOZ_ENABLE_SKIA
 SHARED_LIBRARY_LIBS += $(MOZ_SKIA_LIBS)
 endif
 
 ifeq (WINNT,$(OS_TARGET))
 EXTRA_DSO_LDOPTS = $(MOZALLOC_LIB) $(NSPR_LIBS)
 OS_LIBS += $(call EXPAND_LIBNAME,usp10 ole32)
 
 # OTS uses uncompress2() from libz, so we need to link with this
 EXTRA_DSO_LDOPTS += $(MOZ_ZLIB_LIBS)
 
+ifdef MOZ_WEBRTC
+EXTRA_DSO_LDOPTS += \
+  -LIBPATH:"$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)" \
+  $(NULL)
+OS_LIBS += $(call EXPAND_LIBNAME,secur32 crypt32 iphlpapi strmiids dmoguids wmcodecdspuuid amstrmid msdmo wininet)
+endif
+
 DEFFILE = symbols.def
 endif
 
 include $(topsrcdir)/config/rules.mk
 
 ifeq (WINNT,$(OS_TARGET))
 symbols.def: symbols.def.in
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(ACDEFINES) $< > $@
--- a/layout/media/symbols.def.in
+++ b/layout/media/symbols.def.in
@@ -138,16 +138,31 @@ opus_packet_get_samples_per_frame
 ShInitialize
 ShFinalize
 ShGetObjectCode
 ShDestruct
 ShGetInfoLog
 ShCompile
 ShGetInfo
 ShConstructCompiler
+#ifdef MOZ_WEBRTC
+#ifdef HAVE_64BIT_OS
+?GetInterface@ViERender@webrtc@@SAPEAV12@PEAVVideoEngine@2@@Z
+?GetInterface@ViECapture@webrtc@@SAPEAV12@PEAVVideoEngine@2@@Z
+?GetInterface@ViEBase@webrtc@@SAPEAV12@PEAVVideoEngine@2@@Z
+?Create@VideoEngine@webrtc@@SAPEAV12@XZ
+?Delete@VideoEngine@webrtc@@SA_NAEAPEAV12@@Z
+#else
+?GetInterface@ViERender@webrtc@@SAPAV12@PAVVideoEngine@2@@Z
+?GetInterface@ViECapture@webrtc@@SAPAV12@PAVVideoEngine@2@@Z
+?GetInterface@ViEBase@webrtc@@SAPAV12@PAVVideoEngine@2@@Z
+?Create@VideoEngine@webrtc@@SAPAV12@XZ
+?Delete@VideoEngine@webrtc@@SA_NAAPAV12@@Z
+#endif
+#endif
 ShGetActiveAttrib
 ShGetActiveUniform
 #ifndef MOZ_NATIVE_PNG
 MOZ_APNG_get_first_frame_is_hidden
 MOZ_APNG_get_next_frame_blend_op
 MOZ_APNG_get_next_frame_delay_den
 MOZ_APNG_get_next_frame_delay_num
 MOZ_APNG_get_next_frame_dispose_op
new file mode 100644
--- /dev/null
+++ b/media/webrtc/Makefile.in
@@ -0,0 +1,19 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DEPTH		= ../..
+topsrcdir	= @top_srcdir@
+srcdir          = @srcdir@
+VPATH           = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+DIRS = \
+  trunk \
+  trunk/testing \
+  $(NULL)
+
+# These Makefiles don't have corresponding Makefile.ins
+NO_SUBMAKEFILES_RULE = 1
+include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/media/webrtc/shared_libs.mk
@@ -0,0 +1,58 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# shared libs for webrtc
+SHARED_LIBRARY_LIBS += \
+  $(call EXPAND_LIBNAME_PATH,jingle,$(DEPTH)/media/webrtc/trunk/third_party/libjingle/libjingle_libjingle) \
+  $(call EXPAND_LIBNAME_PATH,srtp,$(DEPTH)/media/webrtc/trunk/third_party/libsrtp/libsrtp_libsrtp) \
+  $(call EXPAND_LIBNAME_PATH,jingle_p2p,$(DEPTH)/media/webrtc/trunk/third_party/libjingle/libjingle_libjingle_p2p) \
+  $(call EXPAND_LIBNAME_PATH,jingle_app,$(DEPTH)/media/webrtc/trunk/third_party/libjingle/libjingle_libjingle_app) \
+  $(call EXPAND_LIBNAME_PATH,jsoncpp,$(DEPTH)/media/webrtc/trunk/third_party/jsoncpp/jsoncpp_jsoncpp) \
+  $(call EXPAND_LIBNAME_PATH,video_capture_module,$(DEPTH)/media/webrtc/trunk/src/modules/modules_video_capture_module) \
+  $(call EXPAND_LIBNAME_PATH,webrtc_utility,$(DEPTH)/media/webrtc/trunk/src/modules/modules_webrtc_utility) \
+  $(call EXPAND_LIBNAME_PATH,audio_coding_module,$(DEPTH)/media/webrtc/trunk/src/modules/modules_audio_coding_module) \
+  $(call EXPAND_LIBNAME_PATH,CNG,$(DEPTH)/media/webrtc/trunk/src/modules/modules_CNG) \
+  $(call EXPAND_LIBNAME_PATH,signal_processing,$(DEPTH)/media/webrtc/trunk/src/common_audio/common_audio_signal_processing) \
+  $(call EXPAND_LIBNAME_PATH,G711,$(DEPTH)/media/webrtc/trunk/src/modules/modules_G711) \
+  $(call EXPAND_LIBNAME_PATH,G722,$(DEPTH)/media/webrtc/trunk/src/modules/modules_G722) \
+  $(call EXPAND_LIBNAME_PATH,iLBC,$(DEPTH)/media/webrtc/trunk/src/modules/modules_iLBC) \
+  $(call EXPAND_LIBNAME_PATH,iSAC,$(DEPTH)/media/webrtc/trunk/src/modules/modules_iSAC) \
+  $(call EXPAND_LIBNAME_PATH,iSACFix,$(DEPTH)/media/webrtc/trunk/src/modules/modules_iSACFix) \
+  $(call EXPAND_LIBNAME_PATH,PCM16B,$(DEPTH)/media/webrtc/trunk/src/modules/modules_PCM16B) \
+  $(call EXPAND_LIBNAME_PATH,NetEq,$(DEPTH)/media/webrtc/trunk/src/modules/modules_NetEq) \
+  $(call EXPAND_LIBNAME_PATH,resampler,$(DEPTH)/media/webrtc/trunk/src/common_audio/common_audio_resampler) \
+  $(call EXPAND_LIBNAME_PATH,vad,$(DEPTH)/media/webrtc/trunk/src/common_audio/common_audio_vad) \
+  $(call EXPAND_LIBNAME_PATH,system_wrappers,$(DEPTH)/media/webrtc/trunk/src/system_wrappers/source/system_wrappers_system_wrappers) \
+  $(call EXPAND_LIBNAME_PATH,webrtc_video_coding,$(DEPTH)/media/webrtc/trunk/src/modules/modules_webrtc_video_coding) \
+  $(call EXPAND_LIBNAME_PATH,webrtc_i420,$(DEPTH)/media/webrtc/trunk/src/modules/modules_webrtc_i420) \
+  $(call EXPAND_LIBNAME_PATH,webrtc_vp8,$(DEPTH)/media/webrtc/trunk/src/modules/modules_webrtc_vp8) \
+  $(call EXPAND_LIBNAME_PATH,webrtc_libyuv,$(DEPTH)/media/webrtc/trunk/src/common_video/common_video_webrtc_libyuv) \
+  $(call EXPAND_LIBNAME_PATH,video_render_module,$(DEPTH)/media/webrtc/trunk/src/modules/modules_video_render_module) \
+  $(call EXPAND_LIBNAME_PATH,video_engine_core,$(DEPTH)/media/webrtc/trunk/src/video_engine/video_engine_video_engine_core) \
+  $(call EXPAND_LIBNAME_PATH,media_file,$(DEPTH)/media/webrtc/trunk/src/modules/modules_media_file) \
+  $(call EXPAND_LIBNAME_PATH,rtp_rtcp,$(DEPTH)/media/webrtc/trunk/src/modules/modules_rtp_rtcp) \
+  $(call EXPAND_LIBNAME_PATH,udp_transport,$(DEPTH)/media/webrtc/trunk/src/modules/modules_udp_transport) \
+  $(call EXPAND_LIBNAME_PATH,video_processing,$(DEPTH)/media/webrtc/trunk/src/modules/modules_video_processing) \
+  $(call EXPAND_LIBNAME_PATH,video_processing_sse2,$(DEPTH)/media/webrtc/trunk/src/modules/modules_video_processing_sse2) \
+  $(call EXPAND_LIBNAME_PATH,voice_engine_core,$(DEPTH)/media/webrtc/trunk/src/voice_engine/voice_engine_voice_engine_core) \
+  $(call EXPAND_LIBNAME_PATH,audio_conference_mixer,$(DEPTH)/media/webrtc/trunk/src/modules/modules_audio_conference_mixer) \
+  $(call EXPAND_LIBNAME_PATH,audio_device,$(DEPTH)/media/webrtc/trunk/src/modules/modules_audio_device) \
+  $(call EXPAND_LIBNAME_PATH,audio_processing,$(DEPTH)/media/webrtc/trunk/src/modules/modules_audio_processing) \
+  $(call EXPAND_LIBNAME_PATH,aec,$(DEPTH)/media/webrtc/trunk/src/modules/modules_aec) \
+  $(call EXPAND_LIBNAME_PATH,aec_sse2,$(DEPTH)/media/webrtc/trunk/src/modules/modules_aec_sse2) \
+  $(call EXPAND_LIBNAME_PATH,apm_util,$(DEPTH)/media/webrtc/trunk/src/modules/modules_apm_util) \
+  $(call EXPAND_LIBNAME_PATH,aecm,$(DEPTH)/media/webrtc/trunk/src/modules/modules_aecm) \
+  $(call EXPAND_LIBNAME_PATH,agc,$(DEPTH)/media/webrtc/trunk/src/modules/modules_agc) \
+  $(call EXPAND_LIBNAME_PATH,ns,$(DEPTH)/media/webrtc/trunk/src/modules/modules_ns) \
+  $(call EXPAND_LIBNAME_PATH,yuv,$(DEPTH)/media/webrtc/trunk/third_party/libyuv/libyuv_libyuv) \
+        $(call EXPAND_LIBNAME_PATH,expat,$(DEPTH)/media/webrtc/trunk/third_party/expat/expat_expat) \
+  $(call EXPAND_LIBNAME_PATH,webrtc_jpeg,$(DEPTH)/media/webrtc/trunk/src/common_video/common_video_webrtc_jpeg) \
+  $(NULL)
+
+ifneq ($(OS_TARGET),WINNT)
+SHARED_LIBRARY_LIBS += \
+  $(call EXPAND_LIBNAME_PATH,sipcc,$(DEPTH)/media/webrtc/signaling/signaling_sipcc) \
+  $(call EXPAND_LIBNAME_PATH,ecc,$(DEPTH)/media/webrtc/signaling/signaling_ecc) \
+  $(NULL)
+endif
--- a/media/webrtc/trunk/src/build/common.gypi
+++ b/media/webrtc/trunk/src/build/common.gypi
@@ -133,16 +133,17 @@
           'WEBRTC_MAC_INTEL',  # TODO(andrew): remove this.
           'WEBRTC_THREAD_RR',
           'WEBRTC_CLOCK_TYPE_REALTIME',
         ],
       }],
       ['OS=="win"', {
         'defines': [
           'WEBRTC_WIN',
+	  'WEBRTC_EXPORT',
         ],
         # TODO(andrew): enable all warnings when possible.
         # 4389: Signed/unsigned mismatch.
         # 4373: MSVC legacy warning for ignoring const / volatile in
         # signatures. TODO(phoglund): get rid of 4373 supression when
         # http://code.google.com/p/webrtc/issues/detail?id=261 is solved.
         'msvs_disabled_warnings': [4389, 4373],
 
deleted file mode 100644
--- a/media/webrtc/trunk/src/build/getsdksamplesdir.py
+++ /dev/null
@@ -1,17 +0,0 @@
-import sys
-import _winreg
-
-def main():
-    for version in ["7.1", "7.0"]:
-        try:
-            key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Microsoft SDKs\Windows\v%s\WinSDKSamples" % version)
-            path, typ = _winreg.QueryValueEx(key, "InstallationFolder")
-            print path.replace("\\", "/")
-            return 0
-        except:
-            pass
-    print >>sys.stderr, "Could not locate Windows SDK Samples directory via the registry"
-    return 1
-
-if __name__ == '__main__':
-    sys.exit(main())
--- a/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/make.py
+++ b/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/make.py
@@ -209,17 +209,16 @@ SHARED_HEADER = ("""\
 # The implicit make rules have it looking for RCS files, among other things.
 # We instead explicitly write all the rules we care about.
 # It's even quicker (saves ~200ms) to pass -r on the command line.
 MAKEFLAGS=-r
 
 # The source directory tree.
 srcdir := %(srcdir)s
 abs_srcdir := $(abspath $(srcdir))
-os_sep := %(os_sep)s
 
 # The name of the builddir.
 builddir_name ?= %(builddir)s
 
 # The V=1 flag on command line makes us verbosely print command lines.
 ifdef V
   quiet=
 else
@@ -605,17 +604,16 @@ def QuoteIfNecessary(string):
 
 
 def StringToMakefileVariable(string):
   """Convert a string to a value that is acceptable as a make variable name."""
   # TODO: replace other metacharacters that we encounter.
   return re.sub('[ {}$]', '_', string)
 
 
-os_sep = os.sep
 srcdir_prefix = ''
 def Sourceify(path):
   """Convert a path to its source directory form."""
   if '$(' in path:
     return path
   if os.path.isabs(path):
     return path
   return srcdir_prefix + path
@@ -1965,37 +1963,34 @@ def GenerateOutput(target_list, target_d
     spec = target_dicts[target]
     if spec['default_configuration'] != 'Default':
       default_configuration = spec['default_configuration']
       break
   if not default_configuration:
     default_configuration = 'Default'
 
   srcdir = '.'
-  global os_sep
-  os_sep = os.sep
   makefile_name = 'Makefile' + options.suffix
   makefile_path = os.path.join(options.toplevel_dir, makefile_name)
   if options.generator_output:
     global srcdir_prefix
     makefile_path = os.path.join(options.generator_output, makefile_path)
     srcdir = gyp.common.RelativePath(srcdir, options.generator_output)
-    srcdir_prefix = '$(srcdir)' + os.sep
+    srcdir_prefix = '$(srcdir)/'
 
   flock_command= 'flock'
   header_params = {
       'default_target': default_target,
       'builddir': builddir_name,
       'default_configuration': default_configuration,
       'flock': flock_command,
       'flock_index': 1,
       'link_commands': LINK_COMMANDS_LINUX,
       'extra_commands': '',
       'srcdir': srcdir,
-      'os_sep': os.sep,
     }
   if flavor == 'mac':
     flock_command = './gyp-mac-tool flock'
     header_params.update({
         'flock': flock_command,
         'flock_index': 2,
         'link_commands': LINK_COMMANDS_MAC,
         'extra_commands': SHARED_HEADER_MAC_COMMANDS,
new file mode 100644
--- /dev/null
+++ b/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py
@@ -0,0 +1,445 @@
+# Copyright (c) 2012 Mozilla Foundation. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Python 2.5 needs this for the with statement.
+from __future__ import with_statement
+
+import collections
+import gyp
+import gyp.common
+import sys
+import os
+import re
+import shlex
+
+generator_wants_sorted_dependencies = True
+
+generator_default_variables = {
+}
+for dirname in ['INTERMEDIATE_DIR', 'SHARED_INTERMEDIATE_DIR', 'PRODUCT_DIR',
+                'LIB_DIR', 'SHARED_LIB_DIR']:
+  # Some gyp steps fail if these are empty(!).
+  generator_default_variables[dirname] = 'dir'
+for unused in ['RULE_INPUT_PATH', 'RULE_INPUT_ROOT', 'RULE_INPUT_NAME',
+               'RULE_INPUT_DIRNAME', 'RULE_INPUT_EXT',
+               'EXECUTABLE_PREFIX', 'EXECUTABLE_SUFFIX',
+               'STATIC_LIB_PREFIX', 'STATIC_LIB_SUFFIX',
+               'SHARED_LIB_PREFIX', 'SHARED_LIB_SUFFIX',
+               'LINKER_SUPPORTS_ICF']:
+  generator_default_variables[unused] = ''
+
+COMMON_HEADER = """# This makefile was automatically generated from %(buildfile)s. Please do not edit it directly.
+DEPTH		= %(depth)s
+topsrcdir	= %(topsrcdir)s
+srcdir          = %(srcdir)s
+VPATH           = %(srcdir)s
+
+"""
+
+COMMON_FOOTER = """
+# Skip rules that deal with regenerating Makefiles from Makefile.in files.
+NO_MAKEFILE_RULE = 1
+NO_SUBMAKEFILES_RULE = 1
+
+include $(topsrcdir)/config/rules.mk
+include $(DEPTH)/%(relative_path)s/common.mk
+"""
+
+COMMON_MK = """# This file was generated by mozmake.py. Do not edit it directly.
+ifndef COMMON_MK_INCLUDED
+COMMON_MK_INCLUDED := 1
+
+ifdef MOZ_DEBUG
+CFLAGS += $(CPPFLAGS_Debug) $(CFLAGS_Debug)
+CXXFLAGS += $(CPPFLAGS_Debug) $(CXXFLAGS_Debug)
+DEFINES += $(DEFINES_Debug)
+LOCAL_INCLUDES += $(INCLUDES_Debug)
+else # non-MOZ_DEBUG
+CFLAGS += $(CPPFLAGS_Release) $(CFLAGS_Release)
+CXXFLAGS += $(CPPFLAGS_Release) $(CXXFLAGS_Release)
+DEFINES += $(DEFINES_Release)
+LOCAL_INCLUDES += $(INCLUDES_Release)
+endif
+
+ifeq (WINNT,$(OS_TARGET))
+# These get set via VC project file settings for normal GYP builds.
+DEFINES += -DUNICODE -D_UNICODE
+LOCAL_INCLUDES += -I"$(MOZ_DIRECTX_SDK_PATH)/include"
+endif
+
+# Don't use STL wrappers when compiling Google code.
+STL_FLAGS =
+
+# Work around the fact that Google codebases don't compile cleanly
+# with -pedantic.
+OS_CFLAGS := $(filter-out -pedantic,$(OS_CFLAGS))
+OS_CXXFLAGS := $(filter-out -pedantic,$(OS_CXXFLAGS))
+
+# Skip Mozilla-specific include locations.
+# Specific GYP files can add them back by adding
+# $(DIST)/include to their includes.
+INCLUDES = -I. $(LOCAL_INCLUDES)
+
+# Ensure that subdirs for sources get created before compiling
+ifdef OBJS
+SUB_SRCDIRS := $(addsuffix .dirstamp,$(addprefix $(CURDIR)/,$(sort $(dir $(OBJS)))))
+$(OBJS): $(SUB_SRCDIRS)
+$(SUB_SRCDIRS):
+	$(MKDIR) -p $(dir $@)
+	touch $@
+endif
+
+# COPY_SRCS get copied to the current directory to be compiled
+
+define COPY_SRC
+$(notdir $(1)): $(1)
+	$$(INSTALL) $$(IFLAGS1) "$$<" .
+
+endef # COPY_SRC
+ifdef COPY_SRCS
+GARBAGE += $(notdir $(COPY_SRCS))
+$(foreach s,$(COPY_SRCS), $(eval $(call COPY_SRC,$(s))))
+endif
+
+# Rules for regenerating Makefiles from GYP files.
+Makefile: %(input_gypfiles)s %(generator)s
+	$(PYTHON) %(commandline)s
+
+endif
+"""
+
+def ensure_directory_exists(path):
+  dir = os.path.dirname(path)
+  if dir and not os.path.exists(dir):
+    os.makedirs(dir)
+
+def GetFlavor(params):
+  """Returns |params.flavor| if it's set, the system's default flavor else."""
+  flavors = {
+    'win32': 'win',
+    'darwin': 'mac',
+    'sunos5': 'solaris',
+    'freebsd7': 'freebsd',
+    'freebsd8': 'freebsd',
+  }
+  flavor = flavors.get(sys.platform, 'linux')
+  return params.get('flavor', flavor)
+
+
+def CalculateVariables(default_variables, params):
+  generator_flags = params.get('generator_flags', {})
+  default_variables['OS'] = generator_flags.get('os', GetFlavor(params))
+
+
+def CalculateGeneratorInputInfo(params):
+  """Calculate the generator specific info that gets fed to input (called by
+  gyp)."""
+  generator_flags = params.get('generator_flags', {})
+  if generator_flags.get('adjust_static_libraries', False):
+    global generator_wants_static_library_dependencies_adjusted
+    generator_wants_static_library_dependencies_adjusted = True
+
+def WriteMakefile(filename, data, build_file, depth, topsrcdir, srcdir, relative_path, extra_data=None):
+  if not os.path.isabs(topsrcdir):
+    topsrcdir = depth + "/" + topsrcdir
+  if not os.path.isabs(srcdir):
+    srcdir = depth + "/" + srcdir
+  #TODO: should compare with the existing file and not overwrite it if the
+  # contents are the same!
+  ensure_directory_exists(filename)
+  with open(filename, "w") as f:
+    f.write(COMMON_HEADER % {'buildfile': build_file,
+                             'depth': depth,
+                             'topsrcdir': topsrcdir,
+                             'srcdir': srcdir})
+    for k, v in data.iteritems():
+      f.write("%s = %s\n" % (k, " \\\n  ".join([''] + v) if isinstance(v, list) else v))
+    f.write(COMMON_FOOTER % {'relative_path': relative_path})
+    if extra_data:
+      f.write(extra_data)
+
+def WriteCommonMk(path, build_files, scriptname, commandline):
+  with open(path, "w") as f:
+    f.write(COMMON_MK % {'input_gypfiles': ' '.join(build_files),
+                         'generator': scriptname,
+                         'commandline': ' '.join(commandline)})
+
+def striplib(name):
+  "Strip lib prefixes from library names."
+  if name[:3] == 'lib':
+    return name[3:]
+  return name
+
+CPLUSPLUS_EXTENSIONS = set([
+  '.cc',
+  '.cpp',
+  '.cxx'
+])
+COMPILABLE_EXTENSIONS = set([
+  '.c',
+  '.s',
+  '.S',
+  '.m',
+  '.mm'
+])
+COMPILABLE_EXTENSIONS.update(CPLUSPLUS_EXTENSIONS)
+
+def swapslashes(p):
+  "Swap backslashes for forward slashes in a path."
+  return p.replace('\\', '/')
+
+def getdepth(s):
+  """Given a relative path, return a relative path consisting
+  of .. segments that would lead to the parent directory."""
+  return "/".join(".." for x in swapslashes(s).split("/") if x)
+
+def Compilable(filename):
+  return os.path.splitext(filename)[1] in COMPILABLE_EXTENSIONS
+
+class MakefileGenerator(object):
+  def __init__(self, target_dicts, data, options, depth, topsrcdir, relative_topsrcdir, relative_srcdir, output_dir):
+    self.target_dicts = target_dicts
+    self.data = data
+    self.options = options
+    self.depth = depth
+    self.relative_srcdir = swapslashes(relative_srcdir)
+    self.topsrcdir = swapslashes(topsrcdir)
+    self.relative_topsrcdir = swapslashes(relative_topsrcdir)
+    self.srcdir = swapslashes(os.path.join(topsrcdir, relative_srcdir))
+    self.output_dir = output_dir
+    # Directories to be built in order.
+    self.dirs = []
+    # Directories that can be built in any order, but before |dirs|.
+    self.parallel_dirs = []
+    # Targets that have been processed.
+    self.visited = set()
+    # Link dependencies.
+    self.target_link_deps = {}
+
+  def CalculateMakefilePath(self, build_file, target_name):
+    """Determine where to write a Makefile for a given gyp file."""
+    rel_path = gyp.common.RelativePath(os.path.dirname(build_file),
+                                       self.srcdir)
+    # Add a subdir using the build_file name and the target_name.
+    rel_path = os.path.join(rel_path,
+                             os.path.splitext(os.path.basename(build_file))[0]
+                             + "_" + target_name)
+    output_file = os.path.join(self.output_dir, rel_path, "Makefile")
+    return swapslashes(rel_path), swapslashes(output_file)
+
+  def ProcessTargets(self, needed_targets):
+    """
+    Put all targets in proper order so that dependencies get built before
+    the targets that need them. Targets that have no dependencies
+    can get built in parallel_dirs. Targets with dependencies must be in
+    dirs, and must also be listed after any of their dependencies.
+    """
+    for qualified_target in needed_targets:
+      if qualified_target in self.visited:
+        continue
+      self.ProcessTarget(qualified_target)
+
+  def ProcessTarget(self, qualified_target):
+    """
+    Write a Makefile.in for |qualified_target| and add it to |dirs| or
+    |parallel_dirs| as appropriate, after processing all of its
+    dependencies.
+    """
+    spec = self.target_dicts[qualified_target]
+    if 'dependencies' in spec and spec['dependencies']:
+      for dep in spec['dependencies']:
+        if dep not in self.visited:
+          self.ProcessTarget(dep)
+      dirs = self.dirs
+    else:
+      # no dependencies
+      dirs = self.parallel_dirs
+    # Now write a Makefile for this target
+    build_file, target, toolset = gyp.common.ParseQualifiedTarget(
+      qualified_target)
+    build_file = os.path.abspath(build_file)
+    rel_path, output_file = self.CalculateMakefilePath(build_file, target)
+    subdepth = self.depth + "/" + getdepth(rel_path)
+    if self.WriteTargetMakefile(output_file, rel_path, qualified_target, spec, build_file, subdepth):
+        # If WriteTargetMakefile returns True, then this is a useful target
+      dirs.append(rel_path)
+    self.visited.add(qualified_target)
+
+  def WriteTargetMakefile(self, output_file, rel_path, qualified_target, spec, build_file, depth):
+    configs = spec['configurations']
+    # Update global list of link dependencies.
+    if spec['type'] in ('static_library', 'shared_library'):
+      self.target_link_deps[qualified_target] = "$(call EXPAND_LIBNAME_PATH,%s,$(DEPTH)/%s/%s)" % (striplib(spec['target_name']), self.relative_srcdir, rel_path)
+
+    data = {}
+    #TODO: handle actions/rules/copies
+    if 'actions' in spec:
+      pass
+    if 'rules' in spec:
+      pass
+    if 'copies' in spec:
+      pass
+    libs = []
+    if 'dependencies' in spec:
+      for dep in spec['dependencies']:
+        if dep in self.target_link_deps:
+          libs.append(self.target_link_deps[dep])
+    if libs:
+      data['EXTRA_LIBS'] = libs
+
+    # Get DEFINES/INCLUDES
+    for configname in sorted(configs.keys()):
+      config = configs[configname]
+      #XXX: this sucks
+      defines = config.get('defines')
+      if defines:
+        data['DEFINES_%s' % configname] = ["-D%s" % d for d in defines]
+      includes = []
+      for i in config.get('include_dirs', []):
+        # Make regular paths into srcdir-relative paths, leave
+        # variable-specified paths alone.
+        if i.startswith("$(") or os.path.isabs(i):
+          if ' ' in i:
+            includes.append('"%s"' % i)
+          else:
+            includes.append(i)
+        else:
+          includes.append("$(srcdir)/" + i)
+      if includes:
+        data['INCLUDES_%s' % configname] = ["-I%s" %i for i in includes]
+      #XXX: handle mac stuff?
+# we want to use our compiler options in general
+#      cflags = config.get('cflags')
+#      if cflags:
+#        data['CPPFLAGS_%s' % configname] = cflags
+#      cflags_c = config.get('cflags_c')
+#      if cflags_c:
+#        data['CFLAGS_%s' % configname] = cflags_c
+#      cflags_cc = config.get('cflags_cc')
+#      if cflags_cc:
+#        data['CXXFLAGS_%s' % configname] = cflags_cc
+# we need to keep pkg-config flags however
+      cflags_mozilla = config.get('cflags_mozilla')
+      if cflags_mozilla:
+        data['CPPFLAGS_%s' % configname] = cflags_mozilla
+    sources = {
+      'CPPSRCS': {'exts': CPLUSPLUS_EXTENSIONS, 'files': []},
+      'CSRCS': {'exts': ['.c'], 'files': []},
+      'CMSRCS': {'exts': ['.m'], 'files': []},
+      'CMMSRCS': {'exts': ['.mm'], 'files': []},
+      'ASFILES': {'exts': ['.s'], 'files': []},
+      }
+    copy_srcs = []
+    for s in spec.get('sources', []):
+      if not Compilable(s):
+        continue
+
+      # Special-case absolute paths, they'll get copied into the objdir
+      # for compiling.
+      if os.path.isabs(s):
+        # GNU Make falls down pretty badly with spaces in filenames.
+        # Conveniently, using a single-character ? as a wildcard
+        # works fairly well.
+        copy_srcs.append(s.replace(' ', '?'))
+        s = os.path.basename(s)
+
+      ext = os.path.splitext(s)[1]
+      for source_type, d in sources.iteritems():
+        if ext in d['exts']:
+          d['files'].append(s)
+          break
+      
+    for source_type, d in sources.iteritems():
+      if d['files']:
+        data[source_type] = d['files']
+
+    if copy_srcs:
+      data['COPY_SRCS'] = copy_srcs
+
+    if spec['type'] == 'executable':
+      data['PROGRAM'] = spec['target_name']
+    elif spec['type'] == 'static_library':
+      data['LIBRARY_NAME'] = striplib(spec['target_name'])
+      data['FORCE_STATIC_LIB'] = 1
+    elif spec['type'] in ('loadable_module', 'shared_library'):
+      data['LIBRARY_NAME'] = striplib(spec['target_name'])
+      data['FORCE_SHARED_LIB'] = 1
+    else:
+      # Maybe nothing?
+      return False
+    WriteMakefile(output_file, data, build_file, depth, self.relative_topsrcdir,
+                  # we set srcdir up one directory, since the subdir
+                  # doesn't actually exist in the source directory
+                  swapslashes(os.path.join(self.relative_topsrcdir, self.relative_srcdir, os.path.split(rel_path)[0])),
+                  self.relative_srcdir)
+    return True
+
+def GenerateOutput(target_list, target_dicts, data, params):
+  options = params['options']
+  flavor = GetFlavor(params)
+  generator_flags = params.get('generator_flags', {})
+
+  # Get a few directories into Mozilla-common naming conventions
+  # The root of the source repository.
+  topsrcdir = os.path.abspath(options.toplevel_dir)
+  # The object directory (root of the build).
+  objdir = os.path.abspath(generator_flags['OBJDIR'] if 'OBJDIR' in generator_flags else '.')
+  # A relative path from the objdir to the topsrcdir
+  relative_topsrcdir = gyp.common.RelativePath(topsrcdir, objdir)
+  # The directory containing the gyp file on which gyp was invoked.
+  gyp_file_dir = os.path.abspath(os.path.dirname(params['build_files'][0]) or '.')
+  # The relative path from topsrcdir to gyp_file_dir
+  relative_srcdir = gyp.common.RelativePath(gyp_file_dir, topsrcdir)
+  # The relative path from objdir to gyp_file_dir
+  srcdir = gyp.common.RelativePath(gyp_file_dir, objdir)
+  # The path to get up to the root of the objdir from the output dir.
+  depth = getdepth(relative_srcdir)
+  # The output directory.
+  output_dir = os.path.abspath(options.generator_output or '.')
+  # The path to the root Makefile
+  makefile_path = os.path.join(output_dir, "Makefile")
+
+  def topsrcdir_path(path):
+    return "$(topsrcdir)/" + swapslashes(gyp.common.RelativePath(path, topsrcdir))
+  def objdir_path(path):
+    return "$(DEPTH)/" + swapslashes(gyp.common.RelativePath(path, objdir))
+
+  # Find the list of targets that derive from the gyp file(s) being built.
+  needed_targets = set()
+  build_files = set()
+  for build_file in params['build_files']:
+    build_file = os.path.normpath(build_file)
+    for target in gyp.common.AllTargets(target_list, target_dicts, build_file):
+      needed_targets.add(target)
+      build_file_, _, _ = gyp.common.ParseQualifiedTarget(target)
+      build_files.add(topsrcdir_path(build_file_))
+
+  generator = MakefileGenerator(target_dicts, data, options, depth, topsrcdir, relative_topsrcdir, relative_srcdir, output_dir)
+  generator.ProcessTargets(needed_targets)
+
+  # Write the top-level makefile, which simply calls the other makefiles
+  topdata = {'DIRS': generator.dirs}
+  if generator.parallel_dirs:
+    topdata['PARALLEL_DIRS'] = generator.parallel_dirs
+  WriteMakefile(makefile_path, topdata, params['build_files'][0],
+                depth,
+                swapslashes(relative_topsrcdir),
+                swapslashes(srcdir),
+                swapslashes(relative_srcdir))
+  scriptname = topsrcdir_path(__file__)
+  # Reassemble a commandline from parts so that all the paths are correct
+  commandline = [topsrcdir_path(sys.argv[0]),
+                 "--format=mozmake",
+                 "--depth=%s" % topsrcdir_path(options.depth),
+                 "--generator-output=%s" % objdir_path(options.generator_output),
+                 "--toplevel-dir=$(topsrcdir)",
+                 #XXX: handle other generator_flags gracefully?
+                 "-G OBJDIR=$(DEPTH)"] + \
+                 ['-D%s' % d for d in options.defines] + \
+                 [topsrcdir_path(b) for b in params['build_files']]
+                 
+  WriteCommonMk(os.path.join(output_dir, "common.mk"),
+                build_files,
+                scriptname,
+                commandline)
--- a/parser/expat/expat_config.h
+++ b/parser/expat/expat_config.h
@@ -125,17 +125,22 @@ typedef char XML_LChar;
 #ifndef __VMS
 #define XmlPrologStateInitExternalEntity MOZ_XmlPrologStateInitExternalEntity
 #else
 #define XmlPrologStateInitExternalEnt MOZ_XmlPrologStateInitExternalEnt
 #endif
 
 /* xmltok.h */
 #define XmlParseXmlDecl MOZ_XmlParseXmlDecl
+#define XmlParseXmlDeclNS MOZ_XmlParseXmlDeclNS
 #define XmlInitEncoding MOZ_XmlInitEncoding
+#define XmlInitEncodingNS MOZ_XmlInitEncodingNS
 #define XmlGetUtf8InternalEncoding MOZ_XmlGetUtf8InternalEncoding
 #define XmlGetUtf16InternalEncoding MOZ_XmlGetUtf16InternalEncoding
+#define XmlGetUtf8InternalEncodingNS MOZ_XmlGetUtf8InternalEncodingNS
+#define XmlGetUtf16InternalEncodingNS MOZ_XmlGetUtf16InternalEncodingNS
 #define XmlUtf8Encode MOZ_XmlUtf8Encode
 #define XmlUtf16Encode MOZ_XmlUtf16Encode
 #define XmlSizeOfUnknownEncoding MOZ_XmlSizeOfUnknownEncoding
 #define XmlInitUnknownEncoding MOZ_XmlInitUnknownEncoding
+#define XmlInitUnknownEncodingNS MOZ_XmlInitUnknownEncodingNS
 
 #endif /* __expat_config_h__ */
--- a/toolkit/library/Makefile.in
+++ b/toolkit/library/Makefile.in
@@ -448,33 +448,34 @@ EXTRA_DSO_LDOPTS += $(LIBS_DIR) $(EXTRA_
 DEFINES += -DIMPL_XREAPI
 
 EXTRA_DSO_LDOPTS += $(NSPR_LIBS) $(MOZALLOC_LIB)
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
 CXXFLAGS += $(TK_CFLAGS)
 OS_LIBS += \
   -framework SystemConfiguration \
-  -framework QuickTime \
+  -framework QTKit \
   -framework IOKit \
   -F/System/Library/PrivateFrameworks -framework CoreUI \
   $(TK_LIBS) \
   $(NULL)
 endif
 
 ifeq ($(OS_ARCH),Darwin)
 ifdef MOZ_SYDNEYAUDIO
 OS_LIBS += \
   -framework Carbon \
   -framework CoreAudio \
   -framework AudioToolbox \
   -framework AudioUnit \
   -framework IOKit \
   -framework Foundation \
   -framework AppKit \
+  -framework Security \
   $(NULL)
 endif
 endif
 
 ifneq (,$(filter NetBSD OpenBSD,$(OS_ARCH)))
 ifdef MOZ_SYDNEYAUDIO
 EXTRA_DSO_LDOPTS += -lossaudio
 endif
--- a/toolkit/toolkit-makefiles.sh
+++ b/toolkit/toolkit-makefiles.sh
@@ -1610,14 +1610,20 @@ fi
 if [ "$MOZ_SYDNEYAUDIO" ]; then
   add_makefiles "
     media/libsydneyaudio/Makefile
     media/libsydneyaudio/include/Makefile
     media/libsydneyaudio/src/Makefile
   "
 fi
 
+if [ "$MOZ_WEBRTC" ]; then
+ add_makefiles "
+   media/webrtc/Makefile
+ "
+fi
+
 if [ "$MOZ_SPEEX_RESAMPLER" ]; then
   add_makefiles "
     media/libspeex_resampler/Makefile
     media/libspeex_resampler/src/Makefile
   "
 fi
--- a/toolkit/toolkit-tiers.mk
+++ b/toolkit/toolkit-tiers.mk
@@ -121,16 +121,22 @@ tier_platform_dirs += \
 endif
 
 ifdef MOZ_SYDNEYAUDIO
 tier_platform_dirs += \
 		media/libsydneyaudio \
 		$(NULL)
 endif
 
+ifdef MOZ_WEBRTC
+tier_platform_dirs += \
+  media/webrtc \
+  $(NULL)
+endif
+
 ifdef MOZ_SPEEX_RESAMPLER
 tier_platform_dirs += \
 		media/libspeex_resampler \
 		$(NULL)
 endif
 
 ifdef MOZ_CUBEB
 tier_platform_dirs += \