diff options
author | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-23 06:54:55 +0000 |
---|---|---|
committer | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-23 06:54:55 +0000 |
commit | f9cb2108d32497ca7688db99f144e0dbe73537da (patch) | |
tree | 3a7ff4e8224bbb7a26e4252cdc1c80b08163bb89 /chrome/tools | |
parent | 435b3ea2ecdf8a42cc8b9f8f5a43d10c54ff3684 (diff) | |
download | chromium_src-f9cb2108d32497ca7688db99f144e0dbe73537da.zip chromium_src-f9cb2108d32497ca7688db99f144e0dbe73537da.tar.gz chromium_src-f9cb2108d32497ca7688db99f144e0dbe73537da.tar.bz2 |
Copy VC CRT DLLs for component build even when VS is not installed.
BUG=127233
TEST=Build mini_installer on system that doesn't have VS installed, test that msvc*dll get copied to build dir.
Review URL: https://chromiumcodereview.appspot.com/10407053
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138440 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/tools')
-rwxr-xr-x | chrome/tools/build/win/create_installer_archive.py | 67 |
1 files changed, 47 insertions, 20 deletions
diff --git a/chrome/tools/build/win/create_installer_archive.py b/chrome/tools/build/win/create_installer_archive.py index eab9a20..310ad19 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 = os.path.basename(build_dir) == 'Debug' + if not is_debug and os.path.basename(build_dir) != '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). + 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(os.path.join(sys_dll_dir, "msvc*0d.dll")) + else: + crt_dlls = glob.glob(os.path.join(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,10 @@ 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) + # Copy the VS CRT DLLs to |build_dir|. This must be done before the general + # copy step below to ensure the CRT DLLs are added to the archive and marked + # as a dependency in the exe manifests generated below. + CopyVisualStudioRuntimeDLLs(build_dir) # 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 @@ -536,8 +563,8 @@ def _ParseOptions(): options, args = parser.parse_args() if not options.build_dir: parser.error('You must provide a build dir.') - elif not options.build_dir.endswith('/'): - options.build_dir += '/' + + options.build_dir = os.path.normpath(options.build_dir) if not options.staging_dir: parser.error('You must provide a staging dir.') |