Commit c7fc8475 authored by Amy Huang's avatar Amy Huang Committed by Commit Bot

Change to download and build zlib every time, in case a bot happens to die during a build

Change-Id: I04e3bfcf520eef8b7fe41cfa1cb04e87de413363
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2052585
Commit-Queue: Amy Huang <akhuang@google.com>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750365}
parent d4923529
...@@ -236,31 +236,32 @@ def AddGnuWinToPath(): ...@@ -236,31 +236,32 @@ def AddGnuWinToPath():
def AddZlibToPath(): def AddZlibToPath():
"""Download and build zlib, and add to PATH.""" """Download and build zlib, and add to PATH."""
zlib_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'zlib-1.2.11') zlib_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'zlib-1.2.11')
if not os.path.exists(zlib_dir): zip_name = 'zlib-1.2.11.tar.gz'
zip_name = 'zlib-1.2.11.tar.gz'
DownloadAndUnpack(CDS_URL + '/tools/' + zip_name, LLVM_BUILD_TOOLS_DIR) shutil.rmtree(zlib_dir)
os.chdir(zlib_dir) DownloadAndUnpack(CDS_URL + '/tools/' + zip_name, LLVM_BUILD_TOOLS_DIR)
zlib_files = [ os.chdir(zlib_dir)
'adler32', 'compress', 'crc32', 'deflate', 'gzclose', 'gzlib',
'gzread', 'gzwrite', 'inflate', 'infback', 'inftrees', 'inffast', # Build zlib.
'trees', 'uncompr', 'zutil' zlib_files = [
] 'adler32', 'compress', 'crc32', 'deflate', 'gzclose', 'gzlib', 'gzread',
cl_flags = [ 'gzwrite', 'inflate', 'infback', 'inftrees', 'inffast', 'trees',
'/nologo', '/O2', '/DZLIB_DLL', '/c', '/D_CRT_SECURE_NO_DEPRECATE', 'uncompr', 'zutil'
'/D_CRT_NONSTDC_NO_DEPRECATE' ]
] cl_flags = [
'/nologo', '/O2', '/DZLIB_DLL', '/c', '/D_CRT_SECURE_NO_DEPRECATE',
'/D_CRT_NONSTDC_NO_DEPRECATE'
]
try: RunCommand(
RunCommand(['cl.exe'] + [f + '.c' for f in zlib_files] + cl_flags, ['cl.exe'] + [f + '.c' for f in zlib_files] + cl_flags, msvc_arch='x64')
msvc_arch='x64') RunCommand(
RunCommand(['lib.exe'] + [f + '.obj' for f in zlib_files] + ['lib.exe'] + [f + '.obj'
['/nologo', '/out:zlib.lib'], msvc_arch='x64') for f in zlib_files] + ['/nologo', '/out:zlib.lib'],
# Remove the test directory so it isn't found when trying to find msvc_arch='x64')
# test.exe. # Remove the test directory so it isn't found when trying to find
shutil.rmtree('test') # test.exe.
except Exception as e: shutil.rmtree('test')
print('Failed to build zlib: ' + str(e))
sys.exit(1)
os.environ['PATH'] = zlib_dir + os.pathsep + os.environ.get('PATH', '') os.environ['PATH'] = zlib_dir + os.pathsep + os.environ.get('PATH', '')
return zlib_dir return zlib_dir
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment