blob: ae73272739764b2b27ba4c031f20ed2361a36f7e [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
5import("//build/config/chrome_build.gni")
dpranke3b870612015-09-10 23:42:046import("//build/config/features.gni")
brettw4cab0f12015-09-14 21:40:017import("//build/config/sanitizers/sanitizers.gni")
raphael.kubo.da.costadc683d22016-09-17 19:41:138import("//build/util/process_version.gni")
brettwa874dcc2015-08-28 23:59:189import("//build/util/version.gni")
raphael.kubo.da.costadc683d22016-09-17 19:41:1310import("//chrome/process_version_rc_template.gni") # For branding_file_path.
brettwa874dcc2015-08-28 23:59:1811
xhwangc3a252b2016-05-23 02:35:4812if (current_cpu == "x86" || current_cpu == "x64") {
13 import("//media/cdm/ppapi/cdm_paths.gni")
14}
15
brettwa874dcc2015-08-28 23:59:1816assert(is_linux && is_chrome_branded)
17
18# This target builds all "normal" Linux installers.
brettwa874dcc2015-08-28 23:59:1819#
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.
44group("linux") {
45 deps = [
46 ":beta",
47 ":stable",
48 ":unstable",
49 ]
50}
51
dprankeb8c6d5f2015-10-02 19:52:3752# 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).
brettw57399c52016-05-10 18:34:0555# TODO(GYP_GONE): Delete this target after we've migrated away from GYP and
dprankeb8c6d5f2015-10-02 19:52:3756# updated the bots to build :linux instead.
57group("linux_packages_all") {
58 visibility = []
59 deps = [
60 ":linux",
61 ]
62}
63
brettwa874dcc2015-08-28 23:59:1864branding_dir = "//chrome/app/theme/$branding_path_component"
65branding_dir_100 =
66 "//chrome/app/theme/default_100_percent/$branding_path_component"
67
68copy("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
98copy("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
116copy("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
135if (!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
150process_version("save_build_info") {
151 # Just output the default version info variables (no template).
152 process_only = true
raphael.kubo.da.costadc683d22016-09-17 19:41:13153 sources = [
154 "//build/util/LASTCHANGE",
155 "//chrome/VERSION",
156 branding_file_path,
157 ]
brettwa874dcc2015-08-28 23:59:18158 output = "$root_out_dir/installer/version.txt"
159}
160
161# Dependencies for all Linux installer targets.
162group("installer_deps") {
mcgrathr6edf192f2015-10-19 19:39:11163 # Though many of these things appear in data_deps further down the
164 # dependency chain, they must appear here as public_deps so that they can
165 # be listed as inputs to the actions that depend on ":installer_deps"
166 # and are guaranteed to have been built before those actions run.
167
brettwa874dcc2015-08-28 23:59:18168 public_deps = [
169 ":common_packaging_files",
170 ":deb_packaging_files",
171 ":save_build_info",
172 ":theme_files",
173 "//chrome",
174 "//chrome:packed_resources",
brettwa874dcc2015-08-28 23:59:18175 "//sandbox/linux:chrome_sandbox",
brettwa874dcc2015-08-28 23:59:18176 ]
dpranke3b870612015-09-10 23:42:04177 if (enable_nacl) {
mcgrathr6edf192f2015-10-19 19:39:11178 public_deps += [
brettwf4b4a4282015-12-16 00:41:13179 "//components/nacl/loader:nacl_helper",
mcgrathr6edf192f2015-10-19 19:39:11180
181 # These are data_deps of nacl_helper, but that is not enough,
182 # as explained above.
183 "//native_client/src/trusted/service_runtime/linux:bootstrap",
184 "//ppapi/native_client:irt",
185 ]
dpranke3b870612015-09-10 23:42:04186 }
brettwa874dcc2015-08-28 23:59:18187 if (current_cpu == "x86" || current_cpu == "x64") {
188 public_deps += [
189 "//third_party/widevine/cdm:widevinecdm",
190 "//third_party/widevine/cdm:widevinecdmadapter",
191 ]
192 }
193 if (!is_chromeos) {
194 public_deps += [ ":rpm_packaging_files" ]
195 }
196}
197
198# Creates .deb and .rpm (RPM for non-ChromeOS only) installer packages.
199#
200# channel:
201# Name of the channel.
202template("linux_package") {
203 assert(defined(invoker.channel))
204 channel = invoker.channel
205
206 if (current_cpu == "x86") {
mcgrathr6edf192f2015-10-19 19:39:11207 # The shell scripts use "ia32" instead of "x86".
brettwa874dcc2015-08-28 23:59:18208 build_script_arch = "ia32"
209 } else {
210 build_script_arch = current_cpu
211 }
212
213 packaging_files_binaries = [
214 # TODO(mmoss) Any convenient way to get all the relevant build
215 # files? (e.g. all locales, resources, etc.)
216 "$root_out_dir/chrome",
217 "$root_out_dir/chrome_sandbox",
218 "$root_out_dir/xdg-mime",
219 "$root_out_dir/xdg-settings",
220 "$root_out_dir/locales/en-US.pak",
221
mcgrathr6edf192f2015-10-19 19:39:11222 "$root_out_dir/nacl_helper",
223 "$root_out_dir/nacl_helper_bootstrap",
brettwa874dcc2015-08-28 23:59:18224 ]
225
226 if (current_cpu == "x86") {
227 packaging_files_binaries += [
mcgrathr6edf192f2015-10-19 19:39:11228 "$root_out_dir/nacl_irt_x86_32.nexe",
xhwangc3a252b2016-05-23 02:35:48229 "$root_out_dir/$widevine_cdm_path/libwidevinecdmadapter.so",
230 "$root_out_dir/$widevine_cdm_path/libwidevinecdm.so",
brettwa874dcc2015-08-28 23:59:18231 ]
232 } else if (current_cpu == "x64") {
233 packaging_files_binaries += [
mcgrathr6edf192f2015-10-19 19:39:11234 "$root_out_dir/nacl_irt_x86_64.nexe",
xhwangc3a252b2016-05-23 02:35:48235 "$root_out_dir/$widevine_cdm_path/libwidevinecdmadapter.so",
236 "$root_out_dir/$widevine_cdm_path/libwidevinecdm.so",
brettwa874dcc2015-08-28 23:59:18237 ]
mcgrathr6edf192f2015-10-19 19:39:11238 } else if (current_cpu == "arm") {
239 packaging_files_binaries += [ "$root_out_dir/nacl_irt_arm.nexe" ]
brettwa874dcc2015-08-28 23:59:18240 }
241 if (is_asan) {
242 packaging_files_binaries += [ "$root_out_dir/lib/libc++.so" ]
243 }
244
245 deb_target_name = "${target_name}_deb"
246 action(deb_target_name) {
247 visibility = [ ":*" ]
248 script = "flock_make_package.py"
249
250 if (current_cpu == "x86") {
251 deb_arch = "i386"
252 } else if (current_cpu == "x64") {
253 deb_arch = "amd64"
254 } else if (current_cpu == "arm") {
255 deb_arch = "arm"
256 } else {
257 assert(false, "Linux installer not configured for this architecture.")
258 }
259
260 inputs = packaging_files_binaries
261 outputs = [
262 "$root_out_dir/google-chrome-${channel}_${chrome_version_full}-1_${deb_arch}.deb",
263 ]
264
265 args = [
266 rebase_path("$root_out_dir/linux_package.lock", root_build_dir),
267 rebase_path("$root_out_dir/installer/debian/build.sh", root_build_dir),
268 "-o",
269 rebase_path(root_out_dir, root_build_dir),
270 "-b",
271 rebase_path(root_out_dir, root_build_dir),
272 "-a",
273 build_script_arch,
274 "-c",
275 invoker.channel,
276 "-d",
277 branding_path_component,
278 ]
279 deps = [
280 ":installer_deps",
281 ]
282 }
283
284 if (!is_chromeos) {
285 rpm_target_name = "${target_name}_rpm"
286 action(rpm_target_name) {
287 visibility = [ ":*" ]
288 script = "flock_make_package.py"
289
290 if (current_cpu == "x86") {
291 rpm_arch = "i386"
292 } else if (current_cpu == "x64") {
293 rpm_arch = "x86_64"
294 } else if (current_cpu == "arm") {
295 rpm_arch = "arm"
296 } else {
297 assert(false, "Linux installer not configured for this architecture.")
298 }
299
300 inputs = packaging_files_binaries
301 outputs = [
302 "$root_out_dir/google-chrome-${channel}_${chrome_version_full}-1.${rpm_arch}.rpm",
303 ]
304
305 args = [
306 rebase_path("$root_out_dir/linux_package.lock", root_build_dir),
307 rebase_path("$root_out_dir/installer/rpm/build.sh", root_build_dir),
308 "-o",
309 rebase_path(root_out_dir, root_build_dir),
310 "-b",
311 rebase_path(root_out_dir, root_build_dir),
312 "-a",
313 build_script_arch,
314 "-c",
315 invoker.channel,
316 "-d",
317 branding_path_component,
318 ]
319 deps = [
320 ":installer_deps",
321 ]
322 }
323 }
324
325 group(target_name) {
326 deps = [
327 ":$deb_target_name",
328 ]
329 if (!is_chromeos) {
330 deps += [ ":$rpm_target_name" ]
331 }
332 }
333}
334
335# Standard packages.
336linux_package("stable") {
337 channel = "stable"
338}
339linux_package("beta") {
340 channel = "beta"
341}
342linux_package("unstable") {
343 channel = "unstable"
344}
345
346# Other packages that we support that aren't included in the default "linux"
347# target.
348linux_package("trunk") {
349 channel = "trunk"
350}
351if (is_asan) {
352 linux_package("asan") {
353 channel = "asan"
354 }
355}