android: Add support for multiarch builds.

The android build system supports 32/64 bit multiarch builds; add
support for this in the android gyp backend. This requires that you run
gyp twice to generate one complete set of makefiles for each
architecture, and then include both into your toplevel Android.mk with
code like:

GYP_VAR_PREFIX :=
include GypAndroid.$(TARGET_ARCH).mk
GYP_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
include GypAndroid.$(TARGET_2ND_ARCH).mk

Changes made in this CL:

1) Set GYP_VAR_PREFIX to the empty string by default (which indicates
building for the primary architecture), to maintain compatibility with
non-multiarch builds.

2) Set LOCAL_MODULE_TARGET_ARCH to indicate that we should only build
the current module for whichever architecture is indicated by
GYP_VAR_PREFIX. This will take effect for target static and dynamic
libraries, and for executables.

3) Set LOCAL_2ND_ARCH_VAR_PREFIX when including base_rules.mk directly
for "none" type targets, since the processing logic for
LOCAL_MODULE_TARGET_ARCH isn't applied by the build system in this case.

3) Pass GYP_VAR_PREFIX when calling local-intermediates-dir or
intermediates-dir-for, and use it when referring to
TARGET_OUT_INTERMEDIATE_LIBARIES, so that we get the correct
intermediate directories.

4) Rename all host targets to include the current target architecture,
so that they will be built separately once per target. Not all host
targets actually need to be built twice, but we can't easily tell which
do. There aren't many in total, so this shouldn't be too expensive.

BUG=chromium:358141
R=thakis@chromium.org

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1887 78cadc50-ecff-11dd-a971-7dbc132099af
Adds xcode-ninja flavor for Xcode wrapper projects.

Xcode has great development and debugging tools, but runs slowly with very
large projects.  Ninja does processes build files very quickly.  This -ninja
flavor bridges the gap by building each executable target with ninja, while
loading all the sources and bundle resources into an Xcode project.

Adds three new generator_flags:
 - xcode_ninja_main_gyp: Path to main wrapper workspace.  Otherwise the main
    gyp path will be used with .ninja prepended to the extension.
 - xcode_ninja_target_filter: Regex filter to remove some targets.  Removing
    rarely used seems to make Xcode much faster.
 - xcode_ninja_jobs: Number of jobs to pass to ninja, defaults to 0.

BUG=
TEST=
R=mark@chromium.org, sdefresne@chromium.org

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1889 78cadc50-ecff-11dd-a971-7dbc132099af
Avoid duplicating non-configuration settings when merging configurations

When one configuration inherits from another, we should merge the
configurations before merging the default settings into the configuration.
Otherwise, the more concrete configuration will end up with all default
settings twice

BUG=none
R=mark@chromium.org, thakis@chromium.org

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1891 78cadc50-ecff-11dd-a971-7dbc132099af
Revert "Fix None target type with Ninja build."

This reverts r1883, which seems to be causing gyp-win32 bot failures on
test\ninja\solibs_avoid_relinking\gyptest-solibs-avoid-relinking.py and
test\win\gyptest-link-restat-importlib.py.

BUG=
TBR=etienneb@chromium.org,scottmg@chromium.org

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1892 78cadc50-ecff-11dd-a971-7dbc132099af
Use context manager to manage OS environment in tests

Currently tests use manual context management (try: ... finally: ...)
This is cleaner and more robust with a context manager:
https://docs.python.org/2/library/contextlib.html

Also fixes some bugs and typos.

Tests are:
test/cflags/gyptest-cflags.py (make + ninja)
test/cxxflags/gyptest-cxxflags.py (ninja)

R=thakis
TEST=PYTHONPATH=$CHROMIUM_DIR/tools/gyp/test/lib TESTGYP_FORMAT=make test/cflags/gyptest-cflags.py
TEST=PYTHONPATH=$CHROMIUM_DIR/tools/gyp/test/lib TESTGYP_FORMAT=ninja test/cflags/gyptest-cflags.py
TEST=PYTHONPATH=$CHROMIUM_DIR/tools/gyp/test/lib TESTGYP_FORMAT=ninja test/cxxflags/gyptest-cxxflags.py

Review URL: https://codereview.chromium.org/228323002/
Patch from Nils Barth <nbarth@chromium.org>!


git-svn-id: http://gyp.googlecode.com/svn/trunk@1893 78cadc50-ecff-11dd-a971-7dbc132099af
Add MASM settings support to msvs_settings.

The 'UseSafeExceptionHandlers' setting, if set to 'true', passes the
/safeseh option to ml.exe.

Without it, linking fails with error messages like this:

[182/259] LINK_EMBED(DLL) crnss.dll
FAILED: C:\python_27_amd64\files\python.exe gyp-win-tool link-with-manifests env
ironment.x86 True crnss.dll "C:\python_27_amd64\files\python.exe gyp-win-tool li
nk-wrapper environment.x86 False link.exe /nologo /IMPLIB:crnss.dll.lib /DLL /OU
T:crnss.dll @crnss.dll.rsp" 2 mt.exe rc.exe "obj\third_party\nss\nss.crnss.dll.i
ntermediate.manifest" obj\third_party\nss\nss.crnss.dll.generated.manifest
nss_static.lib(nss_static.intel-aes-x86-masm_asm.obj) : error LNK2026: module un
safe for SAFESEH image.
nss_static.lib(nss_static.intel-gcm-x86-masm_asm.obj) : error LNK2026: module un
safe for SAFESEH image.
crnss.dll : fatal error LNK1281: Unable to generate SAFESEH image.

Add the ImageHasSafeExceptionHandlers setting support for VCLinkerTool. If set
to 'true', it is mapped to the /SAFESEH linker option.

R=scottmg@chromium.org
BUG=none

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1894 78cadc50-ecff-11dd-a971-7dbc132099af
Make test/cxxflags use a user define instead of __OPTIMIZE__

__OPTIMIZE__ is a gcc-specific define, so this was broken on Windows
after https://code.google.com/p/gyp/source/detail?r=1893.

R=thakis@chromium.org

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

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