blob: fad0ae2fc9ceb22716884415085bbd912d98ef98 [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.
Dirk Prankeccc0c362017-09-28 22:15:1113import("//components/nacl/features.gni")
brettwa874dcc2015-08-28 23:59:1814
xhwangc3a252b2016-05-23 02:35:4815if (current_cpu == "x86" || current_cpu == "x64") {
16 import("//media/cdm/ppapi/cdm_paths.gni")
17}
18
sbcfa8f43b2016-10-05 17:11:3519assert(is_linux)
brettwa874dcc2015-08-28 23:59:1820
Tom Anderson7f6acf62017-09-08 03:13:0921packaging_files_executables = [
Tom Andersone068dcb2017-09-01 18:31:2122 "$root_out_dir/chrome",
23 "$root_out_dir/chrome_sandbox",
24]
Tom Anderson7f6acf62017-09-08 03:13:0925packaging_files_shlibs = []
Tom Andersone068dcb2017-09-01 18:31:2126
27if (enable_nacl) {
Tom Anderson7f6acf62017-09-08 03:13:0928 packaging_files_executables += [
Tom Andersone068dcb2017-09-01 18:31:2129 "$root_out_dir/nacl_helper",
30 "$root_out_dir/nacl_helper_bootstrap",
31 ]
32
33 if (current_cpu == "x86") {
Tom Anderson7f6acf62017-09-08 03:13:0934 packaging_files_executables += [ "$root_out_dir/nacl_irt_x86_32.nexe" ]
Tom Andersone068dcb2017-09-01 18:31:2135 } else if (current_cpu == "x64") {
Tom Anderson7f6acf62017-09-08 03:13:0936 packaging_files_executables += [ "$root_out_dir/nacl_irt_x86_64.nexe" ]
Tom Andersone068dcb2017-09-01 18:31:2137 } else if (current_cpu == "arm") {
Tom Anderson7f6acf62017-09-08 03:13:0938 packaging_files_executables += [ "$root_out_dir/nacl_irt_arm.nexe" ]
Milko Leporis0f74ee82017-10-02 22:37:0739 } else if (current_cpu == "mipsel") {
40 packaging_files_executables += [ "$root_out_dir/nacl_irt_mips32.nexe" ]
Tom Andersone068dcb2017-09-01 18:31:2141 }
42}
43
44# The widevine BUILD.gn only produces shared libraries for x86 and x64
45if (is_chrome_branded && (current_cpu == "x86" || current_cpu == "x64")) {
Tom Anderson7f6acf62017-09-08 03:13:0946 packaging_files_shlibs += [
Tom Andersone068dcb2017-09-01 18:31:2147 "$root_out_dir/$widevine_cdm_path/libwidevinecdmadapter.so",
48 "$root_out_dir/$widevine_cdm_path/libwidevinecdm.so",
49 ]
50}
51
52if (!libcpp_is_static && use_custom_libcxx) {
Tom Anderson7f6acf62017-09-08 03:13:0953 packaging_files_shlibs += [ "$root_out_dir/libc++.so" ]
Tom Andersone068dcb2017-09-01 18:31:2154}
55
Tom Anderson7f6acf62017-09-08 03:13:0956packaging_files_binaries = packaging_files_executables + packaging_files_shlibs
57
Tom Andersone068dcb2017-09-01 18:31:2158# TODO(mmoss) Any convenient way to get all the relevant build files?
59# (e.g. all locales, resources, etc.)
60packaging_files = packaging_files_binaries + [
61 "$root_out_dir/xdg-mime",
62 "$root_out_dir/xdg-settings",
63 "$root_out_dir/locales/en-US.pak",
64 ]
65
Tom Andersona80a9b42017-09-07 02:35:3366action_foreach("calculate_deb_dependencies") {
Tom Andersone068dcb2017-09-01 18:31:2167 deps = [
68 ":installer_deps",
69 ]
Tom Andersona80a9b42017-09-07 02:35:3370 script = "debian/calculate_package_deps.py"
Tom Andersone068dcb2017-09-01 18:31:2171 sources = packaging_files_binaries
Tom Anderson3a3c5882017-09-12 21:16:2472 inputs = [
73 "debian/deb_version.py",
Lei Zhange680353b2017-09-25 23:03:5074 "debian/dist_package_versions.json",
Tom Anderson3a3c5882017-09-12 21:16:2475 "debian/package_version_interval.py",
76 ]
Tom Andersone068dcb2017-09-01 18:31:2177 outputs = [
Tom Andersona80a9b42017-09-07 02:35:3378 "$root_out_dir/deb_{{source_name_part}}.deps",
Tom Andersone068dcb2017-09-01 18:31:2179 ]
80 args = [
81 "{{source}}",
82 rebase_path(sysroot, root_build_dir),
83 target_cpu,
Tom Andersona80a9b42017-09-07 02:35:3384 "deb_{{source_name_part}}.deps",
Tom Andersone068dcb2017-09-01 18:31:2185 ]
Tom Andersoncedcf7962017-10-04 00:29:5586 if (is_desktop_linux && target_cpu == "x64") {
Tom Andersonc92bc272017-09-15 23:12:5787 args += [ "--distro-check" ]
88 }
Tom Andersone068dcb2017-09-01 18:31:2189}
90
Tom Andersona80a9b42017-09-07 02:35:3391action("merge_deb_dependencies") {
92 deps = [
93 ":calculate_deb_dependencies",
94 ]
95 script = "debian/merge_package_versions.py"
Tom Anderson21254bb2017-09-07 04:07:1896 additional_deps = "debian/additional_deps"
97 inputs = [
98 additional_deps,
Tom Anderson3a3c5882017-09-12 21:16:2499 "debian/deb_version.py",
100 "debian/package_version_interval.py",
Tom Andersona80a9b42017-09-07 02:35:33101 ]
Tom Anderson21254bb2017-09-07 04:07:18102 outputs = [
103 "$root_out_dir/deb_common.deps",
104 ]
105 args = [
106 "deb_common.deps",
107 rebase_path(additional_deps, root_build_dir),
108 ]
Tom Andersona80a9b42017-09-07 02:35:33109 args += rebase_path(get_target_outputs(":calculate_deb_dependencies"),
110 root_build_dir)
111}
112
Tom Anderson7f6acf62017-09-08 03:13:09113action_foreach("calculate_rpm_dependencies") {
114 deps = [
115 ":installer_deps",
116 ]
117 script = "rpm/calculate_package_deps.py"
118 sources = packaging_files_binaries
Tom Anderson3a3c5882017-09-12 21:16:24119 inputs = [
Lei Zhange680353b2017-09-25 23:03:50120 "rpm/dist_package_provides.json",
Tom Anderson3a3c5882017-09-12 21:16:24121 ]
Tom Anderson7f6acf62017-09-08 03:13:09122 outputs = [
123 "$root_out_dir/rpm_{{source_name_part}}.deps",
124 ]
125 args = [
126 "{{source}}",
127 "rpm_{{source_name_part}}.deps",
128 ]
129 args += rebase_path(packaging_files_shlibs, root_build_dir)
Tom Andersoncedcf7962017-10-04 00:29:55130 if (is_desktop_linux && target_cpu == "x64") {
Tom Andersonc92bc272017-09-15 23:12:57131 args += [ "--distro-check" ]
132 }
Tom Anderson7f6acf62017-09-08 03:13:09133}
134
135action("merge_rpm_dependencies") {
136 deps = [
137 ":calculate_rpm_dependencies",
138 ]
139 script = "rpm/merge_package_deps.py"
Tom Anderson3a3c5882017-09-12 21:16:24140 additional_deps = "rpm/additional_deps"
141 inputs = [
142 additional_deps,
143 ]
Tom Anderson7f6acf62017-09-08 03:13:09144 outputs = [
145 "$root_out_dir/rpm_common.deps",
146 ]
Tom Anderson3a3c5882017-09-12 21:16:24147 args = [
148 "rpm_common.deps",
149 rebase_path(additional_deps, root_build_dir),
150 ]
Tom Anderson7f6acf62017-09-08 03:13:09151 args += rebase_path(get_target_outputs(":calculate_rpm_dependencies"),
152 root_build_dir)
153}
154
Tom Andersonce16a0c2017-09-02 00:27:51155action("strip_chrome_binary") {
156 prog_name = "$root_out_dir/chrome"
157 debug_file = prog_name + ".debug"
158 stripped_file = prog_name + ".stripped"
159 deps = [
160 "//chrome",
161 ]
Tom Anderson2bb2b382017-09-26 20:21:53162 script = "//build/gn_run_binary.py"
Tom Andersonce16a0c2017-09-02 00:27:51163 sources = [
164 prog_name,
165 ]
166 outputs = [
167 debug_file,
168 stripped_file,
169 ]
170 args = [
171 rebase_path("//third_party/eu-strip/bin/eu-strip", root_build_dir),
Tom Anderson2bb2b382017-09-26 20:21:53172 "-o",
Tom Andersonce16a0c2017-09-02 00:27:51173 rebase_path(stripped_file, root_build_dir),
Tom Anderson2bb2b382017-09-26 20:21:53174 "-f",
175 rebase_path(debug_file, root_build_dir),
176 rebase_path(prog_name, root_build_dir),
Tom Andersonce16a0c2017-09-02 00:27:51177 ]
178}
179
brettwa874dcc2015-08-28 23:59:18180# This target builds all "normal" Linux installers.
brettwa874dcc2015-08-28 23:59:18181#
182# The bot setup is to build stable, unstable, and beta packages for the current
183# build. Then a later step picks up the package corresponding to what the
184# current build is supposed to be. This is wasteful since one build will only
Tom Anderson1d582482017-09-05 20:41:28185# be one of these.
brettwa874dcc2015-08-28 23:59:18186#
187# TODO it would be much nicer to have a build variable so the bot can tell us
188# what the current build should be, so we only have to make one .deb/.rpm pair.
189#
190#
191# TO BUILD LINUX INSTALLER PACKAGES
192#
193# The packages list the exact versions of each library used. The versions used
194# on the bots are likely different than those on your workstation, so you'll
195# get a stream of errors like:
196# < libasound2 (>= 1.0.23)
197# ---
198# > libasound2 (>= 1.0.16)
199#
200# To avoid these warnings for testing purposes, do:
201#
202# export IGNORE_DEPS_CHANGES=1
203#
204# before you build.
205group("linux") {
206 deps = [
207 ":beta",
208 ":stable",
209 ":unstable",
210 ]
211}
212
213branding_dir = "//chrome/app/theme/$branding_path_component"
214branding_dir_100 =
215 "//chrome/app/theme/default_100_percent/$branding_path_component"
216
217copy("common_packaging_files") {
218 visibility = [ ":*" ]
219 sources = [
Tom Anderson64b96142017-09-26 21:00:54220 "//chrome/app/resources/manpage.1.in",
brettwa874dcc2015-08-28 23:59:18221 "common/apt.include",
222 "common/default-app-block.template",
223 "common/default-app.template",
224 "common/desktop.template",
brettwa874dcc2015-08-28 23:59:18225 "common/installer.include",
226 "common/postinst.include",
227 "common/prerm.include",
228 "common/repo.cron",
229 "common/rpm.include",
230 "common/rpmrepo.cron",
231 "common/symlinks.include",
232 "common/variables.include",
233 "common/wrapper",
234 ]
235
sbcfa8f43b2016-10-05 17:11:35236 if (is_chrome_branded) {
tomas.popeladd765c02017-03-21 14:44:16237 sources += [
238 "common/google-chrome/google-chrome.appdata.xml.template",
239 "common/google-chrome/google-chrome.info",
240 ]
sbcfa8f43b2016-10-05 17:11:35241 } else {
tomas.popeladd765c02017-03-21 14:44:16242 sources += [
243 "common/chromium-browser/chromium-browser.appdata.xml",
244 "common/chromium-browser/chromium-browser.info",
245 ]
sbcfa8f43b2016-10-05 17:11:35246 }
247
Tom Anderson4312d5e2017-06-22 21:07:43248 sources += [ "//third_party/eu-strip/bin/eu-strip" ]
brettwa874dcc2015-08-28 23:59:18249
250 outputs = [
251 "$root_out_dir/installer/common/{{source_file_part}}",
252 ]
253}
254
255copy("deb_packaging_files") {
256 visibility = [ ":*" ]
257 sources = [
258 "debian/build.sh",
259 "debian/changelog.template",
260 "debian/control.template",
261 "debian/debian.menu",
brettwa874dcc2015-08-28 23:59:18262 "debian/postinst",
263 "debian/postrm",
264 "debian/prerm",
265 ]
266 outputs = [
267 "$root_out_dir/installer/debian/{{source_file_part}}",
268 ]
269}
270
271copy("theme_files") {
272 visibility = [ ":*" ]
273 sources = [
274 "$branding_dir/BRANDING",
275 "$branding_dir/linux/product_logo_32.xpm",
276 "$branding_dir/product_logo_128.png",
277 "$branding_dir/product_logo_22.png",
278 "$branding_dir/product_logo_24.png",
279 "$branding_dir/product_logo_256.png",
280 "$branding_dir/product_logo_48.png",
281 "$branding_dir/product_logo_64.png",
282 "$branding_dir_100/product_logo_16.png",
283 "$branding_dir_100/product_logo_32.png",
284 ]
Tom Andersonc8ebf272017-11-17 23:41:33285 if (is_chrome_branded) {
286 sources += [
287 "$branding_dir/linux/product_logo_32_beta.xpm",
288 "$branding_dir/linux/product_logo_32_dev.xpm",
289 "$branding_dir/product_logo_128_beta.png",
290 "$branding_dir/product_logo_128_dev.png",
291 "$branding_dir/product_logo_22_beta.png",
292 "$branding_dir/product_logo_22_dev.png",
293 "$branding_dir/product_logo_24_beta.png",
294 "$branding_dir/product_logo_24_dev.png",
295 "$branding_dir/product_logo_256_beta.png",
296 "$branding_dir/product_logo_256_dev.png",
297 "$branding_dir/product_logo_48_beta.png",
298 "$branding_dir/product_logo_48_dev.png",
299 "$branding_dir/product_logo_64_beta.png",
300 "$branding_dir/product_logo_64_dev.png",
301 "$branding_dir_100/product_logo_16_beta.png",
302 "$branding_dir_100/product_logo_16_dev.png",
303 "$branding_dir_100/product_logo_32_beta.png",
304 "$branding_dir_100/product_logo_32_dev.png",
305 ]
306 }
brettwa874dcc2015-08-28 23:59:18307 outputs = [
308 "$root_out_dir/installer/theme/{{source_file_part}}",
309 ]
310}
311
312if (!is_chromeos) {
313 copy("rpm_packaging_files") {
314 visibility = [ ":*" ]
315 sources = [
316 "rpm/build.sh",
317 "rpm/chrome.spec.template",
brettwa874dcc2015-08-28 23:59:18318 ]
319 outputs = [
320 "$root_out_dir/installer/rpm/{{source_file_part}}",
321 ]
322 }
323}
324
325process_version("save_build_info") {
326 # Just output the default version info variables (no template).
327 process_only = true
raphael.kubo.da.costadc683d22016-09-17 19:41:13328 sources = [
329 "//build/util/LASTCHANGE",
330 "//chrome/VERSION",
331 branding_file_path,
332 ]
brettwa874dcc2015-08-28 23:59:18333 output = "$root_out_dir/installer/version.txt"
334}
335
336# Dependencies for all Linux installer targets.
337group("installer_deps") {
mcgrathr6edf192f2015-10-19 19:39:11338 # Though many of these things appear in data_deps further down the
339 # dependency chain, they must appear here as public_deps so that they can
340 # be listed as inputs to the actions that depend on ":installer_deps"
341 # and are guaranteed to have been built before those actions run.
342
brettwa874dcc2015-08-28 23:59:18343 public_deps = [
344 ":common_packaging_files",
345 ":deb_packaging_files",
346 ":save_build_info",
Tom Andersonce16a0c2017-09-02 00:27:51347 ":strip_chrome_binary",
brettwa874dcc2015-08-28 23:59:18348 ":theme_files",
349 "//chrome",
350 "//chrome:packed_resources",
brettwa874dcc2015-08-28 23:59:18351 "//sandbox/linux:chrome_sandbox",
brettwa874dcc2015-08-28 23:59:18352 ]
dpranke3b870612015-09-10 23:42:04353 if (enable_nacl) {
mcgrathr6edf192f2015-10-19 19:39:11354 public_deps += [
brettwf4b4a4282015-12-16 00:41:13355 "//components/nacl/loader:nacl_helper",
mcgrathr6edf192f2015-10-19 19:39:11356
357 # These are data_deps of nacl_helper, but that is not enough,
358 # as explained above.
359 "//native_client/src/trusted/service_runtime/linux:bootstrap",
360 "//ppapi/native_client:irt",
361 ]
dpranke3b870612015-09-10 23:42:04362 }
brettwa874dcc2015-08-28 23:59:18363 if (current_cpu == "x86" || current_cpu == "x64") {
364 public_deps += [
365 "//third_party/widevine/cdm:widevinecdm",
366 "//third_party/widevine/cdm:widevinecdmadapter",
367 ]
368 }
369 if (!is_chromeos) {
370 public_deps += [ ":rpm_packaging_files" ]
371 }
Tom Anderson45583c72017-07-08 02:53:34372
Tom Anderson45583c72017-07-08 02:53:34373 if (!libcpp_is_static && use_custom_libcxx) {
374 public_deps += [ "//buildtools/third_party/libc++:libc++" ]
375 }
brettwa874dcc2015-08-28 23:59:18376}
377
378# Creates .deb and .rpm (RPM for non-ChromeOS only) installer packages.
379#
380# channel:
381# Name of the channel.
382template("linux_package") {
383 assert(defined(invoker.channel))
384 channel = invoker.channel
385
386 if (current_cpu == "x86") {
mcgrathr6edf192f2015-10-19 19:39:11387 # The shell scripts use "ia32" instead of "x86".
brettwa874dcc2015-08-28 23:59:18388 build_script_arch = "ia32"
389 } else {
390 build_script_arch = current_cpu
391 }
392
brettwa874dcc2015-08-28 23:59:18393 deb_target_name = "${target_name}_deb"
394 action(deb_target_name) {
395 visibility = [ ":*" ]
Tom Anderson2bb2b382017-09-26 20:21:53396 script = "//build/gn_run_binary.py"
brettwa874dcc2015-08-28 23:59:18397
398 if (current_cpu == "x86") {
399 deb_arch = "i386"
400 } else if (current_cpu == "x64") {
401 deb_arch = "amd64"
402 } else if (current_cpu == "arm") {
403 deb_arch = "arm"
Milko Leporis0f74ee82017-10-02 22:37:07404 } else if (current_cpu == "mipsel") {
405 deb_arch = "mipsel"
brettwa874dcc2015-08-28 23:59:18406 } else {
407 assert(false, "Linux installer not configured for this architecture.")
408 }
409
Tom Andersone068dcb2017-09-01 18:31:21410 inputs = packaging_files
Tom Andersonfa4860c2017-09-15 23:23:40411 if (is_chrome_branded) {
412 package = "google-chrome"
413 } else {
414 package = "chromium-browser"
415 }
brettwa874dcc2015-08-28 23:59:18416 outputs = [
Tom Andersonfa4860c2017-09-15 23:23:40417 "$root_out_dir/${package}-${channel}_${chrome_version_full}-1_${deb_arch}.deb",
brettwa874dcc2015-08-28 23:59:18418 ]
419
420 args = [
brettwa874dcc2015-08-28 23:59:18421 rebase_path("$root_out_dir/installer/debian/build.sh", root_build_dir),
brettwa874dcc2015-08-28 23:59:18422 "-a",
423 build_script_arch,
Tom Andersoncae008e2017-09-01 01:47:35424 "-b",
425 rebase_path(root_out_dir, root_build_dir),
brettwa874dcc2015-08-28 23:59:18426 "-c",
427 invoker.channel,
428 "-d",
429 branding_path_component,
Tom Andersoncae008e2017-09-01 01:47:35430 "-o",
431 rebase_path(root_out_dir, root_build_dir),
thomasanderson7a01af42016-10-18 21:22:42432 "-s",
433 rebase_path(sysroot),
brettwa874dcc2015-08-28 23:59:18434 ]
Tom Andersoncae008e2017-09-01 01:47:35435 if (is_official_build) {
436 args += [ "-f" ]
437 }
brettwa874dcc2015-08-28 23:59:18438 deps = [
439 ":installer_deps",
Tom Anderson21254bb2017-09-07 04:07:18440 ":merge_deb_dependencies",
brettwa874dcc2015-08-28 23:59:18441 ]
442 }
443
444 if (!is_chromeos) {
445 rpm_target_name = "${target_name}_rpm"
446 action(rpm_target_name) {
447 visibility = [ ":*" ]
Tom Anderson2bb2b382017-09-26 20:21:53448 script = "//build/gn_run_binary.py"
brettwa874dcc2015-08-28 23:59:18449
450 if (current_cpu == "x86") {
451 rpm_arch = "i386"
452 } else if (current_cpu == "x64") {
453 rpm_arch = "x86_64"
454 } else if (current_cpu == "arm") {
455 rpm_arch = "arm"
Milko Leporis0f74ee82017-10-02 22:37:07456 } else if (current_cpu == "mipsel") {
457 rpm_arch = "mipsel"
brettwa874dcc2015-08-28 23:59:18458 } else {
459 assert(false, "Linux installer not configured for this architecture.")
460 }
461
Tom Andersone068dcb2017-09-01 18:31:21462 inputs = packaging_files
Tom Andersonfa4860c2017-09-15 23:23:40463 if (is_chrome_branded) {
464 package = "google-chrome"
465 } else {
466 package = "chromium-browser"
467 }
brettwa874dcc2015-08-28 23:59:18468 outputs = [
Tom Andersonfa4860c2017-09-15 23:23:40469 "$root_out_dir/${package}-${channel}-${chrome_version_full}-1.${rpm_arch}.rpm",
brettwa874dcc2015-08-28 23:59:18470 ]
471
472 args = [
brettwa874dcc2015-08-28 23:59:18473 rebase_path("$root_out_dir/installer/rpm/build.sh", root_build_dir),
brettwa874dcc2015-08-28 23:59:18474 "-a",
475 build_script_arch,
Tom Andersoncae008e2017-09-01 01:47:35476 "-b",
477 rebase_path(root_out_dir, root_build_dir),
brettwa874dcc2015-08-28 23:59:18478 "-c",
479 invoker.channel,
480 "-d",
481 branding_path_component,
Tom Andersoncae008e2017-09-01 01:47:35482 "-o",
483 rebase_path(root_out_dir, root_build_dir),
brettwa874dcc2015-08-28 23:59:18484 ]
Tom Andersoncae008e2017-09-01 01:47:35485 if (is_official_build) {
486 args += [ "-f" ]
487 }
brettwa874dcc2015-08-28 23:59:18488 deps = [
489 ":installer_deps",
Tom Anderson3a3c5882017-09-12 21:16:24490 ":merge_rpm_dependencies",
brettwa874dcc2015-08-28 23:59:18491 ]
492 }
493 }
494
495 group(target_name) {
496 deps = [
497 ":$deb_target_name",
498 ]
499 if (!is_chromeos) {
500 deps += [ ":$rpm_target_name" ]
501 }
502 }
503}
504
505# Standard packages.
506linux_package("stable") {
507 channel = "stable"
508}
509linux_package("beta") {
510 channel = "beta"
511}
512linux_package("unstable") {
513 channel = "unstable"
514}