blob: 17cd1567f1c8acf925e831eb22c468f16cf3551b [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")
thomasanderson7a01af42016-10-18 21:22:428import("//build/config/sysroot.gni")
raphael.kubo.da.costadc683d22016-09-17 19:41:139import("//build/util/process_version.gni")
brettwa874dcc2015-08-28 23:59:1810import("//build/util/version.gni")
raphael.kubo.da.costadc683d22016-09-17 19:41:1311import("//chrome/process_version_rc_template.gni") # For branding_file_path.
brettwa874dcc2015-08-28 23:59:1812
xhwangc3a252b2016-05-23 02:35:4813if (current_cpu == "x86" || current_cpu == "x64") {
14 import("//media/cdm/ppapi/cdm_paths.gni")
15}
16
sbcfa8f43b2016-10-05 17:11:3517assert(is_linux)
brettwa874dcc2015-08-28 23:59:1818
19# This target builds all "normal" Linux installers.
brettwa874dcc2015-08-28 23:59:1820#
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",
brettwa874dcc2015-08-28 23:59:1876 "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
sbcfa8f43b2016-10-05 17:11:3587 if (is_chrome_branded) {
tomas.popeladd765c02017-03-21 14:44:1688 sources += [
89 "common/google-chrome/google-chrome.appdata.xml.template",
90 "common/google-chrome/google-chrome.info",
91 ]
sbcfa8f43b2016-10-05 17:11:3592 } else {
tomas.popeladd765c02017-03-21 14:44:1693 sources += [
94 "common/chromium-browser/chromium-browser.appdata.xml",
95 "common/chromium-browser/chromium-browser.info",
96 ]
sbcfa8f43b2016-10-05 17:11:3597 }
98
brettwa874dcc2015-08-28 23:59:1899 if (current_cpu == "x86") {
100 sources += [ "//build/linux/bin/eu-strip" ]
101 } else if (current_cpu == "x64") {
102 sources += [ "/usr/bin/eu-strip" ]
103 }
104
105 outputs = [
106 "$root_out_dir/installer/common/{{source_file_part}}",
107 ]
108}
109
110copy("deb_packaging_files") {
111 visibility = [ ":*" ]
112 sources = [
113 "debian/build.sh",
114 "debian/changelog.template",
115 "debian/control.template",
116 "debian/debian.menu",
thomasanderson7a01af42016-10-18 21:22:42117 "debian/expected_deps_ia32_jessie",
118 "debian/expected_deps_ia32_wheezy",
119 "debian/expected_deps_x64_jessie",
120 "debian/expected_deps_x64_wheezy",
brettwa874dcc2015-08-28 23:59:18121 "debian/postinst",
122 "debian/postrm",
123 "debian/prerm",
124 ]
125 outputs = [
126 "$root_out_dir/installer/debian/{{source_file_part}}",
127 ]
128}
129
130copy("theme_files") {
131 visibility = [ ":*" ]
132 sources = [
133 "$branding_dir/BRANDING",
134 "$branding_dir/linux/product_logo_32.xpm",
135 "$branding_dir/product_logo_128.png",
136 "$branding_dir/product_logo_22.png",
137 "$branding_dir/product_logo_24.png",
138 "$branding_dir/product_logo_256.png",
139 "$branding_dir/product_logo_48.png",
140 "$branding_dir/product_logo_64.png",
141 "$branding_dir_100/product_logo_16.png",
142 "$branding_dir_100/product_logo_32.png",
143 ]
144 outputs = [
145 "$root_out_dir/installer/theme/{{source_file_part}}",
146 ]
147}
148
149if (!is_chromeos) {
150 copy("rpm_packaging_files") {
151 visibility = [ ":*" ]
152 sources = [
153 "rpm/build.sh",
154 "rpm/chrome.spec.template",
155 "rpm/expected_deps_i386",
156 "rpm/expected_deps_x86_64",
157 ]
158 outputs = [
159 "$root_out_dir/installer/rpm/{{source_file_part}}",
160 ]
161 }
162}
163
164process_version("save_build_info") {
165 # Just output the default version info variables (no template).
166 process_only = true
raphael.kubo.da.costadc683d22016-09-17 19:41:13167 sources = [
168 "//build/util/LASTCHANGE",
169 "//chrome/VERSION",
170 branding_file_path,
171 ]
brettwa874dcc2015-08-28 23:59:18172 output = "$root_out_dir/installer/version.txt"
173}
174
175# Dependencies for all Linux installer targets.
176group("installer_deps") {
mcgrathr6edf192f2015-10-19 19:39:11177 # Though many of these things appear in data_deps further down the
178 # dependency chain, they must appear here as public_deps so that they can
179 # be listed as inputs to the actions that depend on ":installer_deps"
180 # and are guaranteed to have been built before those actions run.
181
brettwa874dcc2015-08-28 23:59:18182 public_deps = [
183 ":common_packaging_files",
184 ":deb_packaging_files",
185 ":save_build_info",
186 ":theme_files",
187 "//chrome",
188 "//chrome:packed_resources",
brettwa874dcc2015-08-28 23:59:18189 "//sandbox/linux:chrome_sandbox",
brettwa874dcc2015-08-28 23:59:18190 ]
dpranke3b870612015-09-10 23:42:04191 if (enable_nacl) {
mcgrathr6edf192f2015-10-19 19:39:11192 public_deps += [
brettwf4b4a4282015-12-16 00:41:13193 "//components/nacl/loader:nacl_helper",
mcgrathr6edf192f2015-10-19 19:39:11194
195 # These are data_deps of nacl_helper, but that is not enough,
196 # as explained above.
197 "//native_client/src/trusted/service_runtime/linux:bootstrap",
198 "//ppapi/native_client:irt",
199 ]
dpranke3b870612015-09-10 23:42:04200 }
brettwa874dcc2015-08-28 23:59:18201 if (current_cpu == "x86" || current_cpu == "x64") {
202 public_deps += [
203 "//third_party/widevine/cdm:widevinecdm",
204 "//third_party/widevine/cdm:widevinecdmadapter",
205 ]
206 }
207 if (!is_chromeos) {
208 public_deps += [ ":rpm_packaging_files" ]
209 }
xhwang7e98c2b2016-11-10 01:54:23210 if (use_custom_libcxx) {
211 public_deps += [ "//buildtools/third_party/libc++" ]
212 }
brettwa874dcc2015-08-28 23:59:18213}
214
215# Creates .deb and .rpm (RPM for non-ChromeOS only) installer packages.
216#
217# channel:
218# Name of the channel.
219template("linux_package") {
220 assert(defined(invoker.channel))
221 channel = invoker.channel
222
223 if (current_cpu == "x86") {
mcgrathr6edf192f2015-10-19 19:39:11224 # The shell scripts use "ia32" instead of "x86".
brettwa874dcc2015-08-28 23:59:18225 build_script_arch = "ia32"
226 } else {
227 build_script_arch = current_cpu
228 }
229
230 packaging_files_binaries = [
231 # TODO(mmoss) Any convenient way to get all the relevant build
232 # files? (e.g. all locales, resources, etc.)
233 "$root_out_dir/chrome",
234 "$root_out_dir/chrome_sandbox",
235 "$root_out_dir/xdg-mime",
236 "$root_out_dir/xdg-settings",
237 "$root_out_dir/locales/en-US.pak",
238
mcgrathr6edf192f2015-10-19 19:39:11239 "$root_out_dir/nacl_helper",
240 "$root_out_dir/nacl_helper_bootstrap",
brettwa874dcc2015-08-28 23:59:18241 ]
242
243 if (current_cpu == "x86") {
sbcfa8f43b2016-10-05 17:11:35244 packaging_files_binaries += [ "$root_out_dir/nacl_irt_x86_32.nexe" ]
brettwa874dcc2015-08-28 23:59:18245 } else if (current_cpu == "x64") {
sbcfa8f43b2016-10-05 17:11:35246 packaging_files_binaries += [ "$root_out_dir/nacl_irt_x86_64.nexe" ]
mcgrathr6edf192f2015-10-19 19:39:11247 } else if (current_cpu == "arm") {
248 packaging_files_binaries += [ "$root_out_dir/nacl_irt_arm.nexe" ]
brettwa874dcc2015-08-28 23:59:18249 }
sbcfa8f43b2016-10-05 17:11:35250
sbc8c9a63e2016-10-10 18:40:36251 # The widevine BUILD.gn only produces shared libraries for x86 and x64
252 if (is_chrome_branded && (current_cpu == "x86" || current_cpu == "x64")) {
sbcfa8f43b2016-10-05 17:11:35253 packaging_files_binaries += [
254 "$root_out_dir/$widevine_cdm_path/libwidevinecdmadapter.so",
255 "$root_out_dir/$widevine_cdm_path/libwidevinecdm.so",
256 ]
257 }
258
xhwang7e98c2b2016-11-10 01:54:23259 if (use_custom_libcxx) {
260 packaging_files_binaries += [ "$root_out_dir/libc++.so" ]
brettwa874dcc2015-08-28 23:59:18261 }
262
263 deb_target_name = "${target_name}_deb"
264 action(deb_target_name) {
265 visibility = [ ":*" ]
266 script = "flock_make_package.py"
267
268 if (current_cpu == "x86") {
269 deb_arch = "i386"
270 } else if (current_cpu == "x64") {
271 deb_arch = "amd64"
272 } else if (current_cpu == "arm") {
273 deb_arch = "arm"
274 } else {
275 assert(false, "Linux installer not configured for this architecture.")
276 }
277
278 inputs = packaging_files_binaries
279 outputs = [
280 "$root_out_dir/google-chrome-${channel}_${chrome_version_full}-1_${deb_arch}.deb",
281 ]
282
283 args = [
284 rebase_path("$root_out_dir/linux_package.lock", root_build_dir),
285 rebase_path("$root_out_dir/installer/debian/build.sh", root_build_dir),
286 "-o",
287 rebase_path(root_out_dir, root_build_dir),
288 "-b",
289 rebase_path(root_out_dir, root_build_dir),
290 "-a",
291 build_script_arch,
292 "-c",
293 invoker.channel,
294 "-d",
295 branding_path_component,
thomasanderson7a01af42016-10-18 21:22:42296 "-s",
297 rebase_path(sysroot),
brettwa874dcc2015-08-28 23:59:18298 ]
299 deps = [
300 ":installer_deps",
301 ]
302 }
303
304 if (!is_chromeos) {
305 rpm_target_name = "${target_name}_rpm"
306 action(rpm_target_name) {
307 visibility = [ ":*" ]
308 script = "flock_make_package.py"
309
310 if (current_cpu == "x86") {
311 rpm_arch = "i386"
312 } else if (current_cpu == "x64") {
313 rpm_arch = "x86_64"
314 } else if (current_cpu == "arm") {
315 rpm_arch = "arm"
316 } else {
317 assert(false, "Linux installer not configured for this architecture.")
318 }
319
320 inputs = packaging_files_binaries
321 outputs = [
322 "$root_out_dir/google-chrome-${channel}_${chrome_version_full}-1.${rpm_arch}.rpm",
323 ]
324
325 args = [
326 rebase_path("$root_out_dir/linux_package.lock", root_build_dir),
327 rebase_path("$root_out_dir/installer/rpm/build.sh", root_build_dir),
328 "-o",
329 rebase_path(root_out_dir, root_build_dir),
330 "-b",
331 rebase_path(root_out_dir, root_build_dir),
332 "-a",
333 build_script_arch,
334 "-c",
335 invoker.channel,
336 "-d",
337 branding_path_component,
338 ]
339 deps = [
340 ":installer_deps",
341 ]
342 }
343 }
344
345 group(target_name) {
346 deps = [
347 ":$deb_target_name",
348 ]
349 if (!is_chromeos) {
350 deps += [ ":$rpm_target_name" ]
351 }
352 }
353}
354
355# Standard packages.
356linux_package("stable") {
357 channel = "stable"
358}
359linux_package("beta") {
360 channel = "beta"
361}
362linux_package("unstable") {
363 channel = "unstable"
364}
365
366# Other packages that we support that aren't included in the default "linux"
367# target.
368linux_package("trunk") {
369 channel = "trunk"
370}
371if (is_asan) {
372 linux_package("asan") {
373 channel = "asan"
374 }
375}