[infra] Remove dependence on //third_party/gyp/pylib/gyp/mac_tool.py

This is a step toward removing //third_party/gyp

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2997103002 .
This commit is contained in:
Zach Anderson 2017-08-17 12:53:38 -07:00
parent 55612ef10c
commit 3e16939be7
2 changed files with 8 additions and 37 deletions

View file

@ -21,18 +21,13 @@ if (use_goma) {
goma_prefix = ""
}
# This will copy the gyp-mac-tool to the build directory. We pass in the source
# file of the win tool.
gyp_mac_tool_source =
rebase_path("//third_party/gyp/pylib/gyp/mac_tool.py", root_build_dir)
exec_script("setup_toolchain.py", [ gyp_mac_tool_source ])
# Shared toolchain definition. Invocations should set toolchain_os to set the
# build args in this definition.
template("mac_toolchain") {
toolchain(target_name) {
assert(defined(invoker.cc), "mac_toolchain() must specify a \"cc\" value")
assert(defined(invoker.cxx), "mac_toolchain() must specify a \"cxx\" value")
assert(defined(invoker.ar), "mac_toolchain() must specify an \"ar\" value")
assert(defined(invoker.ld), "mac_toolchain() must specify a \"ld\" value")
assert(defined(invoker.toolchain_cpu),
"mac_toolchain() must specify a \"toolchain_cpu\"")
@ -44,6 +39,7 @@ template("mac_toolchain") {
# these values in our scope.
cc = invoker.cc
cxx = invoker.cxx
ar = invoker.ar
ld = invoker.ld
# Make these apply to all tools below.
@ -113,8 +109,10 @@ template("mac_toolchain") {
}
tool("alink") {
command = "rm -f {{output}} && ./gyp-mac-tool filter-libtool libtool -static -o {{output}} {{inputs}}"
description = "LIBTOOL-STATIC {{output}}"
rspfile = "{{output}}.rsp"
command = "rm -f {{output}} && $ar rcs {{output}} @$rspfile"
description = "AR {{output}}"
rspfile_content = "{{inputs}}"
outputs = [
"{{target_out_dir}}/{{target_output_name}}{{output_extension}}",
]
@ -229,6 +227,7 @@ mac_toolchain("clang_x64") {
root_build_dir)
cc = "${goma_prefix}$prefix/clang"
cxx = "${goma_prefix}$prefix/clang++"
ar = "${prefix}/llvm-ar"
ld = cxx
strip = "strip"
is_clang = true
@ -243,6 +242,7 @@ mac_toolchain("clang_x86") {
root_build_dir)
cc = "${goma_prefix}$prefix/clang"
cxx = "${goma_prefix}$prefix/clang++"
ar = "${prefix}/llvm-ar"
ld = cxx
strip = "strip"
is_clang = true

View file

@ -1,29 +0,0 @@
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import stat
import sys
def CopyTool(source_path):
"""Copies the given tool to the current directory, including a warning not
to edit it."""
with open(source_path) as source_file:
tool_source = source_file.readlines()
# Add header and write it out to the current directory (which should be the
# root build dir).
out_path = 'gyp-mac-tool'
with open(out_path, 'w') as tool_file:
tool_file.write(''.join([tool_source[0],
'# Generated by setup_toolchain.py do not edit.\n']
+ tool_source[1:]))
st = os.stat(out_path)
os.chmod(out_path, st.st_mode | stat.S_IEXEC)
# Find the tool source, it's the first argument, and copy it.
if len(sys.argv) != 2:
print "Need one argument (mac_tool source path)."
sys.exit(1)
CopyTool(sys.argv[1])