summaryrefslogtreecommitdiff
path: root/chromium/extensions/shell/installer/linux/BUILD.gn
blob: bd60b495c8986eb034bdc7e0cf3a0f6636c9d418 (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
# Copyright 2017 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.

# TODO(michaelpg): Dedupe with Chrome installer.

import("//build/config/c++/c++.gni")
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/version.gni")
import("//chrome/process_version_rc_template.gni")  # For branding_file_path.
import("//components/nacl/features.gni")
import("//extensions/buildflags/buildflags.gni")

assert(is_desktop_linux)
assert(current_cpu == "x64")
assert(enable_extensions,
       "Cannot depend on extensions because enable_extensions=false.")

group("linux") {
  # See the "app_shell_lib" definition for why testonly is needed.
  testonly = true
  deps = [
    # TODO(michaelpg): Add beta/stable once we verify the unstable installer is
    # building and installing properly.
    ":app_shell_unstable",
  ]
}

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

action("strip_app_shell_binary") {
  testonly = true
  prog_name = "$root_out_dir/app_shell"
  debug_file = prog_name + ".debug"
  stripped_file = prog_name + ".stripped"
  deps = [
    "//extensions/shell:app_shell",
  ]
  script = "//build/gn_run_binary.py"
  sources = [
    prog_name,
  ]
  outputs = [
    debug_file,
    stripped_file,
  ]
  args = [
    rebase_path("//third_party/eu-strip/bin/eu-strip", root_build_dir),
    "-o",
    rebase_path(stripped_file, root_build_dir),
    "-f",
    rebase_path(debug_file, root_build_dir),
    rebase_path(prog_name, root_build_dir),
  ]
}

copy("common_packaging_files") {
  visibility = [ ":*" ]
  sources = [
    "/usr/bin/eu-strip",
    "common/installer.include",
    "common/wrapper",
  ]

  if (is_chrome_branded) {
    sources += [ "common/google-app-shell/google-app-shell.info" ]
  } else {
    sources += [ "common/chromium-app-shell/chromium-app-shell.info" ]
  }

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

copy("deb_packaging_files") {
  visibility = [ ":*" ]
  sources = [
    "//chrome/installer/linux/debian/changelog.template",
    "//chrome/installer/linux/debian/control.template",
    "debian/build.sh",
  ]
  outputs = [
    "$root_out_dir/app_shell_installer/debian/{{source_file_part}}",
  ]
}

copy("theme_files") {
  visibility = [ ":*" ]
  sources = [
    "$branding_dir/BRANDING",
  ]
  outputs = [
    "$root_out_dir/app_shell_installer/theme/{{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/app_shell_installer/version.txt"
}

# Dependencies for all Linux installer targets.
group("installer_deps") {
  testonly = true

  # 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",
    "//extensions:shell_and_test_pak",
    "//extensions/shell:app_shell",
  ]
  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 (!libcpp_is_static && use_custom_libcxx) {
    public_deps += [ "//buildtools/third_party/libc++:libc++" ]
  }
}

# Creates .deb installer package.
#
# channel:
#   Name of the channel.
template("linux_package") {
  testonly = true
  assert(defined(invoker.channel))
  channel = invoker.channel

  packaging_files_binaries = [
    # TODO(mmoss) Any convenient way to get all the relevant build
    # files? (e.g. all locales, resources, etc.)
    "$root_out_dir/app_shell",
    "$root_out_dir/extensions_shell_and_test.pak",
  ]

  if (enable_nacl) {
    packaging_files_binaries += [
      "$root_out_dir/nacl_helper",
      "$root_out_dir/nacl_helper_bootstrap",
      "$root_out_dir/nacl_irt_x86_64.nexe",
    ]
  }

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

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

    assert(current_cpu == "x64", "app_shell installer only supported for amd64")
    deb_arch = "amd64"
    if (is_chrome_branded) {
      package = "google-app-shell"
    } else {
      package = "chromium-app-shell"
    }

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

    args = [
      rebase_path("$root_out_dir/app_shell_installer/debian/build.sh",
                  root_build_dir),
      "-a",
      current_cpu,
      "-b",
      rebase_path(root_out_dir, root_build_dir),
      "-c",
      invoker.channel,
      "-d",
      branding_path_component,
      "-o",
      rebase_path(root_out_dir, root_build_dir),
      "-s",
      rebase_path(sysroot, root_build_dir),
    ]
    if (is_official_build) {
      args += [ "-f" ]
    }
    deps = [
      ":installer_deps",
      ":strip_app_shell_binary",
    ]
  }

  group(target_name) {
    deps = [
      ":$deb_target_name",
    ]
  }
}

# Standard packages.
# Prefixed with "app_shell_" to not conflict with Chrome's installer targets.
linux_package("app_shell_unstable") {
  channel = "unstable"
}