Move build/ to build_gyp/.

This CL moves the build/ files to build_gyp/ in anticipation of pulling in
Chromiums build/ directory.

The gyp_pdfium files have been duplicated into both places. Once the bots
are updated we'll remove the build/ versions.

BUG=pdfium:106

Review URL: https://codereview.chromium.org/1900913003
diff --git a/.gitignore b/.gitignore
index 45bcec5..ae54040 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,4 @@
-/build/Debug
-/build/Release
-/build/gyp
+/build_gyp/gyp
 /buildtools
 /out
 /testing/corpus
diff --git a/DEPS b/DEPS
index 265f452..d846d20 100644
--- a/DEPS
+++ b/DEPS
@@ -18,7 +18,7 @@
 }
 
 deps = {
-  "build/gyp":
+  "build_gyp/gyp":
     Var('chromium_git') + "/external/gyp",
 
   "buildtools":
@@ -68,7 +68,7 @@
     # A change to a .gyp, .gypi, or to GYP itself should run the generator.
     'name': 'gyp',
     'pattern': '.',
-    'action': ['python', 'pdfium/build/gyp_pdfium'],
+    'action': ['python', 'pdfium/build_gyp/gyp_pdfium'],
   },
   # Pull GN binaries. This needs to be before running GYP below.
   {
diff --git a/README.md b/README.md
index 24fc1f3..53e1b4b 100644
--- a/README.md
+++ b/README.md
@@ -38,8 +38,8 @@
 Most PDFium developers use Ninja, as does our [continuous build system]
 (http://build.chromium.org/p/client.pdfium/).
 
- * On Windows: `build\gyp_pdfium`
- * For all other platforms: `build/gyp_pdfium`
+ * On Windows: `build_gyp\gyp_pdfium`
+ * For all other platforms: `build_gyp/gyp_pdfium`
 
 The second option is to generate platform-specific build files, i.e. Makefiles
 on Linux, sln files on Windows, and xcodeproj files on Mac. To do so, set the
@@ -56,7 +56,7 @@
 To build without JavaScript, set `pdf_enable_v8=0 pdf_enable_xfa=0` before
 running `gyp_pdfium`. For example
 ```
-GYP_DEFINES='pdf_enable_v8=0 pdf_enable_xfa=0' build/gyp_pdfium
+GYP_DEFINES='pdf_enable_v8=0 pdf_enable_xfa=0' build_gyp/gyp_pdfium
 ```
 gives the smallest possible build configuration.
 
@@ -67,7 +67,7 @@
 `gomadir`. e.g.
 
 ```
-build/gyp_pdfium -D use_goma=1 -D gomadir=path/to/goma
+build_gyp/gyp_pdfium -D use_goma=1 -D gomadir=path/to/goma
 ```
 
 ## Building the code
@@ -79,8 +79,8 @@
 If you're not using Ninja, then building is platform-specific.
 
  * On Linux: `make pdfium_test`
- * On Mac: `open build/all.xcodeproj`
- * On Windows: open build\all.sln
+ * On Mac: `open build_gyp/all.xcodeproj`
+ * On Windows: open build_gyp\all.sln
 
 ## Running the sample program
 
diff --git a/build/gyp_pdfium b/build/gyp_pdfium
index fca2ca3..3dbbbee 100755
--- a/build/gyp_pdfium
+++ b/build/gyp_pdfium
@@ -14,7 +14,7 @@
 script_dir = os.path.dirname(os.path.realpath(__file__))
 pdfium_root = os.path.abspath(os.path.join(script_dir, os.pardir))
 
-sys.path.insert(0, os.path.join(pdfium_root, 'build', 'gyp', 'pylib'))
+sys.path.insert(0, os.path.join(pdfium_root, 'build_gyp', 'gyp', 'pylib'))
 import gyp
 
 
@@ -27,10 +27,10 @@
 
 def main():
   args = sys.argv[1:]
-  args.append(os.path.join(script_dir, 'all.gyp'))
+  args.append(os.path.join(pdfium_root, 'build_gyp', 'all.gyp'))
 
   args.append('-I')
-  args.append(os.path.join(pdfium_root, 'build', 'standalone.gypi'))
+  args.append(os.path.join(pdfium_root, 'build_gyp', 'standalone.gypi'))
 
   args.extend(['-D', 'gyp_output_dir=out'])
 
diff --git a/build/all.gyp b/build_gyp/all.gyp
similarity index 100%
rename from build/all.gyp
rename to build_gyp/all.gyp
diff --git a/build_gyp/gyp_pdfium b/build_gyp/gyp_pdfium
new file mode 100755
index 0000000..3dbbbee
--- /dev/null
+++ b/build_gyp/gyp_pdfium
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+#
+# Copyright 2014 PDFium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This script is wrapper for PDFium that adds some support for how GYP
+# is invoked by PDFium beyond what can be done in the gclient hooks.
+
+import os
+import platform
+import sys
+
+script_dir = os.path.dirname(os.path.realpath(__file__))
+pdfium_root = os.path.abspath(os.path.join(script_dir, os.pardir))
+
+sys.path.insert(0, os.path.join(pdfium_root, 'build_gyp', 'gyp', 'pylib'))
+import gyp
+
+
+def run_gyp(args):
+  rc = gyp.main(args)
+  if rc != 0:
+    print 'Error running GYP'
+    sys.exit(rc)
+
+
+def main():
+  args = sys.argv[1:]
+  args.append(os.path.join(pdfium_root, 'build_gyp', 'all.gyp'))
+
+  args.append('-I')
+  args.append(os.path.join(pdfium_root, 'build_gyp', 'standalone.gypi'))
+
+  args.extend(['-D', 'gyp_output_dir=out'])
+
+  # Set the GYP DEPTH variable to the root of the PDFium project.
+  args.append('--depth=' + os.path.relpath(pdfium_root))
+
+  # GYP does not default to ninja, but PDFium should.
+  if not os.environ.get('GYP_GENERATORS', ''):
+    print 'GYP_GENERATORS is not set, defaulting to ninja'
+    os.environ['GYP_GENERATORS'] = 'ninja'
+
+  print 'Updating projects from gyp files...'
+  sys.stdout.flush()
+
+  run_gyp(args)
+
+
+if __name__ == '__main__':
+  sys.exit(main())
diff --git a/build_gyp/gyp_pdfium.py b/build_gyp/gyp_pdfium.py
new file mode 100644
index 0000000..6831702
--- /dev/null
+++ b/build_gyp/gyp_pdfium.py
@@ -0,0 +1,8 @@
+# Copyright 2014 PDFium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+
+path = os.path.abspath(os.path.split(__file__)[0])
+execfile(os.path.join(path, 'gyp_pdfium'))
diff --git a/build/mac_find_sdk.py b/build_gyp/mac_find_sdk.py
similarity index 100%
rename from build/mac_find_sdk.py
rename to build_gyp/mac_find_sdk.py
diff --git a/build/set_clang_warning_flags.gypi b/build_gyp/set_clang_warning_flags.gypi
similarity index 100%
rename from build/set_clang_warning_flags.gypi
rename to build_gyp/set_clang_warning_flags.gypi
diff --git a/build/standalone.gypi b/build_gyp/standalone.gypi
similarity index 99%
rename from build/standalone.gypi
rename to build_gyp/standalone.gypi
index 925326b..7292947 100644
--- a/build/standalone.gypi
+++ b/build_gyp/standalone.gypi
@@ -454,7 +454,7 @@
         ],  # target_conditions
         'variables': {
           'mac_sdk_min': '10.10',
-          'mac_sdk%': '<!(python <(DEPTH)/build/mac_find_sdk.py <(mac_sdk_min))',
+          'mac_sdk%': '<!(python <(DEPTH)/build_gyp/mac_find_sdk.py <(mac_sdk_min))',
         },
         'xcode_settings': {
           'SDKROOT': 'macosx<(mac_sdk)',  # -isysroot