GN: Implement BUILD.gn for common_video.

This adds copying of Chromium's third_party/BUILD.gn
to acommondate libyuv's BUILD.gn that imports the 'jpeg'
config from that file.

BUG=3441
TEST=trybots + local compile passing with:
gn gen out/Default --args="build_with_chromium=false" && ninja -C out/Default
gn gen out/Default --args="build_with_chromium=false build_libyuv=false" && ninja -C out/Default

R=niklas.enbom@webrtc.org, pbos@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/14839004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6595 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/.gitignore b/.gitignore
index 911aade..57808e3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,6 +55,8 @@
 /third_party/android_tools
 /third_party/asan
 /third_party/binutils
+/third_party/build_gn
+/third_party/BUILD.gn
 /third_party/clang_format
 /third_party/colorama
 /third_party/cygwin
diff --git a/DEPS b/DEPS
index 485affa..8629afb 100644
--- a/DEPS
+++ b/DEPS
@@ -48,6 +48,9 @@
   "third_party/binutils":
     Var("chromium_trunk") + "/src/third_party/binutils@" + Var("chromium_revision"),
 
+  "third_party/build_gn":
+    File(Var("chromium_trunk") + "/src/third_party/BUILD.gn@" + Var("chromium_revision")),
+
   "third_party/clang_format":
     Var("chromium_trunk") + "/src/third_party/clang_format@" + Var("chromium_revision"),
 
@@ -244,6 +247,14 @@
                Var("root_dir") + "/../chromium_gn/.gn",
                Var("root_dir")],
   },
+  {
+    # Copy BUILD.gn from temporary place (third_party/build_gn) to third_party.
+    "name": "copy third_party/BUILD.gn",
+    "pattern": ".",
+    "action": ["python", Var("root_dir") + "/build/cp.py",
+               Var("root_dir") + "/third_party/build_gn/BUILD.gn",
+               Var("root_dir") + "/third_party"],
+  },
   # Pull GN binaries. This needs to be before running GYP below.
   {
     "name": "gn_win",
diff --git a/webrtc/build/webrtc.gni b/webrtc/build/webrtc.gni
index 409ae1d..281047a 100644
--- a/webrtc/build/webrtc.gni
+++ b/webrtc/build/webrtc.gni
@@ -32,10 +32,16 @@
   # which can be easily parsed for offline processing.
   enable_data_logging = false
 
-  build_libjpeg = true
   # Enables the use of protocol buffers for debug recordings.
   enable_protobuf = true
 
+  # Disable these to not build components which can be externally provided.
+  build_json = true
+  build_libjpeg = true
+  build_libyuv = true
+  build_libvpx = true
+  build_ssl = true
+
   # Disable by default.
   have_dbus_glib = false
 
diff --git a/webrtc/common_video/BUILD.gn b/webrtc/common_video/BUILD.gn
index 2e877e6..69915e3 100644
--- a/webrtc/common_video/BUILD.gn
+++ b/webrtc/common_video/BUILD.gn
@@ -8,6 +8,38 @@
 
 import("../build/webrtc.gni")
 
+config("common_video_config") {
+  include_dirs = [
+    "interface",
+    "libyuv/include",
+  ]
+}
+
 source_set("common_video") {
-  # TODO(pbos): Implement.
+  sources = [
+    "i420_video_frame.cc",
+    "interface/i420_video_frame.h",
+    "interface/native_handle.h",
+    "interface/texture_video_frame.h",
+    "libyuv/include/scaler.h",
+    "libyuv/include/webrtc_libyuv.h",
+    "libyuv/scaler.cc",
+    "libyuv/webrtc_libyuv.cc",
+    "plane.cc",
+    "plane.h",
+    "texture_video_frame.cc"
+  ]
+
+  include_dirs = [ "../modules/interface" ]
+
+  direct_dependent_configs = [ ":common_video_config" ]
+
+  deps = [ "../system_wrappers" ]
+
+  if (build_libyuv) {
+    deps += [ "//third_party/libyuv" ]
+  } else {
+    # Need to add a directory normally exported by libyuv.
+    include_dirs += [ "//third_party/libyuv/include" ]
+  }
 }