summaryrefslogtreecommitdiff
path: root/chromium/chrome/installer/linux/BUILD.gn
blob: d8fd944ab6b5761f5c2ff63b16163393d657704e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/chrome_build.gni")
import("//build/config/features.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/sysroot.gni")
import("//build/util/process_version.gni")
import("//build/util/version.gni")
import("//chrome/process_version_rc_template.gni")  # For branding_file_path.

if (current_cpu == "x86" || current_cpu == "x64") {
  import("//media/cdm/ppapi/cdm_paths.gni")
}

assert(is_linux)

# This target builds all "normal" Linux installers.
#
# The bot setup is to build stable, unstable, and beta packages for the current
# build. Then a later step picks up the package corresponding to what the
# current build is supposed to be. This is wasteful since one build will only
# be one of these. This build file also has targets for trunk and possibly asan
# installers.
#
# TODO it would be much nicer to have a build variable so the bot can tell us
# what the current build should be, so we only have to make one .deb/.rpm pair.
#
#
# TO BUILD LINUX INSTALLER PACKAGES
#
# The packages list the exact versions of each library used. The versions used
# on the bots are likely different than those on your workstation, so you'll
# get a stream of errors like:
#   < libasound2 (>= 1.0.23)
#   ---
#   > libasound2 (>= 1.0.16)
#
# To avoid these warnings for testing purposes, do:
#
#   export IGNORE_DEPS_CHANGES=1
#
# before you build.
group("linux") {
  deps = [
    ":beta",
    ":stable",
    ":unstable",
  ]
}

branding_dir = "//chrome/app/theme/$branding_path_component"
branding_dir_100 =
    "//chrome/app/theme/default_100_percent/$branding_path_component"

copy("common_packaging_files") {
  visibility = [ ":*" ]
  sources = [
    "common/apt.include",
    "common/default-app-block.template",
    "common/default-app.template",
    "common/desktop.template",
    "common/installer.include",
    "common/postinst.include",
    "common/prerm.include",
    "common/repo.cron",
    "common/rpm.include",
    "common/rpmrepo.cron",
    "common/symlinks.include",
    "common/variables.include",
    "common/wrapper",
  ]

  if (is_chrome_branded) {
    sources += [
      "common/google-chrome/google-chrome.appdata.xml.template",
      "common/google-chrome/google-chrome.info",
    ]
  } else {
    sources += [
      "common/chromium-browser/chromium-browser.appdata.xml",
      "common/chromium-browser/chromium-browser.info",
    ]
  }

  if (current_cpu == "x86") {
    sources += [ "//build/linux/bin/eu-strip" ]
  } else if (current_cpu == "x64") {
    sources += [ "/usr/bin/eu-strip" ]
  }

  outputs = [
    "$root_out_dir/installer/common/{{source_file_part}}",
  ]
}

copy("deb_packaging_files") {
  visibility = [ ":*" ]
  sources = [
    "debian/build.sh",
    "debian/changelog.template",
    "debian/control.template",
    "debian/debian.menu",
    "debian/expected_deps_ia32_jessie",
    "debian/expected_deps_x64_jessie",
    "debian/postinst",
    "debian/postrm",
    "debian/prerm",
  ]
  outputs = [
    "$root_out_dir/installer/debian/{{source_file_part}}",
  ]
}

copy("theme_files") {
  visibility = [ ":*" ]
  sources = [
    "$branding_dir/BRANDING",
    "$branding_dir/linux/product_logo_32.xpm",
    "$branding_dir/product_logo_128.png",
    "$branding_dir/product_logo_22.png",
    "$branding_dir/product_logo_24.png",
    "$branding_dir/product_logo_256.png",
    "$branding_dir/product_logo_48.png",
    "$branding_dir/product_logo_64.png",
    "$branding_dir_100/product_logo_16.png",
    "$branding_dir_100/product_logo_32.png",
  ]
  outputs = [
    "$root_out_dir/installer/theme/{{source_file_part}}",
  ]
}

if (!is_chromeos) {
  copy("rpm_packaging_files") {
    visibility = [ ":*" ]
    sources = [
      "rpm/build.sh",
      "rpm/chrome.spec.template",
      "rpm/expected_deps_i386",
      "rpm/expected_deps_x86_64",
    ]
    outputs = [
      "$root_out_dir/installer/rpm/{{source_file_part}}",
    ]
  }
}

process_version("save_build_info") {
  # Just output the default version info variables (no template).
  process_only = true
  sources = [
    "//build/util/LASTCHANGE",
    "//chrome/VERSION",
    branding_file_path,
  ]
  output = "$root_out_dir/installer/version.txt"
}

# Dependencies for all Linux installer targets.
group("installer_deps") {
  # Though many of these things appear in data_deps further down the
  # dependency chain, they must appear here as public_deps so that they can
  # be listed as inputs to the actions that depend on ":installer_deps"
  # and are guaranteed to have been built before those actions run.

  public_deps = [
    ":common_packaging_files",
    ":deb_packaging_files",
    ":save_build_info",
    ":theme_files",
    "//chrome",
    "//chrome:packed_resources",
    "//sandbox/linux:chrome_sandbox",
  ]
  if (enable_nacl) {
    public_deps += [
      "//components/nacl/loader:nacl_helper",

      # These are data_deps of nacl_helper, but that is not enough,
      # as explained above.
      "//native_client/src/trusted/service_runtime/linux:bootstrap",
      "//ppapi/native_client:irt",
    ]
  }
  if (current_cpu == "x86" || current_cpu == "x64") {
    public_deps += [
      "//third_party/widevine/cdm:widevinecdm",
      "//third_party/widevine/cdm:widevinecdmadapter",
    ]
  }
  if (!is_chromeos) {
    public_deps += [ ":rpm_packaging_files" ]
  }
  if (use_custom_libcxx) {
    public_deps += [ "//buildtools/third_party/libc++" ]
  }
}

