ninja&make/mac: Give loadable_modules type MH_BUNDLE.

BUG=chromium:280718
R=mark@chromium.org, mmoss@chromium.org

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1716 78cadc50-ecff-11dd-a971-7dbc132099af
Prevent propagation of shared_library's link_settings

The LinkDependencies function was used in two places:
1) determining targets whose link_settings should be merged into a
   linkable target (in DoDependentSettings)
2) determining targets that generate static libraries that need to be linked
   into a linkable target (in AdjustStaticLibraryDependencies)

For case 1), we should not include shared_library targets, because they are
fully linked.  For case 2), we should include shared_library targets because
they generate the import static library.

This patch adds two new functions to handle both these cases, and changes
LinkDependencies to be an internal implementation detail of these two new
functions.

A new test has been added that verifies link_settings are not propagated
outside the shared_library.

BUG=gyp:108
R=mark@chromium.org

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1717 78cadc50-ecff-11dd-a971-7dbc132099af
ninja&make/mac: Fix .strings encoding regression from r1707.

Python's decode() function doesn't remove the BOM when decoding 'UTF-16LE' and
'UTF-16BE', so gyp-mac-tool ended up writing two BOMs: The correct BOM, and then
the BOM from the input file.  Fix, add test.

BUG=chromium:280718
R=mark@chromium.org, rsesek@chromium.org

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1718 78cadc50-ecff-11dd-a971-7dbc132099af
ninja: Don't write subninjas for ninja files that end up being empty.

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



git-svn-id: http://gyp.googlecode.com/svn/trunk@1719 78cadc50-ecff-11dd-a971-7dbc132099af
Remove link_languages. It was only ever supported by the SCons generator,
which is long gone.

R=thakis@chromium.org

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1720 78cadc50-ecff-11dd-a971-7dbc132099af
ninja/posix: Don't link c-file-only targets to libstdc++.

The most important part of this change is that LINK will now default to what
is set for CXX (in make) or what is set for CC (in ninja). In ninja, there's
now an additional LINKXX that's set to what CXX is set to, and in ninja
LINKXX is only used to link targets that contain at least one C++ source
file.

Also change several make_global_settings behaviors:

1. The ninja generator was using LD and LD.host for make_global_settings, while
   the make generator uses LINK and LINK.host. Chromium's common.gypi only
   sets the latter, so it looks like this code isn't needed. Removed support
   for setting LD and LD.host via make_global_settings in ninja. (In practice,
   this was alway set to the same thing as CC / CXX anyhow.)
2. The same is done for the environment variables in ninja. Again, as the
   linker now just uses what's set via CC / CXX, this shouldn't be an issue
   in practice.
3. Change the make generator to look at the LINK envvar instead of LD,
   for consistency with its make_global_settings key and with what
   `make -p` prints.

(If setting a linker that's different from CC / CXX is needed later on, this
is easy to add back.)

(Make doesn't have explicit support for setting LINK, make_global_settings
allows changing arbitrary make variables there. But due to the defaults change,
setting LINK is no longer required in make either.)

BUG=chromium:280718
R=scottmg@chromium.org

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1721 78cadc50-ecff-11dd-a971-7dbc132099af
Add a flag to enable the fix for r1717

It seems like Chrome (and potentially other projects using gyp) depend on the
bug that was fixed in r1717.  So for now, only enable the fix if the target has
'allow_sharedlib_linksettings_propagation' explicitly set to False (by default,
it is True).

This will allow Chrome and other projects to continue building until they are
fixed to not depend on this bug, at which point, we could remove the flag.

BUG=
R=mark@chromium.org

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1722 78cadc50-ecff-11dd-a971-7dbc132099af
Add ninja generator flag for writing library deps.

This adds a flag to the ninja generator to specify a file to write library
deps to as generation proceeds. This is so GN can suck the deps out.

BUG=288991
Review=https://codereview.chromium.org/23601020/


git-svn-id: http://gyp.googlecode.com/svn/trunk@1723 78cadc50-ecff-11dd-a971-7dbc132099af
Add cpu_limit to ninja link pool on windows.

