gyp: upgrade to r1081
This commit is contained in:
parent
9b2335a356
commit
3c3ec7b2d7
@ -62,7 +62,14 @@ generator_wants_sorted_dependencies = False
|
||||
|
||||
def GetFlavor(params):
|
||||
"""Returns |params.flavor| if it's set, the system's default flavor else."""
|
||||
return params.get('flavor', 'mac' if sys.platform == 'darwin' else 'linux')
|
||||
flavors = {
|
||||
'darwin': 'mac',
|
||||
'sunos5': 'solaris',
|
||||
'freebsd7': 'freebsd',
|
||||
'freebsd8': 'freebsd',
|
||||
}
|
||||
flavor = flavors.get(sys.platform, 'linux')
|
||||
return params.get('flavor', flavor)
|
||||
|
||||
|
||||
def CalculateVariables(default_variables, params):
|
||||
@ -71,7 +78,8 @@ def CalculateVariables(default_variables, params):
|
||||
default_variables['LINKER_SUPPORTS_ICF'] = \
|
||||
gyp.system_test.TestLinkerSupportsICF(cc_command=cc_target)
|
||||
|
||||
if GetFlavor(params) == 'mac':
|
||||
flavor = GetFlavor(params)
|
||||
if flavor == 'mac':
|
||||
default_variables.setdefault('OS', 'mac')
|
||||
default_variables.setdefault('SHARED_LIB_SUFFIX', '.dylib')
|
||||
default_variables.setdefault('SHARED_LIB_DIR',
|
||||
@ -94,7 +102,10 @@ def CalculateVariables(default_variables, params):
|
||||
global COMPILABLE_EXTENSIONS
|
||||
COMPILABLE_EXTENSIONS.update({'.m': 'objc', '.mm' : 'objcxx'})
|
||||
else:
|
||||
default_variables.setdefault('OS', 'linux')
|
||||
operating_system = flavor
|
||||
if flavor == 'android':
|
||||
operating_system = 'linux' # Keep this legacy behavior for now.
|
||||
default_variables.setdefault('OS', operating_system)
|
||||
default_variables.setdefault('SHARED_LIB_SUFFIX', '.so')
|
||||
default_variables.setdefault('SHARED_LIB_DIR','$(builddir)/lib.$(TOOLSET)')
|
||||
default_variables.setdefault('LIB_DIR', '$(obj).$(TOOLSET)')
|
||||
@ -349,7 +360,7 @@ cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $
|
||||
|
||||
quiet_cmd_cxx = CXX($(TOOLSET)) $@
|
||||
cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
|
||||
%(mac_commands)s
|
||||
%(extra_commands)s
|
||||
quiet_cmd_touch = TOUCH $@
|
||||
cmd_touch = touch $@
|
||||
|
||||
@ -480,6 +491,14 @@ quiet_cmd_mac_package_framework = PACKAGE FRAMEWORK $@
|
||||
cmd_mac_package_framework = ./gyp-mac-tool package-framework "$@" $(4)
|
||||
"""
|
||||
|
||||
SHARED_HEADER_SUN_COMMANDS = """
|
||||
# gyp-sun-tool is written next to the root Makefile by gyp.
|
||||
# Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd
|
||||
# already.
|
||||
quiet_cmd_sun_tool = SUNTOOL $(4) $<
|
||||
cmd_sun_tool = ./gyp-sun-tool $(4) $< "$@"
|
||||
"""
|
||||
|
||||
|
||||
def WriteRootHeaderSuffixRules(writer):
|
||||
extensions = sorted(COMPILABLE_EXTENSIONS.keys(), key=str.lower)
|
||||
@ -2407,11 +2426,13 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD
|
||||
env['UNLOCALIZED_RESOURCES_FOLDER_PATH'] = \
|
||||
self.xcode_settings.GetBundleResourceFolder()
|
||||
env['INFOPLIST_PATH'] = self.xcode_settings.GetBundlePlistPath()
|
||||
env['WRAPPER_NAME'] = self.xcode_settings.GetWrapperName()
|
||||
|
||||
# TODO(thakis): Remove this.
|
||||
env['EXECUTABLE_PATH'] = QuoteSpaces(env['EXECUTABLE_PATH'])
|
||||
env['CONTENTS_FOLDER_PATH'] = QuoteSpaces(env['CONTENTS_FOLDER_PATH'])
|
||||
env['INFOPLIST_PATH'] = QuoteSpaces(env['INFOPLIST_PATH'])
|
||||
env['WRAPPER_NAME'] = QuoteSpaces(env['WRAPPER_NAME'])
|
||||
|
||||
return env
|
||||
|
||||
@ -2576,17 +2597,32 @@ def RunSystemTests(flavor):
|
||||
'LINK_flags': link_flags }
|
||||
|
||||
|
||||
def CopyMacTool(out_path):
|
||||
"""Finds mac_tool.gyp in the gyp directory and copies it to |out_path|."""
|
||||
def CopyTool(flavor, out_path):
|
||||
"""Finds (mac|sun)_tool.gyp in the gyp directory and copies it
|
||||
to |out_path|."""
|
||||
prefix = { 'solaris': 'sun', 'mac': 'mac' }.get(flavor, None)
|
||||
if not prefix:
|
||||
return
|
||||
|
||||
tool_path = os.path.join(out_path, 'gyp-%s-tool' % prefix)
|
||||
if os.path.exists(tool_path):
|
||||
os.remove(tool_path)
|
||||
|
||||
# Slurp input file.
|
||||
source_path = os.path.join(
|
||||
os.path.dirname(os.path.abspath(__file__)), '..', 'mac_tool.py')
|
||||
os.path.dirname(os.path.abspath(__file__)), '..', '%s_tool.py' % prefix)
|
||||
source_file = open(source_path)
|
||||
source = source_file.readlines()
|
||||
source_file.close()
|
||||
mactool_file = open(out_path, 'w')
|
||||
mactool_file.write(
|
||||
|
||||
# Add header and write it out.
|
||||
tool_file = open(tool_path, 'w')
|
||||
tool_file.write(
|
||||
''.join([source[0], '# Generated by gyp. Do not edit.\n'] + source[1:]))
|
||||
mactool_file.close()
|
||||
tool_file.close()
|
||||
|
||||
# Make file executable.
|
||||
os.chmod(tool_path, 0755)
|
||||
|
||||
|
||||
def GenerateOutput(target_list, target_dicts, data, params):
|
||||
@ -2641,7 +2677,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
|
||||
'flock': flock_command,
|
||||
'flock_index': 1,
|
||||
'link_commands': LINK_COMMANDS_LINUX,
|
||||
'mac_commands': '',
|
||||
'extra_commands': '',
|
||||
'srcdir': srcdir,
|
||||
}
|
||||
if flavor == 'mac':
|
||||
@ -2650,12 +2686,22 @@ def GenerateOutput(target_list, target_dicts, data, params):
|
||||
'flock': flock_command,
|
||||
'flock_index': 2,
|
||||
'link_commands': LINK_COMMANDS_MAC,
|
||||
'mac_commands': SHARED_HEADER_MAC_COMMANDS,
|
||||
'extra_commands': SHARED_HEADER_MAC_COMMANDS,
|
||||
})
|
||||
if flavor == 'android':
|
||||
elif flavor == 'android':
|
||||
header_params.update({
|
||||
'link_commands': LINK_COMMANDS_ANDROID,
|
||||
})
|
||||
elif flavor == 'solaris':
|
||||
header_params.update({
|
||||
'flock': './gyp-sun-tool flock',
|
||||
'flock_index': 2,
|
||||
'extra_commands': SHARED_HEADER_SUN_COMMANDS,
|
||||
})
|
||||
elif flavor == 'freebsd':
|
||||
header_params.update({
|
||||
'flock': 'lockf',
|
||||
})
|
||||
header_params.update(RunSystemTests(flavor))
|
||||
|
||||
build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0])
|
||||
@ -2693,13 +2739,8 @@ def GenerateOutput(target_list, target_dicts, data, params):
|
||||
WriteRootHeaderSuffixRules(root_makefile)
|
||||
|
||||
# Put mac_tool next to the root Makefile.
|
||||
if flavor == 'mac':
|
||||
mactool_path = os.path.join(os.path.dirname(makefile_path), 'gyp-mac-tool')
|
||||
if os.path.exists(mactool_path):
|
||||
os.remove(mactool_path)
|
||||
CopyMacTool(mactool_path)
|
||||
# Make file executable.
|
||||
os.chmod(mactool_path, 0755)
|
||||
dest_path = os.path.dirname(makefile_path)
|
||||
CopyTool(flavor, dest_path)
|
||||
|
||||
# Find the list of targets that derive from the gyp file(s) being built.
|
||||
needed_targets = set()
|
||||
|
@ -3,7 +3,8 @@
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""These functions are executed via gyp-sun-tool when using the Makefile generator."""
|
||||
"""These functions are executed via gyp-sun-tool when using the Makefile
|
||||
generator."""
|
||||
|
||||
import fcntl
|
||||
import os
|
||||
@ -38,7 +39,55 @@ class SunTool(object):
|
||||
# where fcntl.flock(fd, LOCK_EX) always fails
|
||||
# with EBADF, that's why we use this F_SETLK
|
||||
# hack instead.
|
||||
fd = os.open(lockfile, os.O_WRONLY|os.O_NOCTTY|os.O_CREAT, 0o666)
|
||||
fd = os.open(lockfile, os.O_WRONLY|os.O_NOCTTY|os.O_CREAT, 0666)
|
||||
op = struct.pack('hhllhhl', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0)
|
||||
fcntl.fcntl(fd, fcntl.F_SETLK, op)
|
||||
return subprocess.call(cmd_list)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv[1:]))
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2011 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""These functions are executed via gyp-sun-tool when using the Makefile
|
||||
generator."""
|
||||
|
||||
import fcntl
|
||||
import os
|
||||
import struct
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
def main(args):
|
||||
executor = SunTool()
|
||||
executor.Dispatch(args)
|
||||
|
||||
class SunTool(object):
|
||||
"""This class performs all the SunOS tooling steps. The methods can either be
|
||||
executed directly, or dispatched from an argument list."""
|
||||
|
||||
def Dispatch(self, args):
|
||||
"""Dispatches a string command to a method."""
|
||||
if len(args) < 1:
|
||||
raise Exception("Not enough arguments")
|
||||
|
||||
method = "Exec%s" % self._CommandifyName(args[0])
|
||||
getattr(self, method)(*args[1:])
|
||||
|
||||
def _CommandifyName(self, name_string):
|
||||
"""Transforms a tool name like copy-info-plist to CopyInfoPlist"""
|
||||
return name_string.title().replace('-', '')
|
||||
|
||||
def ExecFlock(self, lockfile, *cmd_list):
|
||||
"""Emulates the most basic behavior of Linux's flock(1)."""
|
||||
# Rely on exception handling to report errors.
|
||||
# Note that the stock python on SunOS has a bug
|
||||
# where fcntl.flock(fd, LOCK_EX) always fails
|
||||
# with EBADF, that's why we use this F_SETLK
|
||||
# hack instead.
|
||||
fd = os.open(lockfile, os.O_WRONLY|os.O_NOCTTY|os.O_CREAT, 0666)
|
||||
op = struct.pack('hhllhhl', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0)
|
||||
fcntl.fcntl(fd, fcntl.F_SETLK, op)
|
||||
return subprocess.call(cmd_list)
|
||||
|
Loading…
x
Reference in New Issue
Block a user