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

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

Issue 11031005: Add "standalone_static_library" flag (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 3 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
Index: pylib/gyp/generator/ninja.py
===================================================================
--- pylib/gyp/generator/ninja.py (revision 1508)
+++ pylib/gyp/generator/ninja.py (working copy)
@@ -160,7 +160,8 @@
def Linkable(self):
"""Return true if this is a target that can be linked against."""
- return self.type in ('static_library', 'shared_library')
+ return self.type in ('static_library', 'shared_library',
+ 'standalone_static_library')
def UsesToc(self, flavor):
"""Return true if the target should produce a restat rule based on a TOC
@@ -434,7 +435,8 @@
link_deps += [self.GypPathToNinja(f)
for f in sources if f.endswith(self.obj_ext)]
- if self.flavor == 'win' and self.target.type == 'static_library':
+ if self.flavor == 'win' and self.target.type in ('static_library',
+ 'standalone_static_library'):
self.target.component_objs = link_deps
# Write out a link step, if needed.
@@ -954,6 +956,23 @@
self.xcode_settings.GetLibtoolflags(config_name)))
self.ninja.build(self.target.binary, 'alink', link_deps,
order_only=compile_deps, variables=variables)
+ elif spec['type'] == 'standalone_static_library':
+ self.target.binary = self.ComputeOutput(spec)
+ variables = []
+ postbuild = self.GetPostbuildCommand(
+ spec, self.target.binary, self.target.binary)
+ if postbuild:
+ variables.append(('postbuilds', postbuild))
+ if self.xcode_settings:
+ variables.append(('libtool_flags',
+ self.xcode_settings.GetLibtoolflags(config_name)))
+ if self.flavor != 'mac' and self.flavor != 'win':
+ self.ninja.rule(
+ 'alink',
+ description='AR $out',
+ command='rm -f $out && $ar rcs $out $in')
+ self.ninja.build(self.target.binary, 'alink', link_deps,
+ order_only=compile_deps, variables=variables)
else:
self.WriteLink(spec, config_name, config, link_deps)
return self.target.binary
@@ -1070,6 +1089,7 @@
'loadable_module': default_variables['SHARED_LIB_PREFIX'],
'shared_library': default_variables['SHARED_LIB_PREFIX'],
'static_library': default_variables['STATIC_LIB_PREFIX'],
+ 'standalone_static_library': default_variables['STATIC_LIB_PREFIX'],
'executable': default_variables['EXECUTABLE_PREFIX'],
}
prefix = spec.get('product_prefix', DEFAULT_PREFIX.get(type, ''))
@@ -1080,6 +1100,7 @@
'loadable_module': default_variables['SHARED_LIB_SUFFIX'],
'shared_library': default_variables['SHARED_LIB_SUFFIX'],
'static_library': default_variables['STATIC_LIB_SUFFIX'],
+ 'standalone_static_library': default_variables['STATIC_LIB_SUFFIX'],
'executable': default_variables['EXECUTABLE_SUFFIX'],
}
extension = spec.get('product_extension')
@@ -1098,8 +1119,8 @@
# Snip out an extra 'lib' from libs if appropriate.
target = StripPrefix(target, 'lib')
- if type in ('static_library', 'loadable_module', 'shared_library',
- 'executable'):
+ if type in ('executable', 'loadable_module', 'shared_library',
+ 'static_library', 'standalone_static_library'):
return '%s%s%s' % (prefix, target, extension)
elif type == 'none':
return '%s.stamp' % target
@@ -1120,7 +1141,8 @@
return override
if self.flavor == 'mac' and type in (
- 'static_library', 'executable', 'shared_library', 'loadable_module'):
+ 'executable', 'loadable_module', 'shared_library', 'static_library',
+ 'standalone_static_library'):
filename = self.xcode_settings.GetExecutablePath()
else:
filename = self.ComputeOutputFileName(spec, type)
@@ -1131,7 +1153,8 @@
# Some products go into the output root, libraries go into shared library
# dir, and everything else goes into the normal place.
- type_in_output_root = ['executable', 'loadable_module']
+ type_in_output_root = ['executable', 'loadable_module',
+ 'standalone_static_library']
if self.flavor == 'mac' and self.toolset == 'target':
type_in_output_root += ['shared_library', 'static_library']
elif self.flavor == 'win' and self.toolset == 'target':

Powered by Google App Engine
This is Rietveld 408576698