This will cap the number of links at the min of cpu_count v. mem / 4G.

R=scottmg@chromium.org

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1724 78cadc50-ecff-11dd-a971-7dbc132099af
ninja windows: VS2013 improvements

- Use vs2013 x64->x86 cross compiler if available
- Add /FS compiler flag which maintains previous version PDB behavior.

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

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1725 78cadc50-ecff-11dd-a971-7dbc132099af
ninja/mac: Try to fix 'IOError: [Errno 2] No such file or directory' error.

Happening on this Blink bot:
http://chromegw.corp.google.com/i/chromium.webkit/builders/WebKit%20Mac%20Builder%20%28dbg%29

This probably broke when we changed the generator to write ninja files after
their contents are known -- because of that the folder doesn't exist yet
when the per-arch files are written.

R=scottmg@chromium.org

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1726 78cadc50-ecff-11dd-a971-7dbc132099af
Add an environment variable to specify the hard cap on the number of concurrent linkers in gyp/ninja/windows.

The core count was a poor abstraction of this. Since we can't easily+accurately model the bottleneck, expose the cap as an environment variable so we can tweak it on the bots as necessary.

The default hard cap is 2**32. I'm assuming that we'll never need that many concurrent links.

R=thakis@chromium.org

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1727 78cadc50-ecff-11dd-a971-7dbc132099af
The old _escaped regex matched any characters not in range from space to
tilde, i.e. from \x20 to \x7e. Therefore it matched all non-ASCII characters,
despite this comment in _EncodeString: "Characters above the ASCII range are
passed through to the output encoded as UTF-8 without any escaping."

This changes the regex to match the same set of ASCII control characters as
before, without matching characters outside the ASCII range.

Patch by Kenneth Bongort <kbongort@google.com>
Review URL: https://codereview.chromium.org/23892016/


git-svn-id: http://gyp.googlecode.com/svn/trunk@1728 78cadc50-ecff-11dd-a971-7dbc132099af
Empty bundle change was missing some non empty mac bundles. 

Check link_deps and mac_bundle_depends earlier.

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


git-svn-id: http://gyp.googlecode.com/svn/trunk@1729 78cadc50-ecff-11dd-a971-7dbc132099af
ninja&make/mac: Only pass -x to strip for loadable_modules.

I misinterpreted what "Bundle products" meant in the "Default value" row
for STRIP_STYLE on
https://developer.apple.com/library/mac/documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW153

BUG=280718
R=mark@chromium.org

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1730 78cadc50-ecff-11dd-a971-7dbc132099af
ninja: Add .a files in a deterministic order to link lines.

The order even happens to match the one Xcode chooses.

BUG=280718
R=scottmg@chromium.org

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1731 78cadc50-ecff-11dd-a971-7dbc132099af
ninja: Put generated sources in front of regular sources.

This matches the behavior of the xcode generator.  As sources are generated by
actions and rules which run before the regular compile phase of a target, this
is a bit more intuitive and so I changed the ninja generator instead of the
xcode generator.

BUG=chromium:280718
R=scottmg@chromium.org

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1732 78cadc50-ecff-11dd-a971-7dbc132099af
ninja&make/mac: Support :identifier, :rfc1034identifier suffices.

BUG=280718
R=rsesek@chromium.org

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1733 78cadc50-ecff-11dd-a971-7dbc132099af
ninja/mac: Insert a few synthesized Info.plist entries.

Namely, insert BuildMachineOSBuild, DTSDKName, DTSDKBuild, DTXcode, DTXcodeBuild

The values for the synthesized keys are collected at gyp time. The logic for
this is in XcodeEmulation, which makes it add support for this to the make
generator too if someone feels motivated.

The `mac_tool copy-info-plist` command grows support for an arbitrary number
of [key value] arguments, and these values blindly overwrite potential
existing entries from the plist file (this matches Xcode).

BUG=280718
R=scottmg@chromium.org

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

git-svn-id: http://gyp.googlecode.com/svn/trunk@1734 78cadc50-ecff-11dd-a971-7dbc132099af
Actually attach the pool to the link rules on windows.

R=thakis@chromium.org

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

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