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") |
thomasanderson | 7a01af4 | 2016-10-18 21:22:42 | [diff] [blame] | 8 | import("//build/config/sysroot.gni") |
raphael.kubo.da.costa | dc683d2 | 2016-09-17 19:41:13 | [diff] [blame] | 9 | import("//build/util/process_version.gni") |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 10 | import("//build/util/version.gni") |
raphael.kubo.da.costa | dc683d2 | 2016-09-17 19:41:13 | [diff] [blame] | 11 | import("//chrome/process_version_rc_template.gni") # For branding_file_path. |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 12 | |
xhwang | c3a252b | 2016-05-23 02:35:48 | [diff] [blame] | 13 | if (current_cpu == "x86" || current_cpu == "x64") { |
| 14 | import("//media/cdm/ppapi/cdm_paths.gni") |
| 15 | } |
| 16 | |
sbc | fa8f43b | 2016-10-05 17:11:35 | [diff] [blame] | 17 | assert(is_linux) |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 18 | |
| 19 | # This target builds all "normal" Linux installers. |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 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", |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 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 | |
sbc | fa8f43b | 2016-10-05 17:11:35 | [diff] [blame] | 87 | if (is_chrome_branded) { |
tomas.popela | dd765c0 | 2017-03-21 14:44:16 | [diff] [blame^] | 88 | sources += [ |
| 89 | "common/google-chrome/google-chrome.appdata.xml.template", |
| 90 | "common/google-chrome/google-chrome.info", |
| 91 | ] |
sbc | fa8f43b | 2016-10-05 17:11:35 | [diff] [blame] | 92 | } else { |
tomas.popela | dd765c0 | 2017-03-21 14:44:16 | [diff] [blame^] | 93 | sources += [ |
| 94 | "common/chromium-browser/chromium-browser.appdata.xml", |
| 95 | "common/chromium-browser/chromium-browser.info", |
| 96 | ] |
sbc | fa8f43b | 2016-10-05 17:11:35 | [diff] [blame] | 97 | } |
| 98 | |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 99 | if (current_cpu == "x86") { |
| 100 | sources += [ "//build/linux/bin/eu-strip" ] |
| 101 | } else if (current_cpu == "x64") { |
| 102 | sources += [ "/usr/bin/eu-strip" ] |
| 103 | } |
| 104 | |
| 105 | outputs = [ |
| 106 | "$root_out_dir/installer/common/{{source_file_part}}", |
| 107 | ] |
| 108 | } |
| 109 | |
| 110 | copy("deb_packaging_files") { |
| 111 | visibility = [ ":*" ] |
| 112 | sources = [ |
| 113 | "debian/build.sh", |
| 114 | "debian/changelog.template", |
| 115 | "debian/control.template", |
| 116 | "debian/debian.menu", |
thomasanderson | 7a01af4 | 2016-10-18 21:22:42 | [diff] [blame] | 117 | "debian/expected_deps_ia32_jessie", |
| 118 | "debian/expected_deps_ia32_wheezy", |
| 119 | "debian/expected_deps_x64_jessie", |
| 120 | "debian/expected_deps_x64_wheezy", |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 121 | "debian/postinst", |
| 122 | "debian/postrm", |
| 123 | "debian/prerm", |
| 124 | ] |
| 125 | outputs = [ |
| 126 | "$root_out_dir/installer/debian/{{source_file_part}}", |
| 127 | ] |
| 128 | } |
| 129 | |
| 130 | copy("theme_files") { |
| 131 | visibility = [ ":*" ] |
| 132 | sources = [ |
| 133 | "$branding_dir/BRANDING", |
| 134 | "$branding_dir/linux/product_logo_32.xpm", |
| 135 | "$branding_dir/product_logo_128.png", |
| 136 | "$branding_dir/product_logo_22.png", |
| 137 | "$branding_dir/product_logo_24.png", |
| 138 | "$branding_dir/product_logo_256.png", |
| 139 | "$branding_dir/product_logo_48.png", |
| 140 | "$branding_dir/product_logo_64.png", |
| 141 | "$branding_dir_100/product_logo_16.png", |
| 142 | "$branding_dir_100/product_logo_32.png", |
| 143 | ] |
| 144 | outputs = [ |
| 145 | "$root_out_dir/installer/theme/{{source_file_part}}", |
| 146 | ] |
| 147 | } |
| 148 | |
| 149 | if (!is_chromeos) { |
| 150 | copy("rpm_packaging_files") { |
| 151 | visibility = [ ":*" ] |
| 152 | sources = [ |
| 153 | "rpm/build.sh", |
| 154 | "rpm/chrome.spec.template", |
| 155 | "rpm/expected_deps_i386", |
| 156 | "rpm/expected_deps_x86_64", |
| 157 | ] |
| 158 | outputs = [ |
| 159 | "$root_out_dir/installer/rpm/{{source_file_part}}", |
| 160 | ] |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | process_version("save_build_info") { |
| 165 | # Just output the default version info variables (no template). |
| 166 | process_only = true |
raphael.kubo.da.costa | dc683d2 | 2016-09-17 19:41:13 | [diff] [blame] | 167 | sources = [ |
| 168 | "//build/util/LASTCHANGE", |
| 169 | "//chrome/VERSION", |
| 170 | branding_file_path, |
| 171 | ] |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 172 | output = "$root_out_dir/installer/version.txt" |
| 173 | } |
| 174 | |
| 175 | # Dependencies for all Linux installer targets. |
| 176 | group("installer_deps") { |
mcgrathr | 6edf192f | 2015-10-19 19:39:11 | [diff] [blame] | 177 | # Though many of these things appear in data_deps further down the |
| 178 | # dependency chain, they must appear here as public_deps so that they can |
| 179 | # be listed as inputs to the actions that depend on ":installer_deps" |
| 180 | # and are guaranteed to have been built before those actions run. |
| 181 | |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 182 | public_deps = [ |
| 183 | ":common_packaging_files", |
| 184 | ":deb_packaging_files", |
| 185 | ":save_build_info", |
| 186 | ":theme_files", |
| 187 | "//chrome", |
| 188 | "//chrome:packed_resources", |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 189 | "//sandbox/linux:chrome_sandbox", |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 190 | ] |
dpranke | 3b87061 | 2015-09-10 23:42:04 | [diff] [blame] | 191 | if (enable_nacl) { |
mcgrathr | 6edf192f | 2015-10-19 19:39:11 | [diff] [blame] | 192 | public_deps += [ |
brettw | f4b4a428 | 2015-12-16 00:41:13 | [diff] [blame] | 193 | "//components/nacl/loader:nacl_helper", |
mcgrathr | 6edf192f | 2015-10-19 19:39:11 | [diff] [blame] | 194 | |
| 195 | # These are data_deps of nacl_helper, but that is not enough, |
| 196 | # as explained above. |
| 197 | "//native_client/src/trusted/service_runtime/linux:bootstrap", |
| 198 | "//ppapi/native_client:irt", |
| 199 | ] |
dpranke | 3b87061 | 2015-09-10 23:42:04 | [diff] [blame] | 200 | } |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 201 | if (current_cpu == "x86" || current_cpu == "x64") { |
| 202 | public_deps += [ |
| 203 | "//third_party/widevine/cdm:widevinecdm", |
| 204 | "//third_party/widevine/cdm:widevinecdmadapter", |
| 205 | ] |
| 206 | } |
| 207 | if (!is_chromeos) { |
| 208 | public_deps += [ ":rpm_packaging_files" ] |
| 209 | } |
xhwang | 7e98c2b | 2016-11-10 01:54:23 | [diff] [blame] | 210 | if (use_custom_libcxx) { |
| 211 | public_deps += [ "//buildtools/third_party/libc++" ] |
| 212 | } |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | # Creates .deb and .rpm (RPM for non-ChromeOS only) installer packages. |
| 216 | # |
| 217 | # channel: |
| 218 | # Name of the channel. |
| 219 | template("linux_package") { |
| 220 | assert(defined(invoker.channel)) |
| 221 | channel = invoker.channel |
| 222 | |
| 223 | if (current_cpu == "x86") { |
mcgrathr | 6edf192f | 2015-10-19 19:39:11 | [diff] [blame] | 224 | # The shell scripts use "ia32" instead of "x86". |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 225 | build_script_arch = "ia32" |
| 226 | } else { |
| 227 | build_script_arch = current_cpu |
| 228 | } |
| 229 | |
| 230 | packaging_files_binaries = [ |
| 231 | # TODO(mmoss) Any convenient way to get all the relevant build |
| 232 | # files? (e.g. all locales, resources, etc.) |
| 233 | "$root_out_dir/chrome", |
| 234 | "$root_out_dir/chrome_sandbox", |
| 235 | "$root_out_dir/xdg-mime", |
| 236 | "$root_out_dir/xdg-settings", |
| 237 | "$root_out_dir/locales/en-US.pak", |
| 238 | |
mcgrathr | 6edf192f | 2015-10-19 19:39:11 | [diff] [blame] | 239 | "$root_out_dir/nacl_helper", |
| 240 | "$root_out_dir/nacl_helper_bootstrap", |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 241 | ] |
| 242 | |
| 243 | if (current_cpu == "x86") { |
sbc | fa8f43b | 2016-10-05 17:11:35 | [diff] [blame] | 244 | packaging_files_binaries += [ "$root_out_dir/nacl_irt_x86_32.nexe" ] |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 245 | } else if (current_cpu == "x64") { |
sbc | fa8f43b | 2016-10-05 17:11:35 | [diff] [blame] | 246 | packaging_files_binaries += [ "$root_out_dir/nacl_irt_x86_64.nexe" ] |
mcgrathr | 6edf192f | 2015-10-19 19:39:11 | [diff] [blame] | 247 | } else if (current_cpu == "arm") { |
| 248 | packaging_files_binaries += [ "$root_out_dir/nacl_irt_arm.nexe" ] |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 249 | } |
sbc | fa8f43b | 2016-10-05 17:11:35 | [diff] [blame] | 250 | |
sbc | 8c9a63e | 2016-10-10 18:40:36 | [diff] [blame] | 251 | # The widevine BUILD.gn only produces shared libraries for x86 and x64 |
| 252 | if (is_chrome_branded && (current_cpu == "x86" || current_cpu == "x64")) { |
sbc | fa8f43b | 2016-10-05 17:11:35 | [diff] [blame] | 253 | packaging_files_binaries += [ |
| 254 | "$root_out_dir/$widevine_cdm_path/libwidevinecdmadapter.so", |
| 255 | "$root_out_dir/$widevine_cdm_path/libwidevinecdm.so", |
| 256 | ] |
| 257 | } |
| 258 | |
xhwang | 7e98c2b | 2016-11-10 01:54:23 | [diff] [blame] | 259 | if (use_custom_libcxx) { |
| 260 | packaging_files_binaries += [ "$root_out_dir/libc++.so" ] |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 261 | } |
| 262 | |
| 263 | deb_target_name = "${target_name}_deb" |
| 264 | action(deb_target_name) { |
| 265 | visibility = [ ":*" ] |
| 266 | script = "flock_make_package.py" |
| 267 | |
| 268 | if (current_cpu == "x86") { |
| 269 | deb_arch = "i386" |
| 270 | } else if (current_cpu == "x64") { |
| 271 | deb_arch = "amd64" |
| 272 | } else if (current_cpu == "arm") { |
| 273 | deb_arch = "arm" |
| 274 | } else { |
| 275 | assert(false, "Linux installer not configured for this architecture.") |
| 276 | } |
| 277 | |
| 278 | inputs = packaging_files_binaries |
| 279 | outputs = [ |
| 280 | "$root_out_dir/google-chrome-${channel}_${chrome_version_full}-1_${deb_arch}.deb", |
| 281 | ] |
| 282 | |
| 283 | args = [ |
| 284 | rebase_path("$root_out_dir/linux_package.lock", root_build_dir), |
| 285 | rebase_path("$root_out_dir/installer/debian/build.sh", root_build_dir), |
| 286 | "-o", |
| 287 | rebase_path(root_out_dir, root_build_dir), |
| 288 | "-b", |
| 289 | rebase_path(root_out_dir, root_build_dir), |
| 290 | "-a", |
| 291 | build_script_arch, |
| 292 | "-c", |
| 293 | invoker.channel, |
| 294 | "-d", |
| 295 | branding_path_component, |
thomasanderson | 7a01af4 | 2016-10-18 21:22:42 | [diff] [blame] | 296 | "-s", |
| 297 | rebase_path(sysroot), |
brettw | a874dcc | 2015-08-28 23:59:18 | [diff] [blame] | 298 | ] |
| 299 | deps = [ |
| 300 | ":installer_deps", |
| 301 | ] |
| 302 | } |
| 303 | |
| 304 | if (!is_chromeos) { |
| 305 | rpm_target_name = "${target_name}_rpm" |
| 306 | action(rpm_target_name) { |
| 307 | visibility = [ ":*" ] |
| 308 | script = "flock_make_package.py" |
| 309 | |
| 310 | if (current_cpu == "x86") { |
| 311 | rpm_arch = "i386" |
| 312 | } else if (current_cpu == "x64") { |
| 313 | rpm_arch = "x86_64" |
| 314 | } else if (current_cpu == "arm") { |
| 315 | rpm_arch = "arm" |
| 316 | } else { |
| 317 | assert(false, "Linux installer not configured for this architecture.") |
| 318 | } |
| 319 | |
| 320 | inputs = packaging_files_binaries |
| 321 | outputs = [ |
| 322 | "$root_out_dir/google-chrome-${channel}_${chrome_version_full}-1.${rpm_arch}.rpm", |
| 323 | ] |
| 324 | |
| 325 | args = [ |
| 326 | rebase_path("$root_out_dir/linux_package.lock", root_build_dir), |
| 327 | rebase_path("$root_out_dir/installer/rpm/build.sh", root_build_dir), |
| 328 | "-o", |
| 329 | rebase_path(root_out_dir, root_build_dir), |
| 330 | "-b", |
| 331 | rebase_path(root_out_dir, root_build_dir), |
| 332 | "-a", |
| 333 | build_script_arch, |
| 334 | "-c", |
| 335 | invoker.channel, |
| 336 | "-d", |
| 337 | branding_path_component, |
| 338 | ] |
| 339 | deps = [ |
| 340 | ":installer_deps", |
| 341 | ] |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | group(target_name) { |
| 346 | deps = [ |
| 347 | ":$deb_target_name", |
| 348 | ] |
| 349 | if (!is_chromeos) { |
| 350 | deps += [ ":$rpm_target_name" ] |
| 351 | } |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | # Standard packages. |
| 356 | linux_package("stable") { |
| 357 | channel = "stable" |
| 358 | } |
| 359 | linux_package("beta") { |
| 360 | channel = "beta" |
| 361 | } |
| 362 | linux_package("unstable") { |
| 363 | channel = "unstable" |
| 364 | } |
| 365 | |
| 366 | # Other packages that we support that aren't included in the default "linux" |
| 367 | # target. |
| 368 | linux_package("trunk") { |
| 369 | channel = "trunk" |
| 370 | } |
| 371 | if (is_asan) { |
| 372 | linux_package("asan") { |
| 373 | channel = "asan" |
| 374 | } |
| 375 | } |