Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / installer / linux / BUILD.gn
blobddd2321ef2fbcad2f28587b02ea643c35508b21e
1 # 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.
5 import("//build/config/chrome_build.gni")
6 import("//build/config/features.gni")
7 import("//build/config/sanitizers/sanitizers.gni")
8 import("//build/util/version.gni")
9 import("//chrome/version.gni")
11 assert(is_linux && is_chrome_branded)
13 # This target builds all "normal" Linux installers.
14 # GYP version: chrome/chrome_installer.gypi:linux_packages_all
16 # The bot setup is to build stable, unstable, and beta packages for the current
17 # build. Then a later step picks up the package corresponding to what the
18 # current build is supposed to be. This is wasteful since one build will only
19 # be one of these. This build file also has targets for trunk and possibly asan
20 # installers.
22 # TODO it would be much nicer to have a build variable so the bot can tell us
23 # what the current build should be, so we only have to make one .deb/.rpm pair.
26 # TO BUILD LINUX INSTALLER PACKAGES
28 # The packages list the exact versions of each library used. The versions used
29 # on the bots are likely different than those on your workstation, so you'll
30 # get a stream of errors like:
31 #   < libasound2 (>= 1.0.23)
32 #   ---
33 #   > libasound2 (>= 1.0.16)
35 # To avoid these warnings for testing purposes, do:
37 #   export IGNORE_DEPS_CHANGES=1
39 # before you build.
40 group("linux") {
41   deps = [
42     ":beta",
43     ":stable",
44     ":unstable",
45   ]
48 branding_dir = "//chrome/app/theme/$branding_path_component"
49 branding_dir_100 =
50     "//chrome/app/theme/default_100_percent/$branding_path_component"
52 copy("common_packaging_files") {
53   visibility = [ ":*" ]
54   sources = [
55     "common/apt.include",
56     "common/default-app-block.template",
57     "common/default-app.template",
58     "common/desktop.template",
59     "common/google-chrome/google-chrome.info",
60     "common/installer.include",
61     "common/postinst.include",
62     "common/prerm.include",
63     "common/repo.cron",
64     "common/rpm.include",
65     "common/rpmrepo.cron",
66     "common/symlinks.include",
67     "common/variables.include",
68     "common/wrapper",
69   ]
71   if (current_cpu == "x86") {
72     sources += [ "//build/linux/bin/eu-strip" ]
73   } else if (current_cpu == "x64") {
74     sources += [ "/usr/bin/eu-strip" ]
75   }
77   outputs = [
78     "$root_out_dir/installer/common/{{source_file_part}}",
79   ]
82 copy("deb_packaging_files") {
83   visibility = [ ":*" ]
84   sources = [
85     "debian/build.sh",
86     "debian/changelog.template",
87     "debian/control.template",
88     "debian/debian.menu",
89     "debian/expected_deps_ia32",
90     "debian/expected_deps_x64",
91     "debian/postinst",
92     "debian/postrm",
93     "debian/prerm",
94   ]
95   outputs = [
96     "$root_out_dir/installer/debian/{{source_file_part}}",
97   ]
100 copy("theme_files") {
101   visibility = [ ":*" ]
102   sources = [
103     "$branding_dir/BRANDING",
104     "$branding_dir/linux/product_logo_32.xpm",
105     "$branding_dir/product_logo_128.png",
106     "$branding_dir/product_logo_22.png",
107     "$branding_dir/product_logo_24.png",
108     "$branding_dir/product_logo_256.png",
109     "$branding_dir/product_logo_48.png",
110     "$branding_dir/product_logo_64.png",
111     "$branding_dir_100/product_logo_16.png",
112     "$branding_dir_100/product_logo_32.png",
113   ]
114   outputs = [
115     "$root_out_dir/installer/theme/{{source_file_part}}",
116   ]
119 if (!is_chromeos) {
120   copy("rpm_packaging_files") {
121     visibility = [ ":*" ]
122     sources = [
123       "rpm/build.sh",
124       "rpm/chrome.spec.template",
125       "rpm/expected_deps_i386",
126       "rpm/expected_deps_x86_64",
127     ]
128     outputs = [
129       "$root_out_dir/installer/rpm/{{source_file_part}}",
130     ]
131   }
134 process_version("save_build_info") {
135   # Just output the default version info variables (no template).
136   process_only = true
137   output = "$root_out_dir/installer/version.txt"
140 # Dependencies for all Linux installer targets.
141 group("installer_deps") {
142   public_deps = [
143     ":common_packaging_files",
144     ":deb_packaging_files",
145     ":save_build_info",
146     ":theme_files",
147     "//chrome",
148     "//chrome:packed_resources",
149     "//sandbox/linux:chrome_sandbox",
150     "//third_party/adobe/flash:flapper_binaries",
151   ]
152   if (enable_nacl) {
153     public_deps += [ "//components/nacl:nacl_helper" ]
154   }
155   if (current_cpu == "x86" || current_cpu == "x64") {
156     public_deps += [
157       "//third_party/widevine/cdm:widevinecdm",
158       "//third_party/widevine/cdm:widevinecdmadapter",
159     ]
160   }
161   if (!is_chromeos) {
162     public_deps += [ ":rpm_packaging_files" ]
163   }
166 # Creates .deb and .rpm (RPM for non-ChromeOS only) installer packages.
168 # channel:
169 #   Name of the channel.
170 template("linux_package") {
171   assert(defined(invoker.channel))
172   channel = invoker.channel
174   if (current_cpu == "x86") {
175     # The shell scruipts use "ia32" instead of "x86".
176     build_script_arch = "ia32"
177   } else {
178     build_script_arch = current_cpu
179   }
181   packaging_files_binaries = [
182     # TODO(mmoss) Any convenient way to get all the relevant build
183     # files? (e.g. all locales, resources, etc.)
184     "$root_out_dir/chrome",
185     "$root_out_dir/chrome_sandbox",
186     "$root_out_dir/xdg-mime",
187     "$root_out_dir/xdg-settings",
188     "$root_out_dir/locales/en-US.pak",
190     #"$root_out_dir/nacl_helper",  TODO(GYP) NaCl support.
191     #"$root_out_dir/nacl_helper_bootstrap",  TODO(GYP) NaCl support.
192     "$root_out_dir/PepperFlash/libpepflashplayer.so",
193     "$root_out_dir/PepperFlash/manifest.json",
194   ]
196   if (current_cpu == "x86") {
197     packaging_files_binaries += [
198       #"$root_out_dir/nacl_irt_x86_32.nexe",  TODO(GYP) NaCl support.
199       "$root_out_dir/libwidevinecdmadapter.so",
200       "$root_out_dir/libwidevinecdm.so",
201     ]
202   } else if (current_cpu == "x64") {
203     packaging_files_binaries += [
204       #"$root_out_dir/nacl_irt_x86_64.nexe",  TODO(GYP) NaCl support.
205       "$root_out_dir/libwidevinecdmadapter.so",
206       "$root_out_dir/libwidevinecdm.so",
207     ]
208   }
209   if (is_asan) {
210     packaging_files_binaries += [ "$root_out_dir/lib/libc++.so" ]
211   }
213   deb_target_name = "${target_name}_deb"
214   action(deb_target_name) {
215     visibility = [ ":*" ]
216     script = "flock_make_package.py"
218     if (current_cpu == "x86") {
219       deb_arch = "i386"
220     } else if (current_cpu == "x64") {
221       deb_arch = "amd64"
222     } else if (current_cpu == "arm") {
223       deb_arch = "arm"
224     } else {
225       assert(false, "Linux installer not configured for this architecture.")
226     }
228     inputs = packaging_files_binaries
229     outputs = [
230       "$root_out_dir/google-chrome-${channel}_${chrome_version_full}-1_${deb_arch}.deb",
231     ]
233     args = [
234       rebase_path("$root_out_dir/linux_package.lock", root_build_dir),
235       rebase_path("$root_out_dir/installer/debian/build.sh", root_build_dir),
236       "-o",
237       rebase_path(root_out_dir, root_build_dir),
238       "-b",
239       rebase_path(root_out_dir, root_build_dir),
240       "-a",
241       build_script_arch,
242       "-c",
243       invoker.channel,
244       "-d",
245       branding_path_component,
246     ]
247     deps = [
248       ":installer_deps",
249     ]
250   }
252   if (!is_chromeos) {
253     rpm_target_name = "${target_name}_rpm"
254     action(rpm_target_name) {
255       visibility = [ ":*" ]
256       script = "flock_make_package.py"
258       if (current_cpu == "x86") {
259         rpm_arch = "i386"
260       } else if (current_cpu == "x64") {
261         rpm_arch = "x86_64"
262       } else if (current_cpu == "arm") {
263         rpm_arch = "arm"
264       } else {
265         assert(false, "Linux installer not configured for this architecture.")
266       }
268       inputs = packaging_files_binaries
269       outputs = [
270         "$root_out_dir/google-chrome-${channel}_${chrome_version_full}-1.${rpm_arch}.rpm",
271       ]
273       args = [
274         rebase_path("$root_out_dir/linux_package.lock", root_build_dir),
275         rebase_path("$root_out_dir/installer/rpm/build.sh", root_build_dir),
276         "-o",
277         rebase_path(root_out_dir, root_build_dir),
278         "-b",
279         rebase_path(root_out_dir, root_build_dir),
280         "-a",
281         build_script_arch,
282         "-c",
283         invoker.channel,
284         "-d",
285         branding_path_component,
286       ]
287       deps = [
288         ":installer_deps",
289       ]
290     }
291   }
293   group(target_name) {
294     deps = [
295       ":$deb_target_name",
296     ]
297     if (!is_chromeos) {
298       deps += [ ":$rpm_target_name" ]
299     }
300   }
303 # Standard packages.
304 linux_package("stable") {
305   channel = "stable"
307 linux_package("beta") {
308   channel = "beta"
310 linux_package("unstable") {
311   channel = "unstable"
314 # Other packages that we support that aren't included in the default "linux"
315 # target.
316 linux_package("trunk") {
317   channel = "trunk"
319 if (is_asan) {
320   linux_package("asan") {
321     channel = "asan"
322   }