Skip to content

Commit

Permalink
Clang/Windows update script: copy the dynamic ASan RTL if present
Browse files Browse the repository at this point in the history
BUG=345874
NOTRY=true

Review URL: https://codereview.chromium.org/519823002

Cr-Commit-Position: refs/heads/master@{#292653}
  • Loading branch information
timurrrr authored and Commit bot committed Aug 29, 2014
1 parent 72e2f7b commit 04a15ee
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions tools/clang/scripts/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,25 @@ def RunCommand(command, tries=1):
print 'Failed.'
sys.exit(1)


def CopyFile(src, dst):
"""Copy a file from src to dst."""
shutil.copy(src, dst)
print "Copying %s to %s" % (src, dst)


def CopyDirectoryContents(src, dst, filename_filter=None):
"""Copy the files from directory src to dst
with an optional filename filter."""
if not os.path.exists(dst):
os.makedirs(dst)
for root, _, files in os.walk(src):
for f in files:
if filename_filter and not re.match(filename_filter, f):
continue
CopyFile(os.path.join(root, f), dst)


def Checkout(name, url, dir):
"""Checkout the SVN module at url into dir. Use name for the log message."""
print "Checking out %s r%s into '%s'" % (name, LLVM_WIN_REVISION, dir)
Expand Down Expand Up @@ -167,18 +181,18 @@ def UpdateClang():
'-DLLVM_ENABLE_ASSERTIONS=ON', LLVM_DIR])
RunCommand(GetVSVersion().SetupScript('x86') + ['&&', 'ninja', 'compiler-rt'])

asan_rt_bin_src_dir = os.path.join(COMPILER_RT_BUILD_DIR, 'bin')
asan_rt_bin_dst_dir = os.path.join(LLVM_BUILD_DIR, 'bin')
CopyDirectoryContents(asan_rt_bin_src_dir, asan_rt_bin_dst_dir,
r'^.*-i386\.dll$')

# TODO(hans): Make this (and the .gypi file) version number independent.
asan_rt_lib_src_dir = os.path.join(COMPILER_RT_BUILD_DIR, 'lib', 'clang',
'3.6.0', 'lib', 'windows')
asan_rt_lib_dst_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang',
'3.6.0', 'lib', 'windows')

if not os.path.exists(asan_rt_lib_dst_dir):
os.makedirs(asan_rt_lib_dst_dir)
for root, _, files in os.walk(asan_rt_lib_src_dir):
for f in files:
if re.match(r'^.*-i386\.lib$', f):
CopyFile(os.path.join(root, f), asan_rt_lib_dst_dir)
CopyDirectoryContents(asan_rt_lib_src_dir, asan_rt_lib_dst_dir,
r'^.*-i386\.lib$')

CopyFile(os.path.join(asan_rt_lib_src_dir, '..', '..', 'asan_blacklist.txt'),
os.path.join(asan_rt_lib_dst_dir, '..', '..'))
Expand Down

0 comments on commit 04a15ee

Please sign in to comment.