| # Copyright 2015 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/config/c++/c++.gni") |
| import("//build/config/chrome_build.gni") |
| import("//build/config/chromeos/ui_mode.gni") |
| import("//build/config/features.gni") |
| import("//build/config/sanitizers/sanitizers.gni") |
| import("//build/config/sysroot.gni") |
| import("//build/linux/strip_binary.gni") |
| import("//build/util/lastchange.gni") |
| import("//build/util/process_version.gni") |
| import("//build/util/version.gni") |
| import("//components/nacl/features.gni") |
| import("//components/optimization_guide/features.gni") |
| import("//third_party/angle/gni/angle.gni") |
| import("//third_party/widevine/cdm/widevine.gni") |
| import("//ui/gl/features.gni") |
| |
| if (bundle_widevine_cdm) { |
| import("//media/cdm/library_cdm/cdm_paths.gni") |
| } |
| |
| declare_args() { |
| # Enables checks that ensure the packages are installable on all supported |
| # distributions. |
| enable_distro_version_check = true |
| |
| # Enable building snap packages |
| enable_snap_package = false |
| } |
| |
| assert(is_linux || is_chromeos) |
| |
| packaging_files_executables = [ |
| "$root_out_dir/chrome", |
| "$root_out_dir/chrome_crashpad_handler", |
| "$root_out_dir/chrome_management_service", |
| "$root_out_dir/chrome_sandbox", |
| ] |
| packaging_files_shlibs = [] |
| |
| # TODO(https://crbug.com/1299021): Implement building these NaCl targets as |
| # ARM32 when Chrome is built for ARM64 (for Linux/Chrome OS). |
| if (target_cpu == "arm64") { |
| enable_nacl = false |
| } |
| |
| if (enable_nacl) { |
| packaging_files_executables += [ |
| "$root_out_dir/nacl_helper", |
| "$root_out_dir/nacl_helper_bootstrap", |
| ] |
| |
| if (current_cpu == "x86") { |
| packaging_files_executables += [ "$root_out_dir/nacl_irt_x86_32.nexe" ] |
| } else if (current_cpu == "x64") { |
| packaging_files_executables += [ "$root_out_dir/nacl_irt_x86_64.nexe" ] |
| } else if (current_cpu == "arm") { |
| packaging_files_executables += [ "$root_out_dir/nacl_irt_arm.nexe" ] |
| } else if (current_cpu == "mipsel") { |
| packaging_files_executables += [ "$root_out_dir/nacl_irt_mips32.nexe" ] |
| } |
| } |
| |
| if (bundle_widevine_cdm) { |
| packaging_files_shlibs += |
| [ "$root_out_dir/$widevine_cdm_path/libwidevinecdm.so" ] |
| } |
| |
| if (use_egl) { |
| packaging_files_shlibs += [ |
| "$root_out_dir/libEGL.so", |
| "$root_out_dir/libGLESv2.so", |
| ] |
| if (angle_shared_libvulkan && !is_chromeos) { |
| packaging_files_shlibs += [ "$root_out_dir/libvulkan.so.1" ] |
| } |
| } |
| |
| if (enable_swiftshader) { |
| packaging_files_shlibs += [ "$root_out_dir/libvk_swiftshader.so" ] |
| } |
| |
| if (build_with_internal_optimization_guide) { |
| packaging_files_shlibs += |
| [ "$root_out_dir/liboptimization_guide_internal.so" ] |
| } |
| |
| packaging_files_binaries = packaging_files_executables + packaging_files_shlibs |
| |
| # TODO(mmoss) Any convenient way to get all the relevant build files? |
| # (e.g. all locales, resources, etc.) |
| packaging_files = packaging_files_binaries + [ |
| "$root_out_dir/vk_swiftshader_icd.json", |
| "$root_out_dir/xdg-mime", |
| "$root_out_dir/xdg-settings", |
| "$root_out_dir/locales/en-US.pak", |
| "$root_out_dir/MEIPreload/manifest.json", |
| "$root_out_dir/MEIPreload/preloaded_data.pb", |
| ] |
| |
| action_foreach("calculate_deb_dependencies") { |
| deps = [ ":installer_deps" ] |
| script = "debian/calculate_package_deps.py" |
| sources = packaging_files_binaries |
| inputs = [ |
| "debian/deb_version.py", |
| "debian/dist_package_versions.json", |
| "debian/package_version_interval.py", |
| "//third_party/dpkg-shlibdeps/dpkg-shlibdeps.pl", |
| ] |
| outputs = [ "$root_out_dir/deb_{{source_name_part}}.deps" ] |
| args = [ |
| "{{source}}", |
| rebase_path(sysroot, root_build_dir), |
| target_cpu, |
| "deb_{{source_name_part}}.deps", |
| ] |
| if ((is_linux || is_chromeos_lacros) && target_cpu == "x64" && |
| enable_distro_version_check) { |
| args += [ "--distro-check" ] |
| } |
| } |
| |
| action("merge_deb_dependencies") { |
| deps = [ ":calculate_deb_dependencies" ] |
| script = "debian/merge_package_versions.py" |
| additional_deps = "debian/additional_deps" |
| inputs = [ |
| additional_deps, |
| "debian/deb_version.py", |
| "debian/package_version_interval.py", |
| ] |
| outputs = [ "$root_out_dir/deb_common.deps" ] |
| args = [ |
| "deb_common.deps", |
| rebase_path(additional_deps, root_build_dir), |
| ] |
| args += rebase_path(get_target_outputs(":calculate_deb_dependencies"), |
| root_build_dir) |
| } |
| |
| action_foreach("calculate_rpm_dependencies") { |
| deps = [ ":installer_deps" ] |
| script = "rpm/calculate_package_deps.py" |
| sources = packaging_files_binaries |
| inputs = [ "rpm/dist_package_provides.json" ] |
| outputs = [ "$root_out_dir/rpm_{{source_name_part}}.deps" ] |
| args = [ |
| "{{source}}", |
| "rpm_{{source_name_part}}.deps", |
| ] |
| args += rebase_path(packaging_files_shlibs, root_build_dir) |
| if ((is_linux || is_chromeos_lacros) && target_cpu == "x64" && |
| enable_distro_version_check) { |
| args += [ "--distro-check" ] |
| } |
| } |
| |
| action("merge_rpm_dependencies") { |
| deps = [ ":calculate_rpm_dependencies" ] |
| script = "rpm/merge_package_deps.py" |
| additional_deps = "rpm/additional_deps" |
| inputs = [ additional_deps ] |
| outputs = [ "$root_out_dir/rpm_common.deps" ] |
| args = [ |
| "rpm_common.deps", |
| rebase_path(additional_deps, root_build_dir), |
| ] |
| args += rebase_path(get_target_outputs(":calculate_rpm_dependencies"), |
| root_build_dir) |
| } |
| |
| strip_binary("strip_chrome_binary") { |
| binary_input = "$root_out_dir/chrome" |
| deps = [ "//chrome" ] |
| } |
| |
| strip_binary("strip_chrome_crashpad_handler") { |
| binary_input = "$root_out_dir/chrome_crashpad_handler" |
| deps = [ "//components/crash/core/app:chrome_crashpad_handler" ] |
| } |
| |
| strip_binary("strip_chrome_management_service") { |
| binary_input = "$root_out_dir/chrome_management_service" |
| deps = [ "//chrome/browser/enterprise/connectors/device_trust/key_management/installer/management_service:chrome_management_service" ] |
| } |
| |
| strip_binary("strip_chrome_sandbox") { |
| binary_input = "$root_out_dir/chrome_sandbox" |
| deps = [ "//sandbox/linux:chrome_sandbox" ] |
| } |
| |
| strip_binary("strip_libEGL_shlib") { |
| binary_input = "$root_out_dir/libEGL.so" |
| deps = [ "//third_party/angle:libEGL" ] |
| } |
| |
| strip_binary("strip_libGLESv2_shlib") { |
| binary_input = "$root_out_dir/libGLESv2.so" |
| deps = [ "//third_party/angle:libGLESv2" ] |
| } |
| |
| strip_binary("strip_libvulkan_shlib") { |
| binary_input = "$root_out_dir/libvulkan.so.1" |
| deps = [ "//third_party/vulkan-deps/vulkan-loader/src:libvulkan" ] |
| } |
| |
| strip_binary("strip_libvk_swiftshader.shlib") { |
| binary_input = "$root_out_dir/libvk_swiftshader.so" |
| deps = [ "//third_party/swiftshader/src/Vulkan:swiftshader_libvulkan" ] |
| } |
| |
| if (enable_nacl) { |
| strip_binary("strip_nacl_helper") { |
| binary_input = "$root_out_dir/nacl_helper" |
| deps = [ "//components/nacl/loader:nacl_helper" ] |
| } |
| |
| strip_binary("strip_nacl_helper_bootstrap") { |
| binary_input = "$root_out_dir/nacl_helper_bootstrap" |
| deps = [ "//native_client/src/trusted/service_runtime/linux:bootstrap" ] |
| } |
| } |
| |
| if (build_with_internal_optimization_guide) { |
| strip_binary("strip_optimization_guide") { |
| binary_input = "$root_out_dir/liboptimization_guide_internal.so" |
| deps = [ |
| "//components/optimization_guide/internal:optimization_guide_internal", |
| ] |
| } |
| } |
| |
| # This target builds all "normal" Linux installers. You must set |
| # is_component_build=false before building this target. |
| group("linux") { |
| deps = [ |
| ":beta", |
| ":stable", |
| ":unstable", |
| ] |
| } |
| |
| branding_dir = "//chrome/app/theme/$branding_path_component" |
| branding_dir_100 = |
| "//chrome/app/theme/default_100_percent/$branding_path_component" |
| |
| copy("common_packaging_files") { |
| visibility = [ ":*" ] |
| sources = [ |
| "//chrome/app/resources/manpage.1.in", |
| "common/apt.include", |
| "common/default-app-block.template", |
| "common/default-app.template", |
| "common/desktop.template", |
| "common/installer.include", |
| "common/postinst.include", |
| "common/prerm.include", |
| "common/repo.cron", |
| "common/repo_variables.include", |
| "common/rpm.include", |
| "common/rpmrepo.cron", |
| "common/symlinks.include", |
| "common/variables.include", |
| "common/wrapper", |
| ] |
| |
| if (is_chrome_branded) { |
| sources += [ |
| "common/google-chrome/google-chrome.appdata.xml.template", |
| "common/google-chrome/google-chrome.info", |
| ] |
| } else { |
| sources += [ |
| "common/chromium-browser/chromium-browser.appdata.xml", |
| "common/chromium-browser/chromium-browser.info", |
| ] |
| } |
| |
| sources += [ "//buildtools/third_party/eu-strip/bin/eu-strip" ] |
| |
| outputs = [ "$root_out_dir/installer/common/{{source_file_part}}" ] |
| } |
| |
| copy("deb_packaging_files") { |
| visibility = [ ":*" ] |
| sources = [ |
| "debian/build.sh", |
| "debian/changelog.template", |
| "debian/control.template", |
| "debian/debian.menu", |
| "debian/manual_recommends", |
| "debian/postinst", |
| "debian/postrm", |
| "debian/prerm", |
| ] |
| outputs = [ "$root_out_dir/installer/debian/{{source_file_part}}" ] |
| } |
| |
| copy("theme_files") { |
| visibility = [ ":*" ] |
| sources = [ |
| "$branding_dir/BRANDING", |
| "$branding_dir/linux/product_logo_128.png", |
| "$branding_dir/linux/product_logo_24.png", |
| "$branding_dir/linux/product_logo_256.png", |
| "$branding_dir/linux/product_logo_32.xpm", |
| "$branding_dir/linux/product_logo_48.png", |
| "$branding_dir/linux/product_logo_64.png", |
| "$branding_dir_100/linux/product_logo_16.png", |
| "$branding_dir_100/linux/product_logo_32.png", |
| ] |
| if (is_chrome_branded) { |
| sources += [ |
| "$branding_dir/linux/product_logo_128_beta.png", |
| "$branding_dir/linux/product_logo_128_dev.png", |
| "$branding_dir/linux/product_logo_24_beta.png", |
| "$branding_dir/linux/product_logo_24_dev.png", |
| "$branding_dir/linux/product_logo_256_beta.png", |
| "$branding_dir/linux/product_logo_256_dev.png", |
| "$branding_dir/linux/product_logo_32_beta.xpm", |
| "$branding_dir/linux/product_logo_32_dev.xpm", |
| "$branding_dir/linux/product_logo_48_beta.png", |
| "$branding_dir/linux/product_logo_48_dev.png", |
| "$branding_dir/linux/product_logo_64_beta.png", |
| "$branding_dir/linux/product_logo_64_dev.png", |
| "$branding_dir_100/linux/product_logo_16_beta.png", |
| "$branding_dir_100/linux/product_logo_16_dev.png", |
| "$branding_dir_100/linux/product_logo_32_beta.png", |
| "$branding_dir_100/linux/product_logo_32_dev.png", |
| ] |
| } |
| outputs = [ "$root_out_dir/installer/theme/{{source_file_part}}" ] |
| } |
| |
| if (!is_chromeos_ash) { |
| copy("rpm_packaging_files") { |
| visibility = [ ":*" ] |
| sources = [ |
| "rpm/build.sh", |
| "rpm/chrome.spec.template", |
| ] |
| outputs = [ "$root_out_dir/installer/rpm/{{source_file_part}}" ] |
| } |
| } |
| |
| process_version("save_build_info") { |
| # Just output the default version info variables (no template). |
| process_only = true |
| sources = [ |
| "//chrome/VERSION", |
| branding_file_path, |
| lastchange_file, |
| ] |
| output = "$root_out_dir/installer/version.txt" |
| } |
| |
| # Dependencies for all Linux installer targets. |
| group("installer_deps") { |
| # Though many of these things appear in data_deps further down the |
| # dependency chain, they must appear here as public_deps so that they can |
| # be listed as inputs to the actions that depend on ":installer_deps" |
| # and are guaranteed to have been built before those actions run. |
| |
| public_deps = [ |
| ":common_packaging_files", |
| ":deb_packaging_files", |
| ":save_build_info", |
| ":strip_chrome_binary", |
| ":strip_chrome_crashpad_handler", |
| ":strip_chrome_management_service", |
| ":strip_chrome_sandbox", |
| ":theme_files", |
| "//chrome", |
| "//chrome:packed_resources", |
| "//chrome/browser/enterprise/connectors/device_trust/key_management/installer/management_service:chrome_management_service", |
| "//chrome/browser/resources/media/mei_preload:component", |
| "//components/crash/core/app:chrome_crashpad_handler", |
| "//sandbox/linux:chrome_sandbox", |
| ] |
| if (enable_nacl) { |
| public_deps += [ |
| ":strip_nacl_helper", |
| ":strip_nacl_helper_bootstrap", |
| "//components/nacl/loader:nacl_helper", |
| |
| # These are data_deps of nacl_helper, but that is not enough, |
| # as explained above. |
| "//native_client/src/trusted/service_runtime/linux:bootstrap", |
| "//ppapi/native_client:irt", |
| ] |
| } |
| if (bundle_widevine_cdm) { |
| public_deps += [ "//third_party/widevine/cdm" ] |
| } |
| if (use_egl) { |
| public_deps += [ |
| ":strip_libEGL_shlib", |
| ":strip_libGLESv2_shlib", |
| "//third_party/angle:libEGL", |
| "//third_party/angle:libGLESv2", |
| ] |
| if (angle_shared_libvulkan && !is_chromeos) { |
| public_deps += [ |
| ":strip_libvulkan_shlib", |
| "//third_party/vulkan-deps/vulkan-loader/src:libvulkan", |
| ] |
| } |
| } |
| if (enable_swiftshader) { |
| public_deps += [ |
| ":strip_libvk_swiftshader.shlib", |
| "//third_party/swiftshader/src/Vulkan:icd_file", |
| "//third_party/swiftshader/src/Vulkan:swiftshader_libvulkan", |
| ] |
| } |
| if (!is_chromeos_ash) { |
| public_deps += [ ":rpm_packaging_files" ] |
| } |
| if (build_with_internal_optimization_guide) { |
| public_deps += [ |
| ":strip_optimization_guide", |
| "//components/optimization_guide/internal:optimization_guide_internal", |
| ] |
| } |
| } |
| |
| # Creates .deb and .rpm (RPM for non-ChromeOS only) installer packages. |
| # |
| # channel: |
| # Name of the channel. |
| template("linux_package") { |
| assert(defined(invoker.channel)) |
| channel = invoker.channel |
| |
| if (is_chrome_branded) { |
| package = "google-chrome" |
| } else { |
| package = "chromium-browser" |
| } |
| |
| deb_target_name = "${target_name}_deb" |
| action(deb_target_name) { |
| visibility = [ ":*" ] |
| script = "//build/gn_run_binary.py" |
| |
| if (current_cpu == "x86") { |
| deb_arch = "i386" |
| } else if (current_cpu == "x64") { |
| deb_arch = "amd64" |
| } else if (current_cpu == "arm") { |
| deb_arch = "armhf" |
| } else if (current_cpu == "arm64") { |
| deb_arch = "arm64" |
| } else if (current_cpu == "mipsel") { |
| deb_arch = "mipsel" |
| } else if (current_cpu == "mips64el") { |
| deb_arch = "mips64el" |
| } else { |
| assert(false, "Linux installer not configured for this architecture.") |
| } |
| |
| inputs = packaging_files |
| outputs = [ "$root_out_dir/${package}-${channel}_${chrome_version_full}-1_${deb_arch}.deb" ] |
| |
| args = [ |
| rebase_path("$root_out_dir/installer/debian/build.sh", root_build_dir), |
| "-a", |
| deb_arch, |
| "-c", |
| invoker.channel, |
| "-d", |
| branding_path_component, |
| "-o", |
| rebase_path(root_out_dir, root_build_dir), |
| "-s", |
| rebase_path(sysroot, root_build_dir), |
| "-t", |
| target_os, |
| ] |
| if (is_official_build) { |
| args += [ "-f" ] |
| } |
| deps = [ |
| ":installer_deps", |
| ":merge_deb_dependencies", |
| ] |
| } |
| |
| if (!is_chromeos_ash) { |
| rpm_target_name = "${target_name}_rpm" |
| action(rpm_target_name) { |
| visibility = [ ":*" ] |
| script = "//build/gn_run_binary.py" |
| |
| if (current_cpu == "x86") { |
| rpm_arch = "i386" |
| } else if (current_cpu == "x64") { |
| rpm_arch = "x86_64" |
| } else if (current_cpu == "arm") { |
| rpm_arch = "armhf" |
| } else if (current_cpu == "arm64") { |
| rpm_arch = "aarch64" |
| } else if (current_cpu == "mipsel") { |
| rpm_arch = "mipsel" |
| } else if (current_cpu == "mips64el") { |
| rpm_arch = "mips64el" |
| } else { |
| assert(false, "Linux installer not configured for this architecture.") |
| } |
| |
| inputs = packaging_files |
| outputs = [ "$root_out_dir/${package}-${channel}-${chrome_version_full}-1.${rpm_arch}.rpm" ] |
| |
| args = [ |
| rebase_path("$root_out_dir/installer/rpm/build.sh", root_build_dir), |
| "-a", |
| rpm_arch, |
| "-c", |
| invoker.channel, |
| "-d", |
| branding_path_component, |
| "-o", |
| rebase_path(root_out_dir, root_build_dir), |
| "-t", |
| target_os, |
| ] |
| if (is_official_build) { |
| args += [ "-f" ] |
| } |
| deps = [ |
| ":installer_deps", |
| ":merge_rpm_dependencies", |
| ] |
| } |
| |
| if (enable_snap_package) { |
| snap_target_name = "${target_name}_snap" |
| action(snap_target_name) { |
| visibility = [ ":*" ] |
| deps = [ |
| ":installer_deps", |
| ":save_build_info", |
| ] |
| script = "//build/gn_run_binary.py" |
| sources = [ |
| "snap/chrome.launcher.in", |
| "snap/snapcraft.yaml.in", |
| ] |
| if (!is_chrome_branded) { |
| package = "chromium" |
| } |
| if (current_cpu == "x86") { |
| snap_arch = "i386" |
| } else if (current_cpu == "x64") { |
| snap_arch = "amd64" |
| } else if (current_cpu == "arm") { |
| snap_arch = "armhf" |
| } else if (current_cpu == "arm64") { |
| snap_arch = "arm64" |
| } else { |
| assert(false, "Linux installer not configured for this architecture.") |
| } |
| args = [ |
| rebase_path("snap/build.sh", root_build_dir), |
| package, |
| channel, |
| chrome_version_full, |
| snap_arch, |
| target_os, |
| ] |
| outputs = [ "$root_out_dir/${package}-${channel}_${chrome_version_full}_${snap_arch}.snap" ] |
| } |
| } |
| } |
| |
| group(target_name) { |
| deps = [ ":$deb_target_name" ] |
| if (!is_chromeos_ash) { |
| deps += [ ":$rpm_target_name" ] |
| if (enable_snap_package) { |
| deps += [ ":$snap_target_name" ] |
| } |
| } |
| } |
| } |
| |
| # Standard packages. |
| linux_package("stable") { |
| channel = "stable" |
| } |
| linux_package("beta") { |
| channel = "beta" |
| } |
| linux_package("unstable") { |
| channel = "unstable" |
| } |