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