blob: 9b71c46fcdfb257373e1b80ea232c498b76d1da3 [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")
yutakb4efc3872016-09-14 09:47:469import("//chrome/version.gni")
brettwa874dcc2015-08-28 23:59:1810
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",
brettwa874dcc2015-08-28 23:59:18171 ]
dpranke3b870612015-09-10 23:42:04172 if (enable_nacl) {
mcgrathr6edf192f2015-10-19 19:39:11173 public_deps += [
brettwf4b4a4282015-12-16 00:41:13174 "//components/nacl/loader:nacl_helper",
mcgrathr6edf192f2015-10-19 19:39:11175
176 # These are data_deps of nacl_helper, but that is not enough,
177 # as explained above.
178 "//native_client/src/trusted/service_runtime/linux:bootstrap",
179 "//ppapi/native_client:irt",
180 ]
dpranke3b870612015-09-10 23:42:04181 }
brettwa874dcc2015-08-28 23:59:18182 if (current_cpu == "x86" || current_cpu == "x64") {
183 public_deps += [
184 "//third_party/widevine/cdm:widevinecdm",
185 "//third_party/widevine/cdm:widevinecdmadapter",
186 ]
187 }
188 if (!is_chromeos) {
189 public_deps += [ ":rpm_packaging_files" ]
190 }
191}
192
193# Creates .deb and .rpm (RPM for non-ChromeOS only) installer packages.
194#
195# channel:
196# Name of the channel.
197template("linux_package") {
198 assert(defined(invoker.channel))
199 channel = invoker.channel
200
201 if (current_cpu == "x86") {
mcgrathr6edf192f2015-10-19 19:39:11202 # The shell scripts use "ia32" instead of "x86".
brettwa874dcc2015-08-28 23:59:18203 build_script_arch = "ia32"
204 } else {
205 build_script_arch = current_cpu
206 }
207
208 packaging_files_binaries = [
209 # TODO(mmoss) Any convenient way to get all the relevant build
210 # files? (e.g. all locales, resources, etc.)
211 "$root_out_dir/chrome",
212 "$root_out_dir/chrome_sandbox",
213 "$root_out_dir/xdg-mime",
214 "$root_out_dir/xdg-settings",
215 "$root_out_dir/locales/en-US.pak",
216
mcgrathr6edf192f2015-10-19 19:39:11217 "$root_out_dir/nacl_helper",
218 "$root_out_dir/nacl_helper_bootstrap",
brettwa874dcc2015-08-28 23:59:18219 ]
220
221 if (current_cpu == "x86") {
222 packaging_files_binaries += [
mcgrathr6edf192f2015-10-19 19:39:11223 "$root_out_dir/nacl_irt_x86_32.nexe",
xhwangc3a252b2016-05-23 02:35:48224 "$root_out_dir/$widevine_cdm_path/libwidevinecdmadapter.so",
225 "$root_out_dir/$widevine_cdm_path/libwidevinecdm.so",
brettwa874dcc2015-08-28 23:59:18226 ]
227 } else if (current_cpu == "x64") {
228 packaging_files_binaries += [
mcgrathr6edf192f2015-10-19 19:39:11229 "$root_out_dir/nacl_irt_x86_64.nexe",
xhwangc3a252b2016-05-23 02:35:48230 "$root_out_dir/$widevine_cdm_path/libwidevinecdmadapter.so",
231 "$root_out_dir/$widevine_cdm_path/libwidevinecdm.so",
brettwa874dcc2015-08-28 23:59:18232 ]
mcgrathr6edf192f2015-10-19 19:39:11233 } else if (current_cpu == "arm") {
234 packaging_files_binaries += [ "$root_out_dir/nacl_irt_arm.nexe" ]
brettwa874dcc2015-08-28 23:59:18235 }
236 if (is_asan) {
237 packaging_files_binaries += [ "$root_out_dir/lib/libc++.so" ]
238 }
239
240 deb_target_name = "${target_name}_deb"
241 action(deb_target_name) {
242 visibility = [ ":*" ]
243 script = "flock_make_package.py"
244
245 if (current_cpu == "x86") {
246 deb_arch = "i386"
247 } else if (current_cpu == "x64") {
248 deb_arch = "amd64"
249 } else if (current_cpu == "arm") {
250 deb_arch = "arm"
251 } else {
252 assert(false, "Linux installer not configured for this architecture.")
253 }
254
255 inputs = packaging_files_binaries
256 outputs = [
257 "$root_out_dir/google-chrome-${channel}_${chrome_version_full}-1_${deb_arch}.deb",
258 ]
259
260 args = [
261 rebase_path("$root_out_dir/linux_package.lock", root_build_dir),
262 rebase_path("$root_out_dir/installer/debian/build.sh", root_build_dir),
263 "-o",
264 rebase_path(root_out_dir, root_build_dir),
265 "-b",
266 rebase_path(root_out_dir, root_build_dir),
267 "-a",
268 build_script_arch,
269 "-c",
270 invoker.channel,
271 "-d",
272 branding_path_component,
273 ]
274 deps = [
275 ":installer_deps",
276 ]
277 }
278
279 if (!is_chromeos) {
280 rpm_target_name = "${target_name}_rpm"
281 action(rpm_target_name) {
282 visibility = [ ":*" ]
283 script = "flock_make_package.py"
284
285 if (current_cpu == "x86") {
286 rpm_arch = "i386"
287 } else if (current_cpu == "x64") {
288 rpm_arch = "x86_64"
289 } else if (current_cpu == "arm") {
290 rpm_arch = "arm"
291 } else {
292 assert(false, "Linux installer not configured for this architecture.")
293 }
294
295 inputs = packaging_files_binaries
296 outputs = [
297 "$root_out_dir/google-chrome-${channel}_${chrome_version_full}-1.${rpm_arch}.rpm",
298 ]
299
300 args = [
301 rebase_path("$root_out_dir/linux_package.lock", root_build_dir),
302 rebase_path("$root_out_dir/installer/rpm/build.sh", root_build_dir),
303 "-o",
304 rebase_path(root_out_dir, root_build_dir),
305 "-b",
306 rebase_path(root_out_dir, root_build_dir),
307 "-a",
308 build_script_arch,
309 "-c",
310 invoker.channel,
311 "-d",
312 branding_path_component,
313 ]
314 deps = [
315 ":installer_deps",
316 ]
317 }
318 }
319
320 group(target_name) {
321 deps = [
322 ":$deb_target_name",
323 ]
324 if (!is_chromeos) {
325 deps += [ ":$rpm_target_name" ]
326 }
327 }
328}
329
330# Standard packages.
331linux_package("stable") {
332 channel = "stable"
333}
334linux_package("beta") {
335 channel = "beta"
336}
337linux_package("unstable") {
338 channel = "unstable"
339}
340
341# Other packages that we support that aren't included in the default "linux"
342# target.
343linux_package("trunk") {
344 channel = "trunk"
345}
346if (is_asan) {
347 linux_package("asan") {
348 channel = "asan"
349 }
350}