blob: c30993b23e9ed7ecc3084d0738a555ec1d4ec446 [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")
brettwa874dcc2015-08-28 23:59:188import("//build/util/version.gni")
9import("//chrome/version.gni")
10
xhwangc3a252b2016-05-23 02:35:4811if (current_cpu == "x86" || current_cpu == "x64") {
12 import("//media/cdm/ppapi/cdm_paths.gni")
13}
14
brettwa874dcc2015-08-28 23:59:1815assert(is_linux && is_chrome_branded)
16
17# This target builds all "normal" Linux installers.
18# GYP version: chrome/chrome_installer.gypi:linux_packages_all
19#
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
153 output = "$root_out_dir/installer/version.txt"
154}
155
156# Dependencies for all Linux installer targets.
157group("installer_deps") {
mcgrathr6edf192f2015-10-19 19:39:11158 # Though many of these things appear in data_deps further down the
159 # dependency chain, they must appear here as public_deps so that they can
160 # be listed as inputs to the actions that depend on ":installer_deps"
161 # and are guaranteed to have been built before those actions run.
162
brettwa874dcc2015-08-28 23:59:18163 public_deps = [
164 ":common_packaging_files",
165 ":deb_packaging_files",
166 ":save_build_info",
167 ":theme_files",
168 "//chrome",
169 "//chrome:packed_resources",
brettwa874dcc2015-08-28 23:59:18170 "//sandbox/linux:chrome_sandbox",
171 "//third_party/adobe/flash:flapper_binaries",
172 ]
dpranke3b870612015-09-10 23:42:04173 if (enable_nacl) {
mcgrathr6edf192f2015-10-19 19:39:11174 public_deps += [
brettwf4b4a4282015-12-16 00:41:13175 "//components/nacl/loader:nacl_helper",
mcgrathr6edf192f2015-10-19 19:39:11176
177 # These are data_deps of nacl_helper, but that is not enough,
178 # as explained above.
179 "//native_client/src/trusted/service_runtime/linux:bootstrap",
180 "//ppapi/native_client:irt",
181 ]
dpranke3b870612015-09-10 23:42:04182 }
brettwa874dcc2015-08-28 23:59:18183 if (current_cpu == "x86" || current_cpu == "x64") {
184 public_deps += [
185 "//third_party/widevine/cdm:widevinecdm",
186 "//third_party/widevine/cdm:widevinecdmadapter",
187 ]
188 }
189 if (!is_chromeos) {
190 public_deps += [ ":rpm_packaging_files" ]
191 }
192}
193
194# Creates .deb and .rpm (RPM for non-ChromeOS only) installer packages.
195#
196# channel:
197# Name of the channel.
198template("linux_package") {
199 assert(defined(invoker.channel))
200 channel = invoker.channel
201
202 if (current_cpu == "x86") {
mcgrathr6edf192f2015-10-19 19:39:11203 # The shell scripts use "ia32" instead of "x86".
brettwa874dcc2015-08-28 23:59:18204 build_script_arch = "ia32"
205 } else {
206 build_script_arch = current_cpu
207 }
208
209 packaging_files_binaries = [
210 # TODO(mmoss) Any convenient way to get all the relevant build
211 # files? (e.g. all locales, resources, etc.)
212 "$root_out_dir/chrome",
213 "$root_out_dir/chrome_sandbox",
214 "$root_out_dir/xdg-mime",
215 "$root_out_dir/xdg-settings",
216 "$root_out_dir/locales/en-US.pak",
217
mcgrathr6edf192f2015-10-19 19:39:11218 "$root_out_dir/nacl_helper",
219 "$root_out_dir/nacl_helper_bootstrap",
brettwa874dcc2015-08-28 23:59:18220 "$root_out_dir/PepperFlash/libpepflashplayer.so",
221 "$root_out_dir/PepperFlash/manifest.json",
222 ]
223
224 if (current_cpu == "x86") {
225 packaging_files_binaries += [
mcgrathr6edf192f2015-10-19 19:39:11226 "$root_out_dir/nacl_irt_x86_32.nexe",
xhwangc3a252b2016-05-23 02:35:48227 "$root_out_dir/$widevine_cdm_path/libwidevinecdmadapter.so",
228 "$root_out_dir/$widevine_cdm_path/libwidevinecdm.so",
brettwa874dcc2015-08-28 23:59:18229 ]
230 } else if (current_cpu == "x64") {
231 packaging_files_binaries += [
mcgrathr6edf192f2015-10-19 19:39:11232 "$root_out_dir/nacl_irt_x86_64.nexe",
xhwangc3a252b2016-05-23 02:35:48233 "$root_out_dir/$widevine_cdm_path/libwidevinecdmadapter.so",
234 "$root_out_dir/$widevine_cdm_path/libwidevinecdm.so",
brettwa874dcc2015-08-28 23:59:18235 ]
mcgrathr6edf192f2015-10-19 19:39:11236 } else if (current_cpu == "arm") {
237 packaging_files_binaries += [ "$root_out_dir/nacl_irt_arm.nexe" ]
brettwa874dcc2015-08-28 23:59:18238 }
239 if (is_asan) {
240 packaging_files_binaries += [ "$root_out_dir/lib/libc++.so" ]
241 }
242
243 deb_target_name = "${target_name}_deb"
244 action(deb_target_name) {
245 visibility = [ ":*" ]
246 script = "flock_make_package.py"
247
248 if (current_cpu == "x86") {
249 deb_arch = "i386"
250 } else if (current_cpu == "x64") {
251 deb_arch = "amd64"
252 } else if (current_cpu == "arm") {
253 deb_arch = "arm"
254 } else {
255 assert(false, "Linux installer not configured for this architecture.")
256 }
257
258 inputs = packaging_files_binaries
259 outputs = [
260 "$root_out_dir/google-chrome-${channel}_${chrome_version_full}-1_${deb_arch}.deb",
261 ]
262
263 args = [
264 rebase_path("$root_out_dir/linux_package.lock", root_build_dir),
265 rebase_path("$root_out_dir/installer/debian/build.sh", root_build_dir),
266 "-o",
267 rebase_path(root_out_dir, root_build_dir),
268 "-b",
269 rebase_path(root_out_dir, root_build_dir),
270 "-a",
271 build_script_arch,
272 "-c",
273 invoker.channel,
274 "-d",
275 branding_path_component,
276 ]
277 deps = [
278 ":installer_deps",
279 ]
280 }
281
282 if (!is_chromeos) {
283 rpm_target_name = "${target_name}_rpm"
284 action(rpm_target_name) {
285 visibility = [ ":*" ]
286 script = "flock_make_package.py"
287
288 if (current_cpu == "x86") {
289 rpm_arch = "i386"
290 } else if (current_cpu == "x64") {
291 rpm_arch = "x86_64"
292 } else if (current_cpu == "arm") {
293 rpm_arch = "arm"
294 } else {
295 assert(false, "Linux installer not configured for this architecture.")
296 }
297
298 inputs = packaging_files_binaries
299 outputs = [
300 "$root_out_dir/google-chrome-${channel}_${chrome_version_full}-1.${rpm_arch}.rpm",
301 ]
302
303 args = [
304 rebase_path("$root_out_dir/linux_package.lock", root_build_dir),
305 rebase_path("$root_out_dir/installer/rpm/build.sh", root_build_dir),
306 "-o",
307 rebase_path(root_out_dir, root_build_dir),
308 "-b",
309 rebase_path(root_out_dir, root_build_dir),
310 "-a",
311 build_script_arch,
312 "-c",
313 invoker.channel,
314 "-d",
315 branding_path_component,
316 ]
317 deps = [
318 ":installer_deps",
319 ]
320 }
321 }
322
323 group(target_name) {
324 deps = [
325 ":$deb_target_name",
326 ]
327 if (!is_chromeos) {
328 deps += [ ":$rpm_target_name" ]
329 }
330 }
331}
332
333# Standard packages.
334linux_package("stable") {
335 channel = "stable"
336}
337linux_package("beta") {
338 channel = "beta"
339}
340linux_package("unstable") {
341 channel = "unstable"
342}
343
344# Other packages that we support that aren't included in the default "linux"
345# target.
346linux_package("trunk") {
347 channel = "trunk"
348}
349if (is_asan) {
350 linux_package("asan") {
351 channel = "asan"
352 }
353}