brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 1 | # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | import("//build/config/chrome_build.gni") |
dpranke | 3b87061 | 2015-09-10 23:42:04 | [diff] [blame] | 6 | import("//build/config/features.gni") |
brettw | 4cab0f1 | 2015-09-14 21:40:01 | [diff] [blame] | 7 | import("//build/config/sanitizers/sanitizers.gni") |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 8 | import("//build/util/version.gni") |
| 9 | import("//chrome/version.gni") |
| 10 | |
xhwang | c3a252b | 2016-05-23 02:35:48 | [diff] [blame^] | 11 | if (current_cpu == "x86" || current_cpu == "x64") { |
| 12 | import("//media/cdm/ppapi/cdm_paths.gni") |
| 13 | } |
| 14 | |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 15 | assert(is_linux && is_chrome_branded) |
| 16 | |
| 17 | # This target builds all "normal" Linux installers. |
| 18 | # GYP version: chrome/chrome_installer.gypi:linux_packages_all |
| 19 | # |
| 20 | # The bot setup is to build stable, unstable, and beta packages for the current |
| 21 | # build. Then a later step picks up the package corresponding to what the |
| 22 | # current build is supposed to be. This is wasteful since one build will only |
| 23 | # be one of these. This build file also has targets for trunk and possibly asan |
| 24 | # installers. |
| 25 | # |
| 26 | # TODO it would be much nicer to have a build variable so the bot can tell us |
| 27 | # what the current build should be, so we only have to make one .deb/.rpm pair. |
| 28 | # |
| 29 | # |
| 30 | # TO BUILD LINUX INSTALLER PACKAGES |
| 31 | # |
| 32 | # The packages list the exact versions of each library used. The versions used |
| 33 | # on the bots are likely different than those on your workstation, so you'll |
| 34 | # get a stream of errors like: |
| 35 | # < libasound2 (>= 1.0.23) |
| 36 | # --- |
| 37 | # > libasound2 (>= 1.0.16) |
| 38 | # |
| 39 | # To avoid these warnings for testing purposes, do: |
| 40 | # |
| 41 | # export IGNORE_DEPS_CHANGES=1 |
| 42 | # |
| 43 | # before you build. |
| 44 | group("linux") { |
| 45 | deps = [ |
| 46 | ":beta", |
| 47 | ":stable", |
| 48 | ":unstable", |
| 49 | ] |
| 50 | } |
| 51 | |
dpranke | b8c6d5f | 2015-10-02 19:52:37 | [diff] [blame] | 52 | # This target is provided for compatibility w/ GYP. Users should always |
| 53 | # depend directly on :linux instead of this target (we set visibility |
| 54 | # to the empty list to prevent unwanted callers). |
brettw | 57399c5 | 2016-05-10 18:34:05 | [diff] [blame] | 55 | # TODO(GYP_GONE): Delete this target after we've migrated away from GYP and |
dpranke | b8c6d5f | 2015-10-02 19:52:37 | [diff] [blame] | 56 | # updated the bots to build :linux instead. |
| 57 | group("linux_packages_all") { |
| 58 | visibility = [] |
| 59 | deps = [ |
| 60 | ":linux", |
| 61 | ] |
| 62 | } |
| 63 | |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 64 | branding_dir = "//chrome/app/theme/$branding_path_component" |
| 65 | branding_dir_100 = |
| 66 | "//chrome/app/theme/default_100_percent/$branding_path_component" |
| 67 | |
| 68 | copy("common_packaging_files") { |
| 69 | visibility = [ ":*" ] |
| 70 | sources = [ |
| 71 | "common/apt.include", |
| 72 | "common/default-app-block.template", |
| 73 | "common/default-app.template", |
| 74 | "common/desktop.template", |
| 75 | "common/google-chrome/google-chrome.info", |
| 76 | "common/installer.include", |
| 77 | "common/postinst.include", |
| 78 | "common/prerm.include", |
| 79 | "common/repo.cron", |
| 80 | "common/rpm.include", |
| 81 | "common/rpmrepo.cron", |
| 82 | "common/symlinks.include", |
| 83 | "common/variables.include", |
| 84 | "common/wrapper", |
| 85 | ] |
| 86 | |
| 87 | if (current_cpu == "x86") { |
| 88 | sources += [ "//build/linux/bin/eu-strip" ] |
| 89 | } else if (current_cpu == "x64") { |
| 90 | sources += [ "/usr/bin/eu-strip" ] |
| 91 | } |
| 92 | |
| 93 | outputs = [ |
| 94 | "$root_out_dir/installer/common/{{source_file_part}}", |
| 95 | ] |
| 96 | } |
| 97 | |
| 98 | copy("deb_packaging_files") { |
| 99 | visibility = [ ":*" ] |
| 100 | sources = [ |
| 101 | "debian/build.sh", |
| 102 | "debian/changelog.template", |
| 103 | "debian/control.template", |
| 104 | "debian/debian.menu", |
| 105 | "debian/expected_deps_ia32", |
| 106 | "debian/expected_deps_x64", |
| 107 | "debian/postinst", |
| 108 | "debian/postrm", |
| 109 | "debian/prerm", |
| 110 | ] |
| 111 | outputs = [ |
| 112 | "$root_out_dir/installer/debian/{{source_file_part}}", |
| 113 | ] |
| 114 | } |
| 115 | |
| 116 | copy("theme_files") { |
| 117 | visibility = [ ":*" ] |
| 118 | sources = [ |
| 119 | "$branding_dir/BRANDING", |
| 120 | "$branding_dir/linux/product_logo_32.xpm", |
| 121 | "$branding_dir/product_logo_128.png", |
| 122 | "$branding_dir/product_logo_22.png", |
| 123 | "$branding_dir/product_logo_24.png", |
| 124 | "$branding_dir/product_logo_256.png", |
| 125 | "$branding_dir/product_logo_48.png", |
| 126 | "$branding_dir/product_logo_64.png", |
| 127 | "$branding_dir_100/product_logo_16.png", |
| 128 | "$branding_dir_100/product_logo_32.png", |
| 129 | ] |
| 130 | outputs = [ |
| 131 | "$root_out_dir/installer/theme/{{source_file_part}}", |
| 132 | ] |
| 133 | } |
| 134 | |
| 135 | if (!is_chromeos) { |
| 136 | copy("rpm_packaging_files") { |
| 137 | visibility = [ ":*" ] |
| 138 | sources = [ |
| 139 | "rpm/build.sh", |
| 140 | "rpm/chrome.spec.template", |
| 141 | "rpm/expected_deps_i386", |
| 142 | "rpm/expected_deps_x86_64", |
| 143 | ] |
| 144 | outputs = [ |
| 145 | "$root_out_dir/installer/rpm/{{source_file_part}}", |
| 146 | ] |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | process_version("save_build_info") { |
| 151 | # Just output the default version info variables (no template). |
| 152 | process_only = true |
| 153 | output = "$root_out_dir/installer/version.txt" |
| 154 | } |
| 155 | |
| 156 | # Dependencies for all Linux installer targets. |
| 157 | group("installer_deps") { |
mcgrathr | 6edf192f | 2015-10-19 19:39:11 | [diff] [blame] | 158 | # Though many of these things appear in data_deps further down the |
| 159 | # dependency chain, they must appear here as public_deps so that they can |
| 160 | # be listed as inputs to the actions that depend on ":installer_deps" |
| 161 | # and are guaranteed to have been built before those actions run. |
| 162 | |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 163 | public_deps = [ |
| 164 | ":common_packaging_files", |
| 165 | ":deb_packaging_files", |
| 166 | ":save_build_info", |
| 167 | ":theme_files", |
| 168 | "//chrome", |
| 169 | "//chrome:packed_resources", |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 170 | "//sandbox/linux:chrome_sandbox", |
| 171 | "//third_party/adobe/flash:flapper_binaries", |
| 172 | ] |
dpranke | 3b87061 | 2015-09-10 23:42:04 | [diff] [blame] | 173 | if (enable_nacl) { |
mcgrathr | 6edf192f | 2015-10-19 19:39:11 | [diff] [blame] | 174 | public_deps += [ |
brettw | f4b4a428 | 2015-12-16 00:41:13 | [diff] [blame] | 175 | "//components/nacl/loader:nacl_helper", |
mcgrathr | 6edf192f | 2015-10-19 19:39:11 | [diff] [blame] | 176 | |
| 177 | # These are data_deps of nacl_helper, but that is not enough, |
| 178 | # as explained above. |
| 179 | "//native_client/src/trusted/service_runtime/linux:bootstrap", |
| 180 | "//ppapi/native_client:irt", |
| 181 | ] |
dpranke | 3b87061 | 2015-09-10 23:42:04 | [diff] [blame] | 182 | } |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 183 | if (current_cpu == "x86" || current_cpu == "x64") { |
| 184 | public_deps += [ |
| 185 | "//third_party/widevine/cdm:widevinecdm", |
| 186 | "//third_party/widevine/cdm:widevinecdmadapter", |
| 187 | ] |
| 188 | } |
| 189 | if (!is_chromeos) { |
| 190 | public_deps += [ ":rpm_packaging_files" ] |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | # Creates .deb and .rpm (RPM for non-ChromeOS only) installer packages. |
| 195 | # |
| 196 | # channel: |
| 197 | # Name of the channel. |
| 198 | template("linux_package") { |
| 199 | assert(defined(invoker.channel)) |
| 200 | channel = invoker.channel |
| 201 | |
| 202 | if (current_cpu == "x86") { |
mcgrathr | 6edf192f | 2015-10-19 19:39:11 | [diff] [blame] | 203 | # The shell scripts use "ia32" instead of "x86". |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 204 | build_script_arch = "ia32" |
| 205 | } else { |
| 206 | build_script_arch = current_cpu |
| 207 | } |
| 208 | |
| 209 | packaging_files_binaries = [ |
| 210 | # TODO(mmoss) Any convenient way to get all the relevant build |
| 211 | # files? (e.g. all locales, resources, etc.) |
| 212 | "$root_out_dir/chrome", |
| 213 | "$root_out_dir/chrome_sandbox", |
| 214 | "$root_out_dir/xdg-mime", |
| 215 | "$root_out_dir/xdg-settings", |
| 216 | "$root_out_dir/locales/en-US.pak", |
| 217 | |
mcgrathr | 6edf192f | 2015-10-19 19:39:11 | [diff] [blame] | 218 | "$root_out_dir/nacl_helper", |
| 219 | "$root_out_dir/nacl_helper_bootstrap", |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 220 | "$root_out_dir/PepperFlash/libpepflashplayer.so", |
| 221 | "$root_out_dir/PepperFlash/manifest.json", |
| 222 | ] |
| 223 | |
| 224 | if (current_cpu == "x86") { |
| 225 | packaging_files_binaries += [ |
mcgrathr | 6edf192f | 2015-10-19 19:39:11 | [diff] [blame] | 226 | "$root_out_dir/nacl_irt_x86_32.nexe", |
xhwang | c3a252b | 2016-05-23 02:35:48 | [diff] [blame^] | 227 | "$root_out_dir/$widevine_cdm_path/libwidevinecdmadapter.so", |
| 228 | "$root_out_dir/$widevine_cdm_path/libwidevinecdm.so", |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 229 | ] |
| 230 | } else if (current_cpu == "x64") { |
| 231 | packaging_files_binaries += [ |
mcgrathr | 6edf192f | 2015-10-19 19:39:11 | [diff] [blame] | 232 | "$root_out_dir/nacl_irt_x86_64.nexe", |
xhwang | c3a252b | 2016-05-23 02:35:48 | [diff] [blame^] | 233 | "$root_out_dir/$widevine_cdm_path/libwidevinecdmadapter.so", |
| 234 | "$root_out_dir/$widevine_cdm_path/libwidevinecdm.so", |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 235 | ] |
mcgrathr | 6edf192f | 2015-10-19 19:39:11 | [diff] [blame] | 236 | } else if (current_cpu == "arm") { |
| 237 | packaging_files_binaries += [ "$root_out_dir/nacl_irt_arm.nexe" ] |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 238 | } |
| 239 | if (is_asan) { |
| 240 | packaging_files_binaries += [ "$root_out_dir/lib/libc++.so" ] |
| 241 | } |
| 242 | |
| 243 | deb_target_name = "${target_name}_deb" |
| 244 | action(deb_target_name) { |
| 245 | visibility = [ ":*" ] |
| 246 | script = "flock_make_package.py" |
| 247 | |
| 248 | if (current_cpu == "x86") { |
| 249 | deb_arch = "i386" |
| 250 | } else if (current_cpu == "x64") { |
| 251 | deb_arch = "amd64" |
| 252 | } else if (current_cpu == "arm") { |
| 253 | deb_arch = "arm" |
| 254 | } else { |
| 255 | assert(false, "Linux installer not configured for this architecture.") |
| 256 | } |
| 257 | |
| 258 | inputs = packaging_files_binaries |
| 259 | outputs = [ |
| 260 | "$root_out_dir/google-chrome-${channel}_${chrome_version_full}-1_${deb_arch}.deb", |
| 261 | ] |
| 262 | |
| 263 | args = [ |
| 264 | rebase_path("$root_out_dir/linux_package.lock", root_build_dir), |
| 265 | rebase_path("$root_out_dir/installer/debian/build.sh", root_build_dir), |
| 266 | "-o", |
| 267 | rebase_path(root_out_dir, root_build_dir), |
| 268 | "-b", |
| 269 | rebase_path(root_out_dir, root_build_dir), |
| 270 | "-a", |
| 271 | build_script_arch, |
| 272 | "-c", |
| 273 | invoker.channel, |
| 274 | "-d", |
| 275 | branding_path_component, |
| 276 | ] |
| 277 | deps = [ |
| 278 | ":installer_deps", |
| 279 | ] |
| 280 | } |
| 281 | |
| 282 | if (!is_chromeos) { |
| 283 | rpm_target_name = "${target_name}_rpm" |
| 284 | action(rpm_target_name) { |
| 285 | visibility = [ ":*" ] |
| 286 | script = "flock_make_package.py" |
| 287 | |
| 288 | if (current_cpu == "x86") { |
| 289 | rpm_arch = "i386" |
| 290 | } else if (current_cpu == "x64") { |
| 291 | rpm_arch = "x86_64" |
| 292 | } else if (current_cpu == "arm") { |
| 293 | rpm_arch = "arm" |
| 294 | } else { |
| 295 | assert(false, "Linux installer not configured for this architecture.") |
| 296 | } |
| 297 | |
| 298 | inputs = packaging_files_binaries |
| 299 | outputs = [ |
| 300 | "$root_out_dir/google-chrome-${channel}_${chrome_version_full}-1.${rpm_arch}.rpm", |
| 301 | ] |
| 302 | |
| 303 | args = [ |
| 304 | rebase_path("$root_out_dir/linux_package.lock", root_build_dir), |
| 305 | rebase_path("$root_out_dir/installer/rpm/build.sh", root_build_dir), |
| 306 | "-o", |
| 307 | rebase_path(root_out_dir, root_build_dir), |
| 308 | "-b", |
| 309 | rebase_path(root_out_dir, root_build_dir), |
| 310 | "-a", |
| 311 | build_script_arch, |
| 312 | "-c", |
| 313 | invoker.channel, |
| 314 | "-d", |
| 315 | branding_path_component, |
| 316 | ] |
| 317 | deps = [ |
| 318 | ":installer_deps", |
| 319 | ] |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | group(target_name) { |
| 324 | deps = [ |
| 325 | ":$deb_target_name", |
| 326 | ] |
| 327 | if (!is_chromeos) { |
| 328 | deps += [ ":$rpm_target_name" ] |
| 329 | } |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | # Standard packages. |
| 334 | linux_package("stable") { |
| 335 | channel = "stable" |
| 336 | } |
| 337 | linux_package("beta") { |
| 338 | channel = "beta" |
| 339 | } |
| 340 | linux_package("unstable") { |
| 341 | channel = "unstable" |
| 342 | } |
| 343 | |
| 344 | # Other packages that we support that aren't included in the default "linux" |
| 345 | # target. |
| 346 | linux_package("trunk") { |
| 347 | channel = "trunk" |
| 348 | } |
| 349 | if (is_asan) { |
| 350 | linux_package("asan") { |
| 351 | channel = "asan" |
| 352 | } |
| 353 | } |