• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2023 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5assert(is_fuchsia)
6
7# TODO(crbug.com/359657446): Remove the duplicate arguments in favor of
8# using the ones in third_party/fuchsia-gn-sdk/. Some of them are needed
9# by repos like webrtc which may not update to use the
10# third_party/fuchsia-gn-sdk/src/gn_configs.gni.
11declare_args() {
12  # Path to the fuchsia SDK. This is intended for use in other templates &
13  # rules to reference the contents of the fuchsia SDK.
14  fuchsia_sdk = "//third_party/fuchsia-sdk/sdk"
15
16  # ID uniquely identifying the Fuchsia IDK build. This is exposed as a
17  # property so it can be used to locate images and packages on GCS and
18  # as a marker to indicate the "version" of the IDK.
19  # Defaults to the id found in the manifest.json file of the SDK.
20  fuchsia_sdk_id = ""
21}
22
23# The SDK manifest file. This is useful to include as a dependency
24# for some targets in order to cause a rebuild when the version of the
25# SDK is changed.
26fuchsia_sdk_manifest_file = "${fuchsia_sdk}/meta/manifest.json"
27
28# fuchsia_tool_dir is used to specify the directory in the SDK to locate
29# tools for the host cpu architecture. If the host_cpu is not recognized,
30# then tool dir defaults to x64.
31fuchsia_tool_dir = "${fuchsia_sdk}/tools/${host_cpu}"
32
33if (fuchsia_sdk_id == "") {
34  # Note: If we need to expose more than just the id in the future,
35  # we should consider exposing the entire json object for the metadata vs.
36  # adding a bunch of variables.
37  _meta = read_file(fuchsia_sdk_manifest_file, "json")
38  fuchsia_sdk_id = _meta.id
39}
40
41declare_args() {
42  # Specify a readelf_exec path to use. If not specified, the host's system
43  # executable will be used. Passed to populate_build_id_dir.py and
44  # prepare_package_inputs.py via the --readelf-exec flag.
45  # Must be a GN path (not an absolute path) since it is adjusted with
46  # rebase_path().
47  if (!defined(fuchsia_sdk_readelf_exec)) {
48    fuchsia_sdk_readelf_exec = ""
49  }
50}
51
52# Copy from third_party/fuchsia-gn-sdk/src/gn_configs.gni to avoid importing
53# files from //third_party/ in //build/.
54# Note, `current_cpu` should always exist in the //build/ tree, so the
55# `target_cpu` fallback has been removed.
56fuchsia_target_api_level = 26
57fuchsia_arch_root =
58    "${fuchsia_sdk}/obj/${target_cpu}-api-${fuchsia_target_api_level}"
59
60# Write Fuchsia arch root paths to gn_logs.txt, so that Siso can reference
61# these GN variables.
62_fuchsia_arch_root = rebase_path(fuchsia_arch_root, "//")
63
64# The legacy directory is still used. But, will be removed soon.
65_fuchsia_legacy_arch_root =
66    rebase_path("${fuchsia_sdk}/arch/${target_cpu}", "//")
67
68fuchsia_gn_logs = [
69  "fuchsia_arch_root=${_fuchsia_arch_root}",
70  "fuchsia_legacy_arch_root=${_fuchsia_legacy_arch_root}",
71]
72