blob: 49d80ca833f1a5bf2895398617d0ab86095b6a43 [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.
19# GYP version: chrome/chrome_installer.gypi:linux_packages_all
20#
21# The bot setup is to build stable, unstable, and beta packages for the current
22# build. Then a later step picks up the package corresponding to what the
23# current build is supposed to be. This is wasteful since one build will only
24# be one of these. This build file also has targets for trunk and possibly asan
25# installers.
26#
27# TODO it would be much nicer to have a build variable so the bot can tell us
28# what the current build should be, so we only have to make one .deb/.rpm pair.
29#
30#
31# TO BUILD LINUX INSTALLER PACKAGES
32#
33# The packages list the exact versions of each library used. The versions used
34# on the bots are likely different than those on your workstation, so you'll
35# get a stream of errors like:
36# < libasound2 (>= 1.0.23)
37# ---
38# > libasound2 (>= 1.0.16)
39#
40# To avoid these warnings for testing purposes, do:
41#
42# export IGNORE_DEPS_CHANGES=1
43#
44# before you build.
45group("linux") {
46 deps = [
47 ":beta",
48 ":stable",
49 ":unstable",
50 ]
51}
52
dprankeb8c6d5f2015-10-02 19:52:3753# This target is provided for compatibility w/ GYP. Users should always
54# depend directly on :linux instead of this target (we set visibility
55# to the empty list to prevent unwanted callers).
brettw57399c52016-05-10 18:34:0556# TODO(GYP_GONE): Delete this target after we've migrated away from GYP and
dprankeb8c6d5f2015-10-02 19:52:3757# updated the bots to build :linux instead.
58group("linux_packages_all") {
59 visibility = []
60 deps = [
61 ":linux",
62 ]
63}
64
brettwa874dcc2015-08-28 23:59:1865branding_dir = "//chrome/app/theme/$branding_path_component"
66branding_dir_100 =
67 "//chrome/app/theme/default_100_percent/$branding_path_component"
68
69copy("common_packaging_files") {
70 visibility = [ ":*" ]
71 sources = [
72 "common/apt.include",
73 "common/default-app-block.template",
74 "common/default-app.template",
75 "common/desktop.template",
76 "common/google-chrome/google-chrome.info",
77 "common/installer.include",
78 "common/postinst.include",
79 "common/prerm.include",
80 "common/repo.cron",
81 "common/rpm.include",
82 "common/rpmrepo.cron",
83 "common/symlinks.include",
84 "common/variables.include",
85 "common/wrapper",
86 ]
87
88 if (current_cpu == "x86") {
89 sources += [ "//build/linux/bin/eu-strip" ]
90 } else if (current_cpu == "x64") {
91 sources += [ "/usr/bin/eu-strip" ]
92 }
93
94 outputs = [
95 "$root_out_dir/installer/common/{{source_file_part}}",
96 ]
97}
98
99copy("deb_packaging_files") {
100 visibility = [ ":*" ]
101 sources = [
102 "debian/build.sh",
103 "debian/changelog.template",
104 "debian/control.template",
105 "debian/debian.menu",
106 "debian/expected_deps_ia32",
107 "debian/expected_deps_x64",
108 "debian/postinst",
109 "debian/postrm",
110 "debian/prerm",
111 ]
112 outputs = [
113 "$root_out_dir/installer/debian/{{source_file_part}}",
114 ]
115}
116
117copy("theme_files") {
118 visibility = [ ":*" ]
119 sources = [
120 "$branding_dir/BRANDING",
121 "$branding_dir/linux/product_logo_32.xpm",
122 "$branding_dir/product_logo_128.png",
123 "$branding_dir/product_logo_22.png",
124 "$branding_dir/product_logo_24.png",
125 "$branding_dir/product_logo_256.png",
126 "$branding_dir/product_logo_48.png",
127 "$branding_dir/product_logo_64.png",
128 "$branding_dir_100/product_logo_16.png",
129 "$branding_dir_100/product_logo_32.png",
130 ]
131 outputs = [
132 "$root_out_dir/installer/theme/{{source_file_part}}",
133 ]
134}
135
136if (!is_chromeos) {
137 copy("rpm_packaging_files") {
138 visibility = [ ":*" ]
139 sources = [
140 "rpm/build.sh",
141 "rpm/chrome.spec.template",
142 "rpm/expected_deps_i386",
143 "rpm/expected_deps_x86_64",
144 ]
145 outputs = [
146 "$root_out_dir/installer/rpm/{{source_file_part}}",
147 ]
148 }
149}
150
151process_version("save_build_info") {
152 # Just output the default version info variables (no template).
153 process_only = true
raphael.kubo.da.costadc683d22016-09-17 19:41:13154 sources = [
155 "//build/util/LASTCHANGE",
156 "//chrome/VERSION",
157 branding_file_path,
158 ]
brettwa874dcc2015-08-28 23:59:18159 output = "$root_out_dir/installer/version.txt"
160}
161
162# Dependencies for all Linux installer targets.
163group("installer_deps") {
mcgrathr6edf192f2015-10-19 19:39:11164 # Though many of these things appear in data_deps further down the
165 # dependency chain, they must appear here as public_deps so that they can
166 # be listed as inputs to the actions that depend on ":installer_deps"
167 # and are guaranteed to have been built before those actions run.
168
brettwa874dcc2015-08-28 23:59:18169 public_deps = [
170 ":common_packaging_files",
171 ":deb_packaging_files",
172 ":save_build_info",
173 ":theme_files",
174 "//chrome",
175 "//chrome:packed_resources",
brettwa874dcc2015-08-28 23:59:18176 "//sandbox/linux:chrome_sandbox",
brettwa874dcc2015-08-28 23:59:18177 ]
dpranke3b870612015-09-10 23:42:04178 if (enable_nacl) {
mcgrathr6edf192f2015-10-19 19:39:11179 public_deps += [
brettwf4b4a4282015-12-16 00:41:13180 "//components/nacl/loader:nacl_helper",
mcgrathr6edf192f2015-10-19 19:39:11181
182 # These are data_deps of nacl_helper, but that is not enough,
183 # as explained above.
184 "//native_client/src/trusted/service_runtime/linux:bootstrap",
185 "//ppapi/native_client:irt",
186 ]
dpranke3b870612015-09-10 23:42:04187 }
brettwa874dcc2015-08-28 23:59:18188 if (current_cpu == "x86" || current_cpu == "x64") {
189 public_deps += [
190 "//third_party/widevine/cdm:widevinecdm",
191 "//third_party/widevine/cdm:widevinecdmadapter",
192 ]
193 }
194 if (!is_chromeos) {
195 public_deps += [ ":rpm_packaging_files" ]
196 }
197}
198
199# Creates .deb and .rpm (RPM for non-ChromeOS only) installer packages.
200#
201# channel:
202# Name of the channel.
203template("linux_package") {
204 assert(defined(invoker.channel))
205 channel = invoker.channel
206
207 if (current_cpu == "x86") {
mcgrathr6edf192f2015-10-19 19:39:11208 # The shell scripts use "ia32" instead of "x86".
brettwa874dcc2015-08-28 23:59:18209 build_script_arch = "ia32"
210 } else {
211 build_script_arch = current_cpu
212 }
213
214 packaging_files_binaries = [
215 # TODO(mmoss) Any convenient way to get all the relevant build
216 # files? (e.g. all locales, resources, etc.)
217 "$root_out_dir/chrome",
218 "$root_out_dir/chrome_sandbox",
219 "$root_out_dir/xdg-mime",
220 "$root_out_dir/xdg-settings",
221 "$root_out_dir/locales/en-US.pak",
222
mcgrathr6edf192f2015-10-19 19:39:11223 "$root_out_dir/nacl_helper",
224 "$root_out_dir/nacl_helper_bootstrap",
brettwa874dcc2015-08-28 23:59:18225 ]
226
227 if (current_cpu == "x86") {
228 packaging_files_binaries += [
mcgrathr6edf192f2015-10-19 19:39:11229 "$root_out_dir/nacl_irt_x86_32.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 ]
233 } else if (current_cpu == "x64") {
234 packaging_files_binaries += [
mcgrathr6edf192f2015-10-19 19:39:11235 "$root_out_dir/nacl_irt_x86_64.nexe",
xhwangc3a252b2016-05-23 02:35:48236 "$root_out_dir/$widevine_cdm_path/libwidevinecdmadapter.so",
237 "$root_out_dir/$widevine_cdm_path/libwidevinecdm.so",
brettwa874dcc2015-08-28 23:59:18238 ]
mcgrathr6edf192f2015-10-19 19:39:11239 } else if (current_cpu == "arm") {
240 packaging_files_binaries += [ "$root_out_dir/nacl_irt_arm.nexe" ]
brettwa874dcc2015-08-28 23:59:18241 }
242 if (is_asan) {
243 packaging_files_binaries += [ "$root_out_dir/lib/libc++.so" ]
244 }
245
246 deb_target_name = "${target_name}_deb"
247 action(deb_target_name) {
248 visibility = [ ":*" ]
249 script = "flock_make_package.py"
250
251 if (current_cpu == "x86") {
252 deb_arch = "i386"
253 } else if (current_cpu == "x64") {
254 deb_arch = "amd64"
255 } else if (current_cpu == "arm") {
256 deb_arch = "arm"
257 } else {
258 assert(false, "Linux installer not configured for this architecture.")
259 }
260
261 inputs = packaging_files_binaries
262 outputs = [
263 "$root_out_dir/google-chrome-${channel}_${chrome_version_full}-1_${deb_arch}.deb",
264 ]
265
266 args = [
267 rebase_path("$root_out_dir/linux_package.lock", root_build_dir),
268 rebase_path("$root_out_dir/installer/debian/build.sh", root_build_dir),
269 "-o",
270 rebase_path(root_out_dir, root_build_dir),
271 "-b",
272 rebase_path(root_out_dir, root_build_dir),
273 "-a",
274 build_script_arch,
275 "-c",
276 invoker.channel,
277 "-d",
278 branding_path_component,
279 ]
280 deps = [
281 ":installer_deps",
282 ]
283 }
284
285 if (!is_chromeos) {
286 rpm_target_name = "${target_name}_rpm"
287 action(rpm_target_name) {
288 visibility = [ ":*" ]
289 script = "flock_make_package.py"
290
291 if (current_cpu == "x86") {
292 rpm_arch = "i386"
293 } else if (current_cpu == "x64") {
294 rpm_arch = "x86_64"
295 } else if (current_cpu == "arm") {
296 rpm_arch = "arm"
297 } else {
298 assert(false, "Linux installer not configured for this architecture.")
299 }
300
301 inputs = packaging_files_binaries
302 outputs = [
303 "$root_out_dir/google-chrome-${channel}_${chrome_version_full}-1.${rpm_arch}.rpm",
304 ]
305
306 args = [
307 rebase_path("$root_out_dir/linux_package.lock", root_build_dir),
308 rebase_path("$root_out_dir/installer/rpm/build.sh", root_build_dir),
309 "-o",
310 rebase_path(root_out_dir, root_build_dir),
311 "-b",
312 rebase_path(root_out_dir, root_build_dir),
313 "-a",
314 build_script_arch,
315 "-c",
316 invoker.channel,
317 "-d",
318 branding_path_component,
319 ]
320 deps = [
321 ":installer_deps",
322 ]
323 }
324 }
325
326 group(target_name) {
327 deps = [
328 ":$deb_target_name",
329 ]
330 if (!is_chromeos) {
331 deps += [ ":$rpm_target_name" ]
332 }
333 }
334}
335
336# Standard packages.
337linux_package("stable") {
338 channel = "stable"
339}
340linux_package("beta") {
341 channel = "beta"
342}
343linux_package("unstable") {
344 channel = "unstable"
345}
346
347# Other packages that we support that aren't included in the default "linux"
348# target.
349linux_package("trunk") {
350 channel = "trunk"
351}
352if (is_asan) {
353 linux_package("asan") {
354 channel = "asan"
355 }
356}