# Creates .deb and .rpm (RPM for non-ChromeOS only) installer packages.
#
# channel:
#   Name of the channel.
template("linux_package") {
  assert(defined(invoker.channel))
  channel = invoker.channel

  if (current_cpu == "x86") {
    # The shell scripts use "ia32" instead of "x86".
    build_script_arch = "ia32"
  } else {
    build_script_arch = current_cpu
  }

  packaging_files_binaries = [
    # TODO(mmoss) Any convenient way to get all the relevant build
    # files? (e.g. all locales, resources, etc.)
    "$root_out_dir/chrome",
    "$root_out_dir/chrome_sandbox",
    "$root_out_dir/xdg-mime",
    "$root_out_dir/xdg-settings",
    "$root_out_dir/locales/en-US.pak",

    "$root_out_dir/nacl_helper",
    "$root_out_dir/nacl_helper_bootstrap",
  ]

  if (current_cpu == "x86") {
    packaging_files_binaries += [ "$root_out_dir/nacl_irt_x86_32.nexe" ]
  } else if (current_cpu == "x64") {
    packaging_files_binaries += [ "$root_out_dir/nacl_irt_x86_64.nexe" ]
  } else if (current_cpu == "arm") {
    packaging_files_binaries += [ "$root_out_dir/nacl_irt_arm.nexe" ]
  }

  # The widevine BUILD.gn only produces shared libraries for x86 and x64
  if (is_chrome_branded && (current_cpu == "x86" || current_cpu == "x64")) {
    packaging_files_binaries += [
      "$root_out_dir/$widevine_cdm_path/libwidevinecdmadapter.so",
      "$root_out_dir/$widevine_cdm_path/libwidevinecdm.so",
    ]
  }

  if (use_custom_libcxx) {
    packaging_files_binaries += [ "$root_out_dir/libc++.so" ]
  }

  deb_target_name = "${target_name}_deb"
  action(deb_target_name) {
    visibility = [ ":*" ]
    script = "flock_make_package.py"

    if (current_cpu == "x86") {
      deb_arch = "i386"
    } else if (current_cpu == "x64") {
      deb_arch = "amd64"
    } else if (current_cpu == "arm") {
      deb_arch = "arm"
    } else {
      assert(false, "Linux installer not configured for this architecture.")
    }

    inputs = packaging_files_binaries
    outputs = [
      "$root_out_dir/google-chrome-${channel}_${chrome_version_full}-1_${deb_arch}.deb",
    ]

    args = [
      rebase_path("$root_out_dir/linux_package.lock", root_build_dir),
      rebase_path("$root_out_dir/installer/debian/build.sh", root_build_dir),
      "-o",
      rebase_path(root_out_dir, root_build_dir),
      "-b",
      rebase_path(root_out_dir, root_build_dir),
      "-a",
      build_script_arch,
      "-c",
      invoker.channel,
      "-d",
      branding_path_component,
      "-s",
      rebase_path(sysroot),
    ]
    deps = [
      ":installer_deps",
    ]
  }

  if (!is_chromeos) {
    rpm_target_name = "${target_name}_rpm"
    action(rpm_target_name) {
      visibility = [ ":*" ]
      script = "flock_make_package.py"

      if (current_cpu == "x86") {
        rpm_arch = "i386"
      } else if (current_cpu == "x64") {
        rpm_arch = "x86_64"
      } else if (current_cpu == "arm") {
        rpm_arch = "arm"
      } else {
        assert(false, "Linux installer not configured for this architecture.")
      }

      inputs = packaging_files_binaries
      outputs = [
        "$root_out_dir/google-chrome-${channel}_${chrome_version_full}-1.${rpm_arch}.rpm",
      ]

      args = [
        rebase_path("$root_out_dir/linux_package.lock", root_build_dir),
        rebase_path("$root_out_dir/installer/rpm/build.sh", root_build_dir),
        "-o",
        rebase_path(root_out_dir, root_build_dir),
        "-b",
        rebase_path(root_out_dir, root_build_dir),
        "-a",
        build_script_arch,
        "-c",
        invoker.channel,
        "-d",
        branding_path_component,
      ]
      deps = [
        ":installer_deps",
      ]
    }
  }

  group(target_name) {
    deps = [
      ":$deb_target_name",
    ]
    if (!is_chromeos) {
      deps += [ ":$rpm_target_name" ]
    }
  }
}

# Standard packages.
linux_package("stable") {
  channel = "stable"
}
linux_package("beta") {
  channel = "beta"
}
linux_package("unstable") {
  channel = "unstable"
}

# Other packages that we support that aren't included in the default "linux"
# target.
linux_package("trunk") {
  channel = "trunk"
}
if (is_asan) {
  linux_package("asan") {
    channel = "asan"
  }
}