Delete .a file before writing static library.
The ar utility only adds symbols. As a result removed symbols are sometimes still present in later builds, leading to great confusion. Delete the .a file before recreating it with ar. This is similar to what Chromium currently does in gcc_toolchain.gni. However, we cannot always just use 'rm' because of the build for Android on Windows, so this introduces 'rm.py' which is just like 'cp.py' but without the copy part. Bug: skia:10363 Change-Id: Icc0c3d18dab1e48ccfec47386662c7b4d2dc8811 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295569 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
a25422faa4
commit
ee2ffc3b43
18
gn/rm.py
Executable file
18
gn/rm.py
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2016 Google Inc.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
dst, = sys.argv[1:]
|
||||
|
||||
if os.path.exists(dst):
|
||||
if os.path.isdir(dst):
|
||||
shutil.rmtree(dst)
|
||||
else:
|
||||
os.remove(dst)
|
@ -42,9 +42,12 @@ declare_args() {
|
||||
dlsymutil_pool_depth = exec_script("num_cpus.py", [], "value")
|
||||
}
|
||||
|
||||
# For 'shell' see https://ninja-build.org/manual.html#ref_rule_command
|
||||
if (host_os == "win") {
|
||||
stamp = "cmd.exe /c echo >"
|
||||
shell = "cmd.exe /c "
|
||||
stamp = "$shell echo >"
|
||||
} else {
|
||||
shell = ""
|
||||
stamp = "touch"
|
||||
}
|
||||
|
||||
@ -64,10 +67,10 @@ toolchain("msvc") {
|
||||
if (target_cpu == "x86") {
|
||||
# Toolchain asset includes a script that configures for x86 building.
|
||||
# We don't support x86 builds with local MSVC installations.
|
||||
env_setup = "cmd /c $win_sdk/bin/SetEnv.cmd /x86 && "
|
||||
env_setup = "$shell $win_sdk/bin/SetEnv.cmd /x86 && "
|
||||
} else if (target_cpu == "arm64") {
|
||||
# ARM64 compiler is incomplete - it relies on DLLs located in the host toolchain directory.
|
||||
env_setup = "cmd /C set \"PATH=%PATH%;$win_vc\\Tools\\MSVC\\$win_toolchain_version\\bin\\HostX64\\x64\" && "
|
||||
env_setup = "$shell set \"PATH=%PATH%;$win_vc\\Tools\\MSVC\\$win_toolchain_version\\bin\\HostX64\\x64\" && "
|
||||
}
|
||||
|
||||
cl_m32_flag = ""
|
||||
@ -266,7 +269,8 @@ template("gcc_like_toolchain") {
|
||||
} else {
|
||||
rspfile = "{{output}}.rsp"
|
||||
rspfile_content = "{{inputs}}"
|
||||
command = "$ar rcs {{output}} @$rspfile"
|
||||
rm_py = rebase_path("../rm.py")
|
||||
command = "$shell python \"$rm_py\" \"{{output}}\" && $ar rcs {{output}} @$rspfile"
|
||||
}
|
||||
|
||||
outputs =
|
||||
|
Loading…
Reference in New Issue
Block a user