Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1049)

Unified Diff: pylib/gyp/generator/ninja.py

Issue 10795044: Support Mac android cross compile. Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« pylib/gyp/common.py ('K') | « pylib/gyp/generator/make.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pylib/gyp/generator/ninja.py
===================================================================
--- pylib/gyp/generator/ninja.py (revision 1475)
+++ pylib/gyp/generator/ninja.py (working copy)
@@ -217,7 +217,7 @@
class NinjaWriter:
def __init__(self, qualified_target, target_outputs, base_dir, build_dir,
- output_file, flavor, abs_build_dir=None):
+ output_file, flavor, options, abs_build_dir=None):
"""
base_dir: path from source root to directory containing this gyp file,
by gyp semantics, all input paths are relative to this
@@ -231,6 +231,7 @@
self.build_dir = build_dir
self.ninja = ninja_syntax.Writer(output_file)
self.flavor = flavor
+ self.options = options
self.abs_build_dir = abs_build_dir
self.obj_ext = '.obj' if flavor == 'win' else '.o'
if flavor == 'win':
@@ -1051,8 +1052,8 @@
type = spec['type']
default_variables = copy.copy(generator_default_variables)
- CalculateVariables(default_variables, {'flavor': self.flavor})
-
+ CalculateVariables(default_variables, {'flavor': self.flavor,
+ 'options': self.options })
# Compute filename prefix: the product prefix, or a default for
# the product type.
DEFAULT_PREFIX = {
@@ -1203,6 +1204,7 @@
global generator_additional_non_configuration_keys
global generator_additional_path_sections
flavor = gyp.common.GetFlavor(params)
+ default_variables.setdefault('HOST_OS', gyp.common.GetHostFlavor(params))
if flavor == 'mac':
default_variables.setdefault('OS', 'mac')
default_variables.setdefault('SHARED_LIB_SUFFIX', '.dylib')
@@ -1276,6 +1278,7 @@
config_name):
options = params['options']
flavor = gyp.common.GetFlavor(params)
+ host_flavor = gyp.common.GetHostFlavor(params)
generator_flags = params.get('generator_flags', {})
# build_dir: relative path from source root to our output files.
@@ -1290,7 +1293,7 @@
width=120)
# Put build-time support tools in out/{config_name}.
- gyp.common.CopyTool(flavor, toplevel_build)
+ gyp.common.CopyTool(host_flavor, toplevel_build)
# Grab make settings for CC/CXX.
# The rules are
@@ -1337,7 +1340,7 @@
ld_host = os.path.join(build_to_root, value)
flock = 'flock'
- if flavor == 'mac':
+ if host_flavor == 'mac':
flock = './gyp-mac-tool flock'
cc = GetEnvironFallback(['CC_target', 'CC'], cc)
master_ninja.variable('cc', cc)
@@ -1380,7 +1383,7 @@
else:
master_ninja.variable('ld_host', flock + ' linker.lock ' + ld_host)
- if flavor == 'mac':
+ if host_flavor == 'mac':
master_ninja.variable('mac_tool', os.path.join('.', 'gyp-mac-tool'))
master_ninja.newline()
@@ -1605,14 +1608,17 @@
command=('$cc -E -P -Wno-trigraphs -x c $defines $in -o $out && '
'plutil -convert xml1 $out $out'))
master_ninja.rule(
- 'mac_tool',
- description='MACTOOL $mactool_cmd $in',
- command='$env $mac_tool $mactool_cmd $in $out')
- master_ninja.rule(
'package_framework',
description='PACKAGE FRAMEWORK $out, POSTBUILDS',
command='$mac_tool package-framework $out $version$postbuilds '
'&& touch $out')
+
+ if host_flavor == 'mac':
+ master_ninja.rule(
+ 'mac_tool',
+ description='MACTOOL $mactool_cmd $in',
+ command='$env $mac_tool $mactool_cmd $in $out')
+
if flavor == 'win':
master_ninja.rule(
'stamp',
@@ -1670,7 +1676,7 @@
abs_build_dir = os.path.abspath(toplevel_build)
writer = NinjaWriter(qualified_target, target_outputs, base_path, build_dir,
OpenOutput(os.path.join(toplevel_build, output_file)),
- flavor, abs_build_dir=abs_build_dir)
+ flavor, options, abs_build_dir=abs_build_dir)
master_ninja.subninja(output_file)
target = writer.WriteSpec(spec, config_name, generator_flags)
« pylib/gyp/common.py ('K') | « pylib/gyp/generator/make.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698