diff options
author | wfh@chromium.org <wfh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-27 04:27:21 +0000 |
---|---|---|
committer | wfh@chromium.org <wfh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-27 04:27:21 +0000 |
commit | a36263ee634fe8efac89264a9c01ab60ee90ea35 (patch) | |
tree | 711b03e0d8a748c3424cd2c130f4fab73101679d /chrome/tools/build | |
parent | d91795f9ce0511be99ef52f3c4eb66e5aa758c12 (diff) | |
download | chromium_src-a36263ee634fe8efac89264a9c01ab60ee90ea35.zip chromium_src-a36263ee634fe8efac89264a9c01ab60ee90ea35.tar.gz chromium_src-a36263ee634fe8efac89264a9c01ab60ee90ea35.tar.bz2 |
Fix create_installer_archive.py to correctly determine
the debug/release mode regardless of x86/x64 platform
and also pick up the right CRT DLLs
BUG=166496
Review URL: https://chromiumcodereview.appspot.com/12326117
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184872 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/tools/build')
-rwxr-xr-x | chrome/tools/build/win/create_installer_archive.py | 53 |
1 files changed, 35 insertions, 18 deletions
diff --git a/chrome/tools/build/win/create_installer_archive.py b/chrome/tools/build/win/create_installer_archive.py index 909ae96..11fdf2a 100755 --- a/chrome/tools/build/win/create_installer_archive.py +++ b/chrome/tools/build/win/create_installer_archive.py @@ -352,35 +352,47 @@ def CopyAndAugmentManifest(build_dir, output_dir, manifest_name, # 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': +def CopyVisualStudioRuntimeDLLs(build_dir, target_arch): + is_debug = os.path.basename(build_dir).startswith('Debug') + if not is_debug and not os.path.basename(build_dir).startswith('Release'): print ("Warning: could not determine build configuration from " "output directory, assuming Release build.") crt_dlls = [] + sys_dll_dir = None if is_debug: crt_dlls = glob.glob( "C:/Program Files (x86)/Microsoft Visual Studio */VC/redist/" - "Debug_NonRedist/x86/Microsoft.*.DebugCRT/*.dll") + "Debug_NonRedist/" + target_arch + "/Microsoft.*.DebugCRT/*.dll") else: crt_dlls = glob.glob( - "C:/Program Files (x86)/Microsoft Visual Studio */VC/redist/x86/" - "Microsoft.*.CRT/*.dll") + "C:/Program Files (x86)/Microsoft Visual Studio */VC/redist/" + + target_arch + "/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" + if target_arch == 'x64': + # check we are are on a 64bit system by existence of WOW64 dir + if os.access("C:/Windows/SysWOW64", os.F_OK): + sys_dll_dir = "C:/Windows/System32" + else: + # only support packaging of 64bit installer on 64bit system + # but this just as bad as not finding DLLs at all so we + # don't abort here to mirror behavior below + print ("Warning: could not find x64 CRT DLLs on x86 system.") 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")) + # 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 sys_dll_dir is not None: + 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 " @@ -395,7 +407,7 @@ def CopyVisualStudioRuntimeDLLs(build_dir): # run-time. # This is meant for developer builds only and should never be used to package # an official build. -def DoComponentBuildTasks(staging_dir, build_dir, current_version): +def DoComponentBuildTasks(staging_dir, build_dir, target_arch, current_version): # Get the required directories for the upcoming operations. chrome_dir = os.path.join(staging_dir, CHROME_DIR) version_dir = os.path.join(chrome_dir, current_version) @@ -408,7 +420,7 @@ def DoComponentBuildTasks(staging_dir, build_dir, current_version): # 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) + CopyVisualStudioRuntimeDLLs(build_dir, target_arch) # 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 @@ -514,7 +526,8 @@ def main(options): options.enable_hidpi, options.enable_touch_ui) if options.component_build == '1': - DoComponentBuildTasks(staging_dir, options.build_dir, current_version) + DoComponentBuildTasks(staging_dir, options.build_dir, + options.target_arch, current_version) version_numbers = current_version.split('.') current_build_number = version_numbers[2] + '.' + version_numbers[3] @@ -575,6 +588,10 @@ def _ParseOptions(): help='Whether this archive is packaging a component build. This will ' 'also turn off compression of chrome.7z into chrome.packed.7z and ' 'helpfully delete any old chrome.packed.7z in |output_dir|.') + parser.add_option('--target_arch', default='x86', + help='Specify the target architecture for installer - this is used ' + 'to determine which CRT runtime files to pull and package ' + 'with the installer archive {x86|x64}.') options, _ = parser.parse_args() if not options.build_dir: |