From 3ab52df41932835695988bfacd9790d8dc6ce98f Mon Sep 17 00:00:00 2001
From: Shawn Landden <shawnl@mv78100>
Date: Fri, 1 Jun 2012 04:47:41 +0000
Subject: [PATCH] fix FTBFS on armel (and likely armhf) see patches for
 details

want_separate_host_toolset=0 from v8.gyp issues
---
 ...sposition-is-neccisary-to-build-on-arm-v7.patch |   27 ++
 debian/patches/0002-backport-webrtc-disable.patch  |  158 ++++++++++++
 debian/patches/0003-backport-webrtc-disable.patch  |  261 ++++++++++++++++++++
 debian/patches/series                              |    3 +
 debian/rules                                       |    2 +
 5 files changed, 451 insertions(+)
 create mode 100644 debian/patches/0001-this-transposition-is-neccisary-to-build-on-arm-v7.patch
 create mode 100644 debian/patches/0002-backport-webrtc-disable.patch
 create mode 100644 debian/patches/0003-backport-webrtc-disable.patch

diff --git a/debian/patches/0001-this-transposition-is-neccisary-to-build-on-arm-v7.patch b/debian/patches/0001-this-transposition-is-neccisary-to-build-on-arm-v7.patch
new file mode 100644
index 0000000..fdc1f78
--- /dev/null
+++ b/debian/patches/0001-this-transposition-is-neccisary-to-build-on-arm-v7.patch
@@ -0,0 +1,27 @@
+From 6c3bd6f6b4dde63ee57b0102b9085e3b65c8497c Mon Sep 17 00:00:00 2001
+From: Shawn Landden <shawnlandden@gmail.com>
+Date: Thu, 31 May 2012 20:13:25 -0700
+Subject: [PATCH] this transposition is neccisary to build on arm <v7
+
+---
+ src/skia/skia.gyp |    2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/skia/skia.gyp b/src/skia/skia.gyp
+index 49ed9cf..22cd3b5 100644
+--- a/src/skia/skia.gyp
++++ b/src/skia/skia.gyp
+@@ -1095,9 +1095,11 @@
+         [ 'target_arch == "arm" and armv7 != 1', {
+           'sources': [
+             '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
++            '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
+           ],
+           'sources!': [
+             '../third_party/skia/src/opts/SkBlitRow_opts_arm.cpp',
++            '../third_party/skia/src/opts/opts_check_arm.cpp'
+           ],
+         }],
+       ],
+-- 
+1.7.9.5
diff --git a/debian/patches/0002-backport-webrtc-disable.patch b/debian/patches/0002-backport-webrtc-disable.patch
new file mode 100644
index 0000000..7708f42
--- /dev/null
+++ b/debian/patches/0002-backport-webrtc-disable.patch
@@ -0,0 +1,158 @@
+From f23a5a68ab85ff2c1702980243abebaba57c337f Mon Sep 17 00:00:00 2001
+From: "grunell@chromium.org"
+ <grunell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
+Date: Tue, 31 Jan 2012 12:12:37 +0000
+Subject: [PATCH] Fix build when webrtc is disabled; i.e. when enable_webrtc
+ is set to 0 in build/common.gypi.
+
+Building with webrtc disabled is currently not tested by any build bots. Landing the support for PeerConnection v2 (instead of v1) in 119568 broke the build when webrtc is disabled.
+
+The stub implementations must be updated to reflect the new interfaces.
+
+TEST=Set enable_webrtc to 0 in build/common.gypi; build chrome.
+
+Review URL: https://chromiumcodereview.appspot.com/9302030
+
+git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119888 0039d316-1c4b-4281-b951-d872f2087c98
+---
+ .../media/media_stream_dependency_factory_stub.cc  |   42 ++++++++++++--------
+ content/renderer/media/media_stream_impl_stub.cc   |   24 ++++-------
+ 2 files changed, 34 insertions(+), 32 deletions(-)
+
+diff --git a/content/renderer/media/media_stream_dependency_factory_stub.cc b/content/renderer/media/media_stream_dependency_factory_stub.cc
+index 6cd5afd..82adb97 100644
+--- a/content/renderer/media/media_stream_dependency_factory_stub.cc
++++ b/content/renderer/media/media_stream_dependency_factory_stub.cc
+@@ -8,34 +8,44 @@ MediaStreamDependencyFactory::MediaStreamDependencyFactory() {}
+ 
+ MediaStreamDependencyFactory::~MediaStreamDependencyFactory() {}
+ 
+-cricket::WebRtcMediaEngine*
+-MediaStreamDependencyFactory::CreateWebRtcMediaEngine() {
+-  return NULL;
+-}
+-
+ bool MediaStreamDependencyFactory::CreatePeerConnectionFactory(
+-    cricket::MediaEngineInterface* media_engine,
+-    talk_base::Thread* worker_thread) {
++    talk_base::Thread* worker_thread,
++    talk_base::Thread* signaling_thread,
++    content::P2PSocketDispatcher* socket_dispatcher,
++    talk_base::NetworkManager* network_manager,
++    talk_base::PacketSocketFactory* socket_factory) {
+   return false;
+ }
+ 
+-void MediaStreamDependencyFactory::DeletePeerConnectionFactory() {
++void MediaStreamDependencyFactory::ReleasePeerConnectionFactory() {
+ }
+ 
+ bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() {
+   return false;
+ }
+ 
+-cricket::PortAllocator* MediaStreamDependencyFactory::CreatePortAllocator(
+-    content::P2PSocketDispatcher* socket_dispatcher,
+-    talk_base::NetworkManager* network_manager,
+-    talk_base::PacketSocketFactory* socket_factory,
+-    const webkit_glue::P2PTransport::Config& config) {
++talk_base::scoped_refptr<webrtc::PeerConnectionInterface>
++MediaStreamDependencyFactory::CreatePeerConnection(
++    const std::string& config,
++    webrtc::PeerConnectionObserver* observer) {
++  return NULL;
++}
++
++talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface>
++MediaStreamDependencyFactory::CreateLocalMediaStream(const std::string& label) {
++  return NULL;
++}
++
++talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface>
++MediaStreamDependencyFactory::CreateLocalVideoTrack(
++    const std::string& label,
++    cricket::VideoCapturer* video_device) {
+   return NULL;
+ }
+ 
+-webrtc::PeerConnection* MediaStreamDependencyFactory::CreatePeerConnection(
+-    cricket::PortAllocator* port_allocator,
+-    talk_base::Thread* signaling_thread) {
++talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface>
++MediaStreamDependencyFactory::CreateLocalAudioTrack(
++    const std::string& label,
++    webrtc::AudioDeviceModule* audio_device) {
+   return NULL;
+ }
+diff --git a/content/renderer/media/media_stream_impl_stub.cc b/content/renderer/media/media_stream_impl_stub.cc
+index cb67bce..ade3fee 100644
+--- a/content/renderer/media/media_stream_impl_stub.cc
++++ b/content/renderer/media/media_stream_impl_stub.cc
+@@ -16,7 +16,6 @@ MediaStreamImpl::MediaStreamImpl(
+     MediaStreamDependencyFactory* dependency_factory)
+     : dependency_factory_(dependency_factory),
+       media_stream_dispatcher_(media_stream_dispatcher),
+-      media_engine_(NULL),
+       p2p_socket_dispatcher_(p2p_socket_dispatcher),
+       network_manager_(NULL),
+       vc_manager_(vc_manager),
+@@ -24,15 +23,10 @@ MediaStreamImpl::MediaStreamImpl(
+       message_loop_proxy_(base::MessageLoopProxy::current()),
+       signaling_thread_(NULL),
+       worker_thread_(NULL),
+-      chrome_worker_thread_("Chrome_libJingle_WorkerThread"),
+-      vcm_created_(false) {
++      chrome_worker_thread_("Chrome_libJingle_WorkerThread") {
+ }
+ 
+-MediaStreamImpl::~MediaStreamImpl() {
+-  DCHECK(!peer_connection_handler_);
+-  if (dependency_factory_.get())
+-    dependency_factory_->DeletePeerConnectionFactory();
+-}
++MediaStreamImpl::~MediaStreamImpl() {}
+ 
+ WebKit::WebPeerConnectionHandler* MediaStreamImpl::CreatePeerConnectionHandler(
+     WebKit::WebPeerConnectionHandlerClient* client) {
+@@ -42,8 +36,9 @@ WebKit::WebPeerConnectionHandler* MediaStreamImpl::CreatePeerConnectionHandler(
+ void MediaStreamImpl::ClosePeerConnection() {
+ }
+ 
+-bool MediaStreamImpl::SetVideoCaptureModule(const std::string& label) {
+-  return false;
++webrtc::MediaStreamTrackInterface* MediaStreamImpl::GetLocalMediaStreamTrack(
++    const std::string& label) {
++  return NULL;
+ }
+ 
+ void MediaStreamImpl::requestUserMedia(
+@@ -69,8 +64,7 @@ void MediaStreamImpl::OnStreamGenerated(
+     const media_stream::StreamDeviceInfoArray& video_array) {
+ }
+ 
+-void MediaStreamImpl::OnStreamGenerationFailed(int request_id) {
+-}
++void MediaStreamImpl::OnStreamGenerationFailed(int request_id) {}
+ 
+ void MediaStreamImpl::OnVideoDeviceFailed(const std::string& label,
+                                           int index) {
+@@ -85,8 +79,7 @@ void MediaStreamImpl::OnDevicesEnumerated(
+     const media_stream::StreamDeviceInfoArray& device_array) {
+ }
+ 
+-void MediaStreamImpl::OnDevicesEnumerationFailed(int request_id) {
+-}
++void MediaStreamImpl::OnDevicesEnumerationFailed(int request_id) {}
+ 
+ void MediaStreamImpl::OnDeviceOpened(
+     int request_id,
+@@ -94,5 +87,4 @@ void MediaStreamImpl::OnDeviceOpened(
+     const media_stream::StreamDeviceInfo& video_device) {
+ }
+ 
+-void MediaStreamImpl::OnDeviceOpenFailed(int request_id) {
+-}
++void MediaStreamImpl::OnDeviceOpenFailed(int request_id) {}
+-- 
+1.7.10
+
diff --git a/debian/patches/0003-backport-webrtc-disable.patch b/debian/patches/0003-backport-webrtc-disable.patch
new file mode 100644
index 0000000..519e95a
--- /dev/null
+++ b/debian/patches/0003-backport-webrtc-disable.patch
@@ -0,0 +1,261 @@
+From 9274c9eef5beb4a8b16c035f948ede0ffe8a8d11 Mon Sep 17 00:00:00 2001
+From: "wjia@chromium.org"
+ <wjia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
+Date: Thu, 9 Feb 2012 18:19:32 +0000
+Subject: [PATCH] disable media stream creation when enable_webrtc=0
+ BUG=110581 Review URL:
+ https://chromiumcodereview.appspot.com/9369022
+
+git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121252 0039d316-1c4b-4281-b951-d872f2087c98
+---
+ build/common.gypi                                  |    3 +
+ content/content_renderer.gypi                      |    7 +-
+ .../media/media_stream_dependency_factory_stub.cc  |   51 -----------
+ content/renderer/media/media_stream_impl_stub.cc   |   90 --------------------
+ content/renderer/render_view_impl.cc               |    6 ++
+ 5 files changed, 10 insertions(+), 147 deletions(-)
+ delete mode 100644 content/renderer/media/media_stream_dependency_factory_stub.cc
+ delete mode 100644 content/renderer/media/media_stream_impl_stub.cc
+
+diff --git a/build/common.gypi b/build/common.gypi
+index 5c5847e..60e982b 100644
+--- a/build/common.gypi
++++ b/build/common.gypi
+@@ -1105,6 +1105,9 @@
+       ['remoting==1', {
+         'defines': ['ENABLE_REMOTING=1'],
+       }],
++      ['enable_webrtc==1', {
++        'defines': ['ENABLE_WEBRTC=1'],
++      }],
+       ['p2p_apis==1', {
+         'defines': ['ENABLE_P2P_APIS=1'],
+       }],
+diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi
+index e5ed0d5..6ccbc9b 100644
+--- a/content/content_renderer.gypi
++++ b/content/content_renderer.gypi
+@@ -101,7 +101,6 @@
+     'renderer/media/capture_video_decoder.cc',
+     'renderer/media/capture_video_decoder.h',
+     'renderer/media/media_stream_dependency_factory.h',
+-    'renderer/media/media_stream_dispatcher.cc',
+     'renderer/media/media_stream_dispatcher.h',
+     'renderer/media/media_stream_dispatcher_eventhandler.h',
+     'renderer/media/media_stream_impl.h',
+@@ -264,6 +263,7 @@
+       ],
+       'sources': [
+         'renderer/media/media_stream_dependency_factory.cc',
++        'renderer/media/media_stream_dispatcher.cc',
+         'renderer/media/media_stream_impl.cc',
+         'renderer/media/peer_connection_handler.cc',
+         'renderer/media/peer_connection_handler.h',
+@@ -272,11 +272,6 @@
+         'renderer/media/webrtc_audio_device_impl.cc',
+         'renderer/media/webrtc_audio_device_impl.h',
+       ],
+-    }, {
+-      'sources': [
+-        'renderer/media/media_stream_dependency_factory_stub.cc',
+-        'renderer/media/media_stream_impl_stub.cc',
+-      ],
+     }],
+     ['java_bridge==1', {
+       'defines': [
+diff --git a/content/renderer/media/media_stream_dependency_factory_stub.cc b/content/renderer/media/media_stream_dependency_factory_stub.cc
+deleted file mode 100644
+index 82adb97..0000000
+--- a/content/renderer/media/media_stream_dependency_factory_stub.cc
++++ /dev/null
+@@ -1,51 +0,0 @@
+-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style license that can be
+-// found in the LICENSE file.
+-
+-#include "content/renderer/media/media_stream_dependency_factory.h"
+-
+-MediaStreamDependencyFactory::MediaStreamDependencyFactory() {}
+-
+-MediaStreamDependencyFactory::~MediaStreamDependencyFactory() {}
+-
+-bool MediaStreamDependencyFactory::CreatePeerConnectionFactory(
+-    talk_base::Thread* worker_thread,
+-    talk_base::Thread* signaling_thread,
+-    content::P2PSocketDispatcher* socket_dispatcher,
+-    talk_base::NetworkManager* network_manager,
+-    talk_base::PacketSocketFactory* socket_factory) {
+-  return false;
+-}
+-
+-void MediaStreamDependencyFactory::ReleasePeerConnectionFactory() {
+-}
+-
+-bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() {
+-  return false;
+-}
+-
+-talk_base::scoped_refptr<webrtc::PeerConnectionInterface>
+-MediaStreamDependencyFactory::CreatePeerConnection(
+-    const std::string& config,
+-    webrtc::PeerConnectionObserver* observer) {
+-  return NULL;
+-}
+-
+-talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface>
+-MediaStreamDependencyFactory::CreateLocalMediaStream(const std::string& label) {
+-  return NULL;
+-}
+-
+-talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface>
+-MediaStreamDependencyFactory::CreateLocalVideoTrack(
+-    const std::string& label,
+-    cricket::VideoCapturer* video_device) {
+-  return NULL;
+-}
+-
+-talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface>
+-MediaStreamDependencyFactory::CreateLocalAudioTrack(
+-    const std::string& label,
+-    webrtc::AudioDeviceModule* audio_device) {
+-  return NULL;
+-}
+diff --git a/content/renderer/media/media_stream_impl_stub.cc b/content/renderer/media/media_stream_impl_stub.cc
+deleted file mode 100644
+index ade3fee..0000000
+--- a/content/renderer/media/media_stream_impl_stub.cc
++++ /dev/null
+@@ -1,90 +0,0 @@
+-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style license that can be
+-// found in the LICENSE file.
+-
+-#include "content/renderer/media/media_stream_impl.h"
+-
+-#include "content/renderer/media/media_stream_dependency_factory.h"
+-#include "content/renderer/media/rtc_video_decoder.h"
+-#include "content/renderer/media/video_capture_impl_manager.h"
+-#include "content/renderer/p2p/ipc_socket_factory.h"
+-
+-MediaStreamImpl::MediaStreamImpl(
+-    MediaStreamDispatcher* media_stream_dispatcher,
+-    content::P2PSocketDispatcher* p2p_socket_dispatcher,
+-    VideoCaptureImplManager* vc_manager,
+-    MediaStreamDependencyFactory* dependency_factory)
+-    : dependency_factory_(dependency_factory),
+-      media_stream_dispatcher_(media_stream_dispatcher),
+-      p2p_socket_dispatcher_(p2p_socket_dispatcher),
+-      network_manager_(NULL),
+-      vc_manager_(vc_manager),
+-      peer_connection_handler_(NULL),
+-      message_loop_proxy_(base::MessageLoopProxy::current()),
+-      signaling_thread_(NULL),
+-      worker_thread_(NULL),
+-      chrome_worker_thread_("Chrome_libJingle_WorkerThread") {
+-}
+-
+-MediaStreamImpl::~MediaStreamImpl() {}
+-
+-WebKit::WebPeerConnectionHandler* MediaStreamImpl::CreatePeerConnectionHandler(
+-    WebKit::WebPeerConnectionHandlerClient* client) {
+-  return NULL;
+-}
+-
+-void MediaStreamImpl::ClosePeerConnection() {
+-}
+-
+-webrtc::MediaStreamTrackInterface* MediaStreamImpl::GetLocalMediaStreamTrack(
+-    const std::string& label) {
+-  return NULL;
+-}
+-
+-void MediaStreamImpl::requestUserMedia(
+-    const WebKit::WebUserMediaRequest& user_media_request,
+-    const WebKit::WebVector<WebKit::WebMediaStreamSource>&
+-        media_stream_source_vector) {
+-}
+-
+-void MediaStreamImpl::cancelUserMediaRequest(
+-    const WebKit::WebUserMediaRequest& user_media_request) {
+-}
+-
+-scoped_refptr<media::VideoDecoder> MediaStreamImpl::GetVideoDecoder(
+-    const GURL& url,
+-    media::MessageLoopFactory* message_loop_factory) {
+-  return NULL;
+-}
+-
+-void MediaStreamImpl::OnStreamGenerated(
+-    int request_id,
+-    const std::string& label,
+-    const media_stream::StreamDeviceInfoArray& audio_array,
+-    const media_stream::StreamDeviceInfoArray& video_array) {
+-}
+-
+-void MediaStreamImpl::OnStreamGenerationFailed(int request_id) {}
+-
+-void MediaStreamImpl::OnVideoDeviceFailed(const std::string& label,
+-                                          int index) {
+-}
+-
+-void MediaStreamImpl::OnAudioDeviceFailed(const std::string& label,
+-                                          int index) {
+-}
+-
+-void MediaStreamImpl::OnDevicesEnumerated(
+-    int request_id,
+-    const media_stream::StreamDeviceInfoArray& device_array) {
+-}
+-
+-void MediaStreamImpl::OnDevicesEnumerationFailed(int request_id) {}
+-
+-void MediaStreamImpl::OnDeviceOpened(
+-    int request_id,
+-    const std::string& label,
+-    const media_stream::StreamDeviceInfo& video_device) {
+-}
+-
+-void MediaStreamImpl::OnDeviceOpenFailed(int request_id) {}
+diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
+index 31f47e1..639ff84 100644
+--- a/content/renderer/render_view_impl.cc
++++ b/content/renderer/render_view_impl.cc
+@@ -504,8 +504,10 @@ RenderViewImpl::RenderViewImpl(
+     p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this);
+ #endif
+ 
++#if defined(ENABLE_WEBRTC)
+   if (!media_stream_dispatcher_)
+     media_stream_dispatcher_ = new MediaStreamDispatcher(this);
++#endif
+ 
+   new MHTMLGenerator(this);
+ #if defined(OS_MACOSX)
+@@ -622,6 +624,8 @@ WebKit::WebPeerConnectionHandler* RenderViewImpl::CreatePeerConnectionHandler(
+   if (!cmd_line->HasSwitch(switches::kEnableMediaStream))
+     return NULL;
+   EnsureMediaStreamImpl();
++  if (!media_stream_impl_.get())
++    return NULL;
+   return media_stream_impl_->CreatePeerConnectionHandler(client);
+ }
+ 
+@@ -3146,6 +3150,7 @@ void RenderViewImpl::EnsureMediaStreamImpl() {
+     p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this);
+ #endif
+ 
++#if defined(ENABLE_WEBRTC)
+   if (!media_stream_dispatcher_)
+     media_stream_dispatcher_ = new MediaStreamDispatcher(this);
+ 
+@@ -3157,6 +3162,7 @@ void RenderViewImpl::EnsureMediaStreamImpl() {
+         RenderThreadImpl::current()->video_capture_impl_manager(),
+         factory);
+   }
++#endif
+ }
+ 
+ void RenderViewImpl::didChangeContentsSize(WebFrame* frame,
+-- 
+1.7.10
+
diff --git a/debian/patches/series b/debian/patches/series
index 029b00c..dca00fc 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -23,3 +23,6 @@ arm-no-float-abi.patch
 vpx.patch
 pulseaudio.patch
 glib.patch
+0001-this-transposition-is-neccisary-to-build-on-arm-v7.patch
+0002-backport-webrtc-disable.patch
+0003-backport-webrtc-disable.patch
diff --git a/debian/rules b/debian/rules
index 0b760eb..92ce391 100755
--- a/debian/rules
+++ b/debian/rules
@@ -383,6 +383,8 @@ endif
 # use system v8
 ifeq (1,$(USE_SYSTEM_V8))
 GYP_DEFINES += \
+        use_system_v8=1 \
+        want_separate_host_toolset=0 \
 	javascript_engine=v8 \
 	$(NULL)
 endif
-- 
1.7.10

