blob: 9d0f2854e25a616b7ea34267dafc728e26c45a69 [file] [log] [blame]
brettwa874dcc2015-08-28 23:59:181# 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
thomasanderson018ffc7f2017-06-22 01:25:335import("//build/config/c++/c++.gni")
brettwa874dcc2015-08-28 23:59:186import("//build/config/chrome_build.gni")
dpranke3b870612015-09-10 23:42:047import("//build/config/features.gni")
brettw4cab0f12015-09-14 21:40:018import("//build/config/sanitizers/sanitizers.gni")
thomasanderson7a01af42016-10-18 21:22:429import("//build/config/sysroot.gni")
raphael.kubo.da.costadc683d22016-09-17 19:41:1310import("//build/util/process_version.gni")
brettwa874dcc2015-08-28 23:59:1811import("//build/util/version.gni")
raphael.kubo.da.costadc683d22016-09-17 19:41:1312import("//chrome/process_version_rc_template.gni") # For branding_file_path.
brettwa874dcc2015-08-28 23:59:1813
xhwangc3a252b2016-05-23 02:35:4814if (current_cpu == "x86" || current_cpu == "x64") {
15 import("//media/cdm/ppapi/cdm_paths.gni")
16}
17
sbcfa8f43b2016-10-05 17:11:3518assert(is_linux)
brettwa874dcc2015-08-28 23:59:1819
Tom Anderson7f6acf62017-09-08 03:13:0920packaging_files_executables = [
Tom Andersone068dcb2017-09-01 18:31:2121 "$root_out_dir/chrome",
22 "$root_out_dir/chrome_sandbox",
23]
Tom Anderson7f6acf62017-09-08 03:13:0924packaging_files_shlibs = []
Tom Andersone068dcb2017-09-01 18:31:2125
26if (enable_nacl) {
Tom Anderson7f6acf62017-09-08 03:13:0927 packaging_files_executables += [
Tom Andersone068dcb2017-09-01 18:31:2128 "$root_out_dir/nacl_helper",
29 "$root_out_dir/nacl_helper_bootstrap",
30 ]
31
32 if (current_cpu == "x86") {
Tom Anderson7f6acf62017-09-08 03:13:0933 packaging_files_executables += [ "$root_out_dir/nacl_irt_x86_32.nexe" ]
Tom Andersone068dcb2017-09-01 18:31:2134 } else if (current_cpu == "x64") {
Tom Anderson7f6acf62017-09-08 03:13:0935 packaging_files_executables += [ "$root_out_dir/nacl_irt_x86_64.nexe" ]
Tom Andersone068dcb2017-09-01 18:31:2136 } else if (current_cpu == "arm") {
Tom Anderson7f6acf62017-09-08 03:13:0937 packaging_files_executables += [ "$root_out_dir/nacl_irt_arm.nexe" ]
Tom Andersone068dcb2017-09-01 18:31:2138 }
39}
40
41# The widevine BUILD.gn only produces shared libraries for x86 and x64
42if (is_chrome_branded && (current_cpu == "x86" || current_cpu == "x64")) {
Tom Anderson7f6acf62017-09-08 03:13:0943 packaging_files_shlibs += [
Tom Andersone068dcb2017-09-01 18:31:2144 "$root_out_dir/$widevine_cdm_path/libwidevinecdmadapter.so",
45 "$root_out_dir/$widevine_cdm_path/libwidevinecdm.so",
46 ]
47}
48
49if (!libcpp_is_static && use_custom_libcxx) {
Tom Anderson7f6acf62017-09-08 03:13:0950 packaging_files_shlibs += [ "$root_out_dir/libc++.so" ]
Tom Andersone068dcb2017-09-01 18:31:2151}
52
Tom Anderson7f6acf62017-09-08 03:13:0953packaging_files_binaries = packaging_files_executables + packaging_files_shlibs
54
Tom Andersone068dcb2017-09-01 18:31:2155# TODO(mmoss) Any convenient way to get all the relevant build files?
56# (e.g. all locales, resources, etc.)
57packaging_files = packaging_files_binaries + [
58 "$root_out_dir/xdg-mime",
59 "$root_out_dir/xdg-settings",
60 "$root_out_dir/locales/en-US.pak",
61 ]
62
Tom Andersona80a9b42017-09-07 02:35:3363action_foreach("calculate_deb_dependencies") {
Tom Andersone068dcb2017-09-01 18:31:2164 deps = [
65 ":installer_deps",
66 ]
Tom Andersona80a9b42017-09-07 02:35:3367 script = "debian/calculate_package_deps.py"
Tom Andersone068dcb2017-09-01 18:31:2168 sources = packaging_files_binaries
Tom Anderson3a3c5882017-09-12 21:16:2469 inputs = [
70 "debian/deb_version.py",
71 "debian/dist-package-versions.json",
72 "debian/package_version_interval.py",
73 ]
Tom Andersone068dcb2017-09-01 18:31:2174 outputs = [
Tom Andersona80a9b42017-09-07 02:35:3375 "$root_out_dir/deb_{{source_name_part}}.deps",
Tom Andersone068dcb2017-09-01 18:31:2176 ]
77 args = [
78 "{{source}}",
79 rebase_path(sysroot, root_build_dir),
80 target_cpu,
Tom Andersona80a9b42017-09-07 02:35:3381 "deb_{{source_name_part}}.deps",
Tom Andersone068dcb2017-09-01 18:31:2182 ]
Tom Andersonc92bc272017-09-15 23:12:5783 if (is_desktop_linux) {
84 args += [ "--distro-check" ]
85 }
Tom Andersone068dcb2017-09-01 18:31:2186}
87
Tom Andersona80a9b42017-09-07 02:35:3388action("merge_deb_dependencies") {
89 deps = [
90 ":calculate_deb_dependencies",
91 ]
92 script = "debian/merge_package_versions.py"
Tom Anderson21254bb2017-09-07 04:07:1893 additional_deps = "debian/additional_deps"
94 inputs = [
95 additional_deps,
Tom Anderson3a3c5882017-09-12 21:16:2496 "debian/deb_version.py",
97 "debian/package_version_interval.py",
Tom Andersona80a9b42017-09-07 02:35:3398 ]
Tom Anderson21254bb2017-09-07 04:07:1899 outputs = [
100 "$root_out_dir/deb_common.deps",
101 ]
102 args = [
103 "deb_common.deps",
104 rebase_path(additional_deps, root_build_dir),
105 ]
Tom Andersona80a9b42017-09-07 02:35:33106 args += rebase_path(get_target_outputs(":calculate_deb_dependencies"),
107 root_build_dir)
108}
109
Tom Anderson7f6acf62017-09-08 03:13:09110action_foreach("calculate_rpm_dependencies") {
111 deps = [
112 ":installer_deps",
113 ]
114 script = "rpm/calculate_package_deps.py"
115 sources = packaging_files_binaries
Tom Anderson3a3c5882017-09-12 21:16:24116 inputs = [
117 "rpm/dist-package-provides.json",
118 ]
Tom Anderson7f6acf62017-09-08 03:13:09119 outputs = [
120 "$root_out_dir/rpm_{{source_name_part}}.deps",
121 ]
122 args = [
123 "{{source}}",
124 "rpm_{{source_name_part}}.deps",
125 ]
126 args += rebase_path(packaging_files_shlibs, root_build_dir)
Tom Andersonc92bc272017-09-15 23:12:57127 if (is_desktop_linux) {
128 args += [ "--distro-check" ]
129 }
Tom Anderson7f6acf62017-09-08 03:13:09130}
131
132action("merge_rpm_dependencies") {
133 deps = [
134 ":calculate_rpm_dependencies",
135 ]
136 script = "rpm/merge_package_deps.py"
Tom Anderson3a3c5882017-09-12 21:16:24137 additional_deps = "rpm/additional_deps"
138 inputs = [
139 additional_deps,
140 ]
Tom Anderson7f6acf62017-09-08 03:13:09141 outputs = [
142 "$root_out_dir/rpm_common.deps",
143 ]
Tom Anderson3a3c5882017-09-12 21:16:24144 args = [
145 "rpm_common.deps",
146 rebase_path(additional_deps, root_build_dir),
147 ]
Tom Anderson7f6acf62017-09-08 03:13:09148 args += rebase_path(get_target_outputs(":calculate_rpm_dependencies"),
149 root_build_dir)
150}
151
Tom Andersonce16a0c2017-09-02 00:27:51152action("strip_chrome_binary") {
153 prog_name = "$root_out_dir/chrome"
154 debug_file = prog_name + ".debug"
155 stripped_file = prog_name + ".stripped"
156 deps = [
157 "//chrome",
158 ]
159 script = "strip-chrome-binary.py"
160 sources = [
161 prog_name,
162 ]
163 outputs = [
164 debug_file,
165 stripped_file,
166 ]
167 args = [
168 rebase_path("//third_party/eu-strip/bin/eu-strip", root_build_dir),
169 rebase_path(prog_name, root_build_dir),
170 rebase_path(debug_file, root_build_dir),
171 rebase_path(stripped_file, root_build_dir),
172 ]
173}
174
brettwa874dcc2015-08-28 23:59:18175# This target builds all "normal" Linux installers.
brettwa874dcc2015-08-28 23:59:18176#
177# The bot setup is to build stable, unstable, and beta packages for the current
178# build. Then a later step picks up the package corresponding to what the
179# current build is supposed to be. This is wasteful since one build will only
Tom Anderson1d582482017-09-05 20:41:28180# be one of these.
brettwa874dcc2015-08-28 23:59:18181#
182# TODO it would be much nicer to have a build variable so the bot can tell us
183# what the current build should be, so we only have to make one .deb/.rpm pair.
184#
185#
186# TO BUILD LINUX INSTALLER PACKAGES
187#
188# The packages list the exact versions of each library used. The versions used
189# on the bots are likely different than those on your workstation, so you'll
190# get a stream of errors like:
191# < libasound2 (>= 1.0.23)
192# ---
193# > libasound2 (>= 1.0.16)
194#
195# To avoid these warnings for testing purposes, do:
196#
197# export IGNORE_DEPS_CHANGES=1
198#
199# before you build.
200group("linux") {
201 deps = [
202 ":beta",
203 ":stable",
204 ":unstable",
205 ]
206}
207
208branding_dir = "//chrome/app/theme/$branding_path_component"
209branding_dir_100 =
210 "//chrome/app/theme/default_100_percent/$branding_path_component"
211
212copy("common_packaging_files") {
213 visibility = [ ":*" ]
214 sources = [
215 "common/apt.include",
216 "common/default-app-block.template",
217 "common/default-app.template",
218 "common/desktop.template",
brettwa874dcc2015-08-28 23:59:18219 "common/installer.include",
220 "common/postinst.include",
221 "common/prerm.include",
222 "common/repo.cron",
223 "common/rpm.include",
224 "common/rpmrepo.cron",
225 "common/symlinks.include",
226 "common/variables.include",
227 "common/wrapper",
228 ]
229
sbcfa8f43b2016-10-05 17:11:35230 if (is_chrome_branded) {
tomas.popeladd765c02017-03-21 14:44:16231 sources += [
232 "common/google-chrome/google-chrome.appdata.xml.template",
233 "common/google-chrome/google-chrome.info",
234 ]
sbcfa8f43b2016-10-05 17:11:35235 } else {
tomas.popeladd765c02017-03-21 14:44:16236 sources += [
237 "common/chromium-browser/chromium-browser.appdata.xml",
238 "common/chromium-browser/chromium-browser.info",
239 ]
sbcfa8f43b2016-10-05 17:11:35240 }
241
Tom Anderson4312d5e2017-06-22 21:07:43242 sources += [ "//third_party/eu-strip/bin/eu-strip" ]
brettwa874dcc2015-08-28 23:59:18243
244 outputs = [
245 "$root_out_dir/installer/common/{{source_file_part}}",
246 ]
247}
248
249copy("deb_packaging_files") {
250 visibility = [ ":*" ]
251 sources = [
252 "debian/build.sh",
253 "debian/changelog.template",
254 "debian/control.template",
255 "debian/debian.menu",
brettwa874dcc2015-08-28 23:59:18256 "debian/postinst",
257 "debian/postrm",
258 "debian/prerm",
259 ]
260 outputs = [
261 "$root_out_dir/installer/debian/{{source_file_part}}",
262 ]
263}
264
265copy("theme_files") {
266 visibility = [ ":*" ]
267 sources = [
268 "$branding_dir/BRANDING",
269 "$branding_dir/linux/product_logo_32.xpm",
270 "$branding_dir/product_logo_128.png",
271 "$branding_dir/product_logo_22.png",
272 "$branding_dir/product_logo_24.png",
273 "$branding_dir/product_logo_256.png",
274 "$branding_dir/product_logo_48.png",
275 "$branding_dir/product_logo_64.png",
276 "$branding_dir_100/product_logo_16.png",
277 "$branding_dir_100/product_logo_32.png",
278 ]
279 outputs = [
280 "$root_out_dir/installer/theme/{{source_file_part}}",
281 ]
282}
283
284if (!is_chromeos) {
285 copy("rpm_packaging_files") {
286 visibility = [ ":*" ]
287 sources = [
288 "rpm/build.sh",
289 "rpm/chrome.spec.template",
brettwa874dcc2015-08-28 23:59:18290 ]
291 outputs = [
292 "$root_out_dir/installer/rpm/{{source_file_part}}",
293 ]
294 }
295}
296
297process_version("save_build_info") {
298 # Just output the default version info variables (no template).
299 process_only = true
raphael.kubo.da.costadc683d22016-09-17 19:41:13300 sources = [
301 "//build/util/LASTCHANGE",
302 "//chrome/VERSION",
303 branding_file_path,
304 ]
brettwa874dcc2015-08-28 23:59:18305 output = "$root_out_dir/installer/version.txt"
306}
307
308# Dependencies for all Linux installer targets.
309group("installer_deps") {
mcgrathr6edf192f2015-10-19 19:39:11310 # Though many of these things appear in data_deps further down the
311 # dependency chain, they must appear here as public_deps so that they can
312 # be listed as inputs to the actions that depend on ":installer_deps"
313 # and are guaranteed to have been built before those actions run.
314
brettwa874dcc2015-08-28 23:59:18315 public_deps = [
316 ":common_packaging_files",
317 ":deb_packaging_files",
318 ":save_build_info",
Tom Andersonce16a0c2017-09-02 00:27:51319 ":strip_chrome_binary",
brettwa874dcc2015-08-28 23:59:18320 ":theme_files",
321 "//chrome",
322 "//chrome:packed_resources",
brettwa874dcc2015-08-28 23:59:18323 "//sandbox/linux:chrome_sandbox",
brettwa874dcc2015-08-28 23:59:18324 ]
dpranke3b870612015-09-10 23:42:04325 if (enable_nacl) {
mcgrathr6edf192f2015-10-19 19:39:11326 public_deps += [
brettwf4b4a4282015-12-16 00:41:13327 "//components/nacl/loader:nacl_helper",
mcgrathr6edf192f2015-10-19 19:39:11328
329 # These are data_deps of nacl_helper, but that is not enough,
330 # as explained above.
331 "//native_client/src/trusted/service_runtime/linux:bootstrap",
332 "//ppapi/native_client:irt",
333 ]
dpranke3b870612015-09-10 23:42:04334 }
brettwa874dcc2015-08-28 23:59:18335 if (current_cpu == "x86" || current_cpu == "x64") {
336 public_deps += [
337 "//third_party/widevine/cdm:widevinecdm",
338 "//third_party/widevine/cdm:widevinecdmadapter",
339 ]
340 }
341 if (!is_chromeos) {
342 public_deps += [ ":rpm_packaging_files" ]
343 }
Tom Anderson45583c72017-07-08 02:53:34344
Tom Anderson45583c72017-07-08 02:53:34345 if (!libcpp_is_static && use_custom_libcxx) {
346 public_deps += [ "//buildtools/third_party/libc++:libc++" ]
347 }
brettwa874dcc2015-08-28 23:59:18348}
349
350# Creates .deb and .rpm (RPM for non-ChromeOS only) installer packages.
351#
352# channel:
353# Name of the channel.
354template("linux_package") {
355 assert(defined(invoker.channel))
356 channel = invoker.channel
357
358 if (current_cpu == "x86") {
mcgrathr6edf192f2015-10-19 19:39:11359 # The shell scripts use "ia32" instead of "x86".
brettwa874dcc2015-08-28 23:59:18360 build_script_arch = "ia32"
361 } else {
362 build_script_arch = current_cpu
363 }
364
brettwa874dcc2015-08-28 23:59:18365 deb_target_name = "${target_name}_deb"
366 action(deb_target_name) {
367 visibility = [ ":*" ]
Tom Anderson29332fdd2017-09-12 00:18:34368 script = "make_package.py"
brettwa874dcc2015-08-28 23:59:18369
370 if (current_cpu == "x86") {
371 deb_arch = "i386"
372 } else if (current_cpu == "x64") {
373 deb_arch = "amd64"
374 } else if (current_cpu == "arm") {
375 deb_arch = "arm"
376 } else {
377 assert(false, "Linux installer not configured for this architecture.")
378 }
379
Tom Andersone068dcb2017-09-01 18:31:21380 inputs = packaging_files
brettwa874dcc2015-08-28 23:59:18381 outputs = [
382 "$root_out_dir/google-chrome-${channel}_${chrome_version_full}-1_${deb_arch}.deb",
383 ]
384
385 args = [
brettwa874dcc2015-08-28 23:59:18386 rebase_path("$root_out_dir/installer/debian/build.sh", root_build_dir),
brettwa874dcc2015-08-28 23:59:18387 "-a",
388 build_script_arch,
Tom Andersoncae008e2017-09-01 01:47:35389 "-b",
390 rebase_path(root_out_dir, root_build_dir),
brettwa874dcc2015-08-28 23:59:18391 "-c",
392 invoker.channel,
393 "-d",
394 branding_path_component,
Tom Andersoncae008e2017-09-01 01:47:35395 "-o",
396 rebase_path(root_out_dir, root_build_dir),
thomasanderson7a01af42016-10-18 21:22:42397 "-s",
398 rebase_path(sysroot),
brettwa874dcc2015-08-28 23:59:18399 ]
Tom Andersoncae008e2017-09-01 01:47:35400 if (is_official_build) {
401 args += [ "-f" ]
402 }
brettwa874dcc2015-08-28 23:59:18403 deps = [
404 ":installer_deps",
Tom Anderson21254bb2017-09-07 04:07:18405 ":merge_deb_dependencies",
brettwa874dcc2015-08-28 23:59:18406 ]
407 }
408
409 if (!is_chromeos) {
410 rpm_target_name = "${target_name}_rpm"
411 action(rpm_target_name) {
412 visibility = [ ":*" ]
Tom Anderson29332fdd2017-09-12 00:18:34413 script = "make_package.py"
brettwa874dcc2015-08-28 23:59:18414
415 if (current_cpu == "x86") {
416 rpm_arch = "i386"
417 } else if (current_cpu == "x64") {
418 rpm_arch = "x86_64"
419 } else if (current_cpu == "arm") {
420 rpm_arch = "arm"
421 } else {
422 assert(false, "Linux installer not configured for this architecture.")
423 }
424
Tom Andersone068dcb2017-09-01 18:31:21425 inputs = packaging_files
brettwa874dcc2015-08-28 23:59:18426 outputs = [
Tom Anderson46b0cef2017-08-31 21:38:33427 "$root_out_dir/google-chrome-${channel}-${chrome_version_full}-1.${rpm_arch}.rpm",
brettwa874dcc2015-08-28 23:59:18428 ]
429
430 args = [
brettwa874dcc2015-08-28 23:59:18431 rebase_path("$root_out_dir/installer/rpm/build.sh", root_build_dir),
brettwa874dcc2015-08-28 23:59:18432 "-a",
433 build_script_arch,
Tom Andersoncae008e2017-09-01 01:47:35434 "-b",
435 rebase_path(root_out_dir, root_build_dir),
brettwa874dcc2015-08-28 23:59:18436 "-c",
437 invoker.channel,
438 "-d",
439 branding_path_component,
Tom Andersoncae008e2017-09-01 01:47:35440 "-o",
441 rebase_path(root_out_dir, root_build_dir),
brettwa874dcc2015-08-28 23:59:18442 ]
Tom Andersoncae008e2017-09-01 01:47:35443 if (is_official_build) {
444 args += [ "-f" ]
445 }
brettwa874dcc2015-08-28 23:59:18446 deps = [
447 ":installer_deps",
Tom Anderson3a3c5882017-09-12 21:16:24448 ":merge_rpm_dependencies",
brettwa874dcc2015-08-28 23:59:18449 ]
450 }
451 }
452
453 group(target_name) {
454 deps = [
455 ":$deb_target_name",
456 ]
457 if (!is_chromeos) {
458 deps += [ ":$rpm_target_name" ]
459 }
460 }
461}
462
463# Standard packages.
464linux_package("stable") {
465 channel = "stable"
466}
467linux_package("beta") {
468 channel = "beta"
469}
470linux_package("unstable") {
471 channel = "unstable"
472}