Commit 9bd54160 authored by Sebastien Marchand's avatar Sebastien Marchand Committed by Chromium LUCI CQ

Simplify the logic in the mini_installer BUILD.gn file

A lot of the logic in this file dates from the Syzygy days, as we don't
use it anymore there's no need to template the target that generates the
installer.

Change-Id: I810e059b6eb733324096389dca53853f080c672d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2613328
Commit-Queue: Sébastien Marchand <sebmarchand@chromium.org>
Reviewed-by: default avatarGreg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841558}
parent ff74cf9d
...@@ -111,206 +111,176 @@ group("setup_runtime_deps") { ...@@ -111,206 +111,176 @@ group("setup_runtime_deps") {
data_deps = [ "//chrome/installer/setup" ] data_deps = [ "//chrome/installer/setup" ]
} }
# Generates a mini installer. packed_files_rc_file = "$target_gen_dir/mini_installer/packed_files.rc"
#
# out_dir (required)
# The output directory out_dir where the mini_installer image should be
# written.
#
# chrome_dll_file (required)
# The path to the version of chrome.dll that should be included in the
# installer archive.
#
# chrome_dll_target (required)
# The target that generated chrome_dll_file.
#
# deps (required)
# Normal meaning.
template("generate_mini_installer") {
chrome_dll_file = invoker.chrome_dll_file
chrome_dll_target = invoker.chrome_dll_target
output_dir = invoker.out_dir
packed_files_rc_file = "$target_gen_dir/$target_name/packed_files.rc"
archive_name = target_name + "_archive"
staging_dir = "$target_gen_dir/$target_name"
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(archive_name) {
script = "//chrome/tools/build/win/create_installer_archive.py"
release_file = "chrome.release"
inputs = [ # TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
"$chrome_dll_file", python2_action("mini_installer_archive") {
"$root_out_dir/chrome.exe", script = "//chrome/tools/build/win/create_installer_archive.py"
"$root_out_dir/locales/en-US.pak",
"$root_out_dir/setup.exe",
"//chrome/tools/build/win/makecab.py",
release_file,
]
outputs = [ release_file = "chrome.release"
# See also chrome.packed.7z conditionally added below.
"$output_dir/chrome.7z",
"$output_dir/setup.ex_",
packed_files_rc_file,
]
args = [
"--build_dir",
rebase_path(root_out_dir, root_build_dir),
"--staging_dir",
rebase_path(staging_dir, root_build_dir),
"--input_file",
rebase_path(release_file, root_build_dir),
"--resource_file_path",
rebase_path(packed_files_rc_file, root_build_dir),
"--target_arch=$current_cpu",
"--distribution=_${branding_path_component}",
"--output_dir",
rebase_path(output_dir, root_build_dir),
"--chrome_runtime_deps",
rebase_path(chrome_runtime_deps, root_build_dir),
"--setup_runtime_deps",
rebase_path(setup_runtime_deps, root_build_dir),
# Optional arguments to generate diff installer.
#'--last_chrome_installer=C:/Temp/base',
#'--setup_exe_format=DIFF',
#'--diff_algorithm=COURGETTE',
# Optional argument for verbose archiving output.
#"--verbose",
]
deps = [ inputs = [
":chrome_runtime_deps", "$root_out_dir/chrome.dll",
":setup_runtime_deps", "$root_out_dir/chrome.exe",
"//chrome", "$root_out_dir/locales/en-US.pak",
"//chrome/browser/extensions/default_extensions", "$root_out_dir/setup.exe",
"//chrome/common/win:eventlog_provider", "//chrome/tools/build/win/makecab.py",
"//chrome/installer/setup", release_file,
"//mojo/core:shared_library", ]
"//third_party/icu:icudata",
chrome_dll_target,
]
if (enable_hidpi) { outputs = [
args += [ "--enable_hidpi=1" ] # See also chrome.packed.7z conditionally added below.
} "$root_out_dir/chrome.7z",
if (is_component_build) { "$root_out_dir/setup.ex_",
args += [ "--component_build=1" ] packed_files_rc_file,
} ]
args = [
"--build_dir",
rebase_path(root_out_dir, root_build_dir),
"--staging_dir",
rebase_path("$target_gen_dir/mini_installer", root_build_dir),
"--input_file",
rebase_path(release_file, root_build_dir),
"--resource_file_path",
rebase_path(packed_files_rc_file, root_build_dir),
"--target_arch=$current_cpu",
"--distribution=_${branding_path_component}",
"--output_dir",
rebase_path(root_out_dir, root_build_dir),
"--chrome_runtime_deps",
rebase_path(chrome_runtime_deps, root_build_dir),
"--setup_runtime_deps",
rebase_path(setup_runtime_deps, root_build_dir),
# Optional arguments to generate diff installer.
#'--last_chrome_installer=C:/Temp/base',
#'--setup_exe_format=DIFF',
#'--diff_algorithm=COURGETTE',
# Optional argument for verbose archiving output.
#"--verbose",
]
if (is_component_ffmpeg) { deps = [
args += [ "--component_ffmpeg_build=1" ] ":chrome_runtime_deps",
} ":setup_runtime_deps",
"//chrome",
"//chrome:chrome_dll",
"//chrome/browser/extensions/default_extensions",
"//chrome/common/win:eventlog_provider",
"//chrome/installer/setup",
"//mojo/core:shared_library",
"//third_party/icu:icudata",
]
if (skip_archive_compression) { if (enable_hidpi) {
args += [ "--skip_archive_compression" ] args += [ "--enable_hidpi=1" ]
} else { }
outputs += [ "$output_dir/chrome.packed.7z" ] if (is_component_build) {
} args += [ "--component_build=1" ]
}
if (enable_nacl) { if (is_component_ffmpeg) {
inputs += [ "$root_out_dir/nacl_irt_x86_64.nexe" ] args += [ "--component_ffmpeg_build=1" ]
deps += [ "//ppapi/native_client:irt" ] }
if (current_cpu == "x86") {
inputs += [
"$root_out_dir/nacl64.exe",
"$root_out_dir/nacl_irt_x86_32.nexe",
]
deps += [ "//components/nacl/broker:nacl64" ]
}
}
if (icu_use_data_file) { if (skip_archive_compression) {
inputs += [ "$root_out_dir/icudtl.dat" ] args += [ "--skip_archive_compression" ]
} else { } else {
inputs += [ "$root_out_dir/icudt.dll" ] outputs += [ "$root_out_dir/chrome.packed.7z" ]
} }
if (v8_use_external_startup_data) { if (enable_nacl) {
deps += [ "//v8" ] inputs += [ "$root_out_dir/nacl_irt_x86_64.nexe" ]
if (use_v8_context_snapshot) { deps += [ "//ppapi/native_client:irt" ]
inputs += [ "$root_out_dir/$v8_context_snapshot_filename" ] if (current_cpu == "x86") {
deps += [ "//tools/v8_context_snapshot" ] inputs += [
} else { "$root_out_dir/nacl64.exe",
inputs += [ "$root_out_dir/snapshot_blob.bin" ] "$root_out_dir/nacl_irt_x86_32.nexe",
args += [ "--include_snapshotblob=1" ] ]
} deps += [ "//components/nacl/broker:nacl64" ]
} }
}
depfile = "$target_gen_dir/archive.d" if (icu_use_data_file) {
args += [ inputs += [ "$root_out_dir/icudtl.dat" ]
"--depfile", } else {
rebase_path(depfile, root_build_dir), inputs += [ "$root_out_dir/icudt.dll" ]
]
} }
executable(target_name) { if (v8_use_external_startup_data) {
output_name = "mini_installer" deps += [ "//v8" ]
sources = [ if (use_v8_context_snapshot) {
"mini_installer_exe_main.cc", inputs += [ "$root_out_dir/$v8_context_snapshot_filename" ]
packed_files_rc_file, deps += [ "//tools/v8_context_snapshot" ]
] } else {
inputs += [ "$root_out_dir/snapshot_blob.bin" ]
args += [ "--include_snapshotblob=1" ]
}
}
# This target is special so we manually override most linker flags and depfile = "$target_gen_dir/archive.d"
# specify our own to keep the size down. args += [
configs -= [ "--depfile",
# Initialization may insert unexpected memset calls. rebase_path(depfile, root_build_dir),
"//build/config/compiler:default_init_stack_vars", ]
"//build/config:executable_config", }
"//build/config/win:console",
]
configs += [
":mini_installer_compiler_flags",
"//build/config/sanitizers:link_executable",
"//build/config/win:sdk_link",
"//build/config/win:windowed",
]
ldflags = [ executable("mini_installer") {
"/FIXED:NO", sources = [
"/ignore:4199", "mini_installer_exe_main.cc",
"/NXCOMPAT", packed_files_rc_file,
] ]
libs = [ "setupapi.lib" ] # This target is special so we manually override most linker flags and
# specify our own to keep the size down.
configs -= [
# Initialization may insert unexpected memset calls.
"//build/config/compiler:default_init_stack_vars",
"//build/config:executable_config",
"//build/config/win:console",
]
configs += [
":mini_installer_compiler_flags",
"//build/config/sanitizers:link_executable",
"//build/config/win:sdk_link",
"//build/config/win:windowed",
]
deps = [ ldflags = [
":$archive_name", "/FIXED:NO",
":lib", "/ignore:4199",
":version", "/NXCOMPAT",
"//base:clang_profiling_buildflags", ]
"//build/win:default_exe_manifest",
]
# In general, mini_installer tries to avoid depending on the C++ standard libs = [ "setupapi.lib" ]
# library for size reasons. This is achieved by:
# 1. setting a custom entry point which avoids pulling in the standard deps = [
# library via a link dependency. ":lib",
# 2. setting no_default_deps=true to avoid including the implicit ":mini_installer_archive",
# dependency on //buildtools/third_party/libc++ in builds that set ":version",
# use_custom_libcxx=true. "//base:clang_profiling_buildflags",
# "//build/win:default_exe_manifest",
# The net result is similar to linking with /NODEFAULTLIB, but more precise ]
# as it just excludes the CRT.
#
# But in asan and clang profiling builds we need to link against a runtime
# library, which in turn depends on the standard library and relies on it
# to run initializers.
if (!is_asan && !use_clang_profiling) {
no_default_deps = true
ldflags += [ "/ENTRY:MainEntryPoint" ]
}
}
}
generate_mini_installer("mini_installer") { # In general, mini_installer tries to avoid depending on the C++ standard
out_dir = root_out_dir # library for size reasons. This is achieved by:
chrome_dll_file = "$root_out_dir/chrome.dll" # 1. setting a custom entry point which avoids pulling in the standard
chrome_dll_target = "//chrome:chrome_dll" # library via a link dependency.
# 2. setting no_default_deps=true to avoid including the implicit
# dependency on //buildtools/third_party/libc++ in builds that set
# use_custom_libcxx=true.
#
# The net result is similar to linking with /NODEFAULTLIB, but more precise
# as it just excludes the CRT.
#
# But in asan and clang profiling builds we need to link against a runtime
# library, which in turn depends on the standard library and relies on it
# to run initializers.
if (!is_asan && !use_clang_profiling) {
no_default_deps = true
ldflags += [ "/ENTRY:MainEntryPoint" ]
}
} }
# previous_version_mini_installer.exe can't be generated in an x86 Debug # previous_version_mini_installer.exe can't be generated in an x86 Debug
......
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