Chromium Code Reviews| Index: chrome/tools/build/win/create_installer_archive.py |
| diff --git a/chrome/tools/build/win/create_installer_archive.py b/chrome/tools/build/win/create_installer_archive.py |
| index eab9a20ec74dd2231ceecf8caa74cbc1d42fc211..3848d1f96d7e38115df71ac9efbde20022db605e 100755 |
| --- a/chrome/tools/build/win/create_installer_archive.py |
| +++ b/chrome/tools/build/win/create_installer_archive.py |
| @@ -335,6 +335,47 @@ def CopyAndAugmentManifest(build_dir, output_dir, manifest_name, |
| modified_manifest_file.close() |
| +# Copy the relevant CRT DLLs to |build_dir|. We copy DLLs from all versions |
| +# of VS installed to make sure we have the correct CRT version, unused DLLs |
| +# should not conflict with the others anyways. |
| +def CopyVisualStudioRuntimeDLLs(build_dir): |
| + is_debug = build_dir.endswith('Debug/') |
|
robertshield
2012/05/22 02:39:59
is the trailing slash guaranteed to be present? If
gab
2012/05/22 15:44:46
Yes, see [1] below.
|
| + if not is_debug and not build_dir.endswith('Release/'): |
| + print ("Warning: could not determine build configuration from " |
| + "output directory, assuming Release build.") |
| + |
| + crt_dlls = [] |
| + if is_debug: |
| + crt_dlls = glob.glob( |
| + "C:/Program Files (x86)/Microsoft Visual Studio */VC/redist/" |
| + "Debug_NonRedist/x86/Microsoft.*.DebugCRT/*.dll") |
| + else: |
| + crt_dlls = glob.glob( |
| + "C:/Program Files (x86)/Microsoft Visual Studio */VC/redist/x86/" |
| + "Microsoft.*.CRT/*.dll") |
| + |
| + # Also handle the case where someone is building using only winsdk and |
| + # doesn't have Visual Studio installed. |
| + if not crt_dlls: |
| + # On a 64-bit system, 32-bit dlls are in SysWOW64 (don't ask). |
|
robertshield
2012/05/22 02:39:59
indeed :-)
gab
2012/05/22 15:44:46
Aaaah! Thanks for clarifying :)!
|
| + if os.access("C:/Windows/SysWOW64", os.F_OK): |
| + sys_dll_dir = "C:/Windows/SysWOW64" |
| + else: |
| + sys_dll_dir = "C:/Windows/System32" |
| + |
| + if is_debug: |
| + crt_dlls = glob.glob(sys_dll_dir + "/msvc*0d.dll") |
| + else: |
| + crt_dlls = glob.glob(sys_dll_dir + "/msvc*0.dll") |
| + |
| + if not crt_dlls: |
| + print ("Warning: could not find CRT DLLs to copy to build dir - target " |
| + "may not run on a system that doesn't have those DLLs.") |
| + |
| + for dll in crt_dlls: |
| + shutil.copy(dll, build_dir) |
| + |
| + |
| # Copies component build DLLs and generates required config files and manifests |
| # in order for chrome.exe and setup.exe to be able to find those DLLs at |
| # run-time. |
| @@ -350,24 +391,7 @@ def DoComponentBuildTasks(staging_dir, build_dir, current_version): |
| if not os.path.exists(installer_dir): |
| os.mkdir(installer_dir) |
| - # Copy the relevant CRT DLLs to |build_dir|. We copy DLLs from all versions |
| - # of VS installed to make sure we have the correct CRT version, unused DLLs |
| - # should not conflict with the others anyways. |
| - crt_dlls = [] |
| - if build_dir.endswith('Debug/'): |
| - crt_dlls = glob.glob( |
| - "C:/Program Files (x86)/Microsoft Visual Studio */VC/redist/" |
| - "Debug_NonRedist/x86/Microsoft.*.DebugCRT/*.dll") |
| - elif build_dir.endswith('Release/'): |
| - crt_dlls = glob.glob( |
| - "C:/Program Files (x86)/Microsoft Visual Studio */VC/redist/x86/" |
| - "Microsoft.*.CRT/*.dll") |
| - else: |
| - print ("Warning: CRT DLLs not copied, could not determine build " |
| - "configuration from output directory.") |
| - |
| - for dll in crt_dlls: |
| - shutil.copy(dll, build_dir) |
| + CopyVisualStudioRuntimeDLLs(build_dir) |
|
gab
2012/05/22 15:44:46
optional: Add a comment as to why this needs to be
|
| # Copy all the DLLs in |build_dir| to the version directory. Simultaneously |
| # build a list of their names to mark them as dependencies of chrome.exe and |