Improve ninja's Xcode emulation

When cloning the target dictionaries for "iphoneos", correctly filter
the ARCHS value to only include value that apply to the SDK (iphoneos
or iphonesimulator).

Take into consideration the VALID_ARCHS filter if defined and support
the $(ARCHS_STANDARD) and $(ARCHS_STANDARD_INCLUDING_64_BIT) defaults
from Xcode 5.0.

If ARCHS is not set (which is the default for most of the projects)
then result will be identical, but it can now be set to the macro
$(ARCHS_STANDARD_INCLUDING_64_BIT) to build correctly for arm64 and
armv7 with both ninja and Xcode (including xcodebuild).

Update test/ios/gyptest-archs.py to test build for both simulator
and device, with different configuration (no ARCHS and filter that
only keep 32-bit platforms, explicit ARCHS with filters for 32-bit
or 64-bit platforms, and explicit ARCHS with no filter). This breaks
the test with the "make" generator as its support for Xcode emulation
is inexistant.

BUG=http://crbug.com/339477
R=justincohen@chromium.org, mark@chromium.org, thakist@chromium.org

Review URL: https://codereview.chromium.org/138533006

git-svn-id: http://gyp.googlecode.com/svn/trunk@1850 78cadc50-ecff-11dd-a971-7dbc132099af
Use "formats" parameter to TestGyp to filter the format

BUG=None
R=mark@chromium.org

Review URL: https://codereview.chromium.org/159303003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1851 78cadc50-ecff-11dd-a971-7dbc132099af
Fix generation for ninja of multiarch executable targets

Chromium includes some targets that should only be compiled on
specific platform and end up with an empty 'sources' list. This
works when generating for a single architecture, but fails with
the following callstack when building for multiarch:

Traceback (most recent call last):
  File "./gyp/gyp_main.py", line 18, in <module>
    sys.exit(gyp.script_main())
  File "./gyp/pylib/gyp/__init__.py", line 534, in script_main
    return main(sys.argv[1:])
  File "./gyp/pylib/gyp/__init__.py", line 527, in main
    return gyp_main(args)
  File "./gyp/pylib/gyp/__init__.py", line 512, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "./gyp/pylib/gyp/generator/ninja.py", line 2160, in GenerateOutput
    config_name)
  File "./gyp/pylib/gyp/generator/ninja.py", line 2078, in GenerateOutputForConfig
    target = writer.WriteSpec(spec, config_name, generator_flags)
  File "./gyp/pylib/gyp/generator/ninja.py", line 488, in WriteSpec
    self.target.actions_stamp or actions_depends)
  File "./gyp/pylib/gyp/generator/ninja.py", line 1180, in WriteTarget
    self.target.binary = self.WriteLink(spec, config_name, config, link_deps)
  File "./gyp/pylib/gyp/generator/ninja.py", line 972, in WriteLink
    for arch in self.archs]
TypeError: list indices must be integers, not str

This is because |link_deps| must be a dictionary keying |arch| to
a list of link dependencies when building for multiarch, but if
'sources' is empty, |link_deps| keep its default value (empty list).

BUG=314720
R=justincohen@chromium.org, mark@chromium.org, justincohen, mark

Review URL: https://codereview.chromium.org/157583011

git-svn-id: http://gyp.googlecode.com/svn/trunk@1852 78cadc50-ecff-11dd-a971-7dbc132099af