xref: /aosp_15_r20/external/cronet/build/config/fuchsia/gn_configs.gni (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1*6777b538SAndroid Build Coastguard Worker# Copyright 2023 The Chromium Authors
2*6777b538SAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license that can be
3*6777b538SAndroid Build Coastguard Worker# found in the LICENSE file.
4*6777b538SAndroid Build Coastguard Worker
5*6777b538SAndroid Build Coastguard Workerassert(is_fuchsia)
6*6777b538SAndroid Build Coastguard Worker
7*6777b538SAndroid Build Coastguard Workerdeclare_args() {
8*6777b538SAndroid Build Coastguard Worker  # The target API level for this repository. Embedders should override this
9*6777b538SAndroid Build Coastguard Worker  # value to specify the API level the packages produced from this repository
10*6777b538SAndroid Build Coastguard Worker  # should be targeting, e.g. in their top-level //.gn file. A value of -1
11*6777b538SAndroid Build Coastguard Worker  # means that no API level will be passed to the tools that consumes it.
12*6777b538SAndroid Build Coastguard Worker  fuchsia_target_api_level = 16
13*6777b538SAndroid Build Coastguard Worker
14*6777b538SAndroid Build Coastguard Worker  # Path to the fuchsia SDK. This is intended for use in other templates &
15*6777b538SAndroid Build Coastguard Worker  # rules to reference the contents of the fuchsia SDK.
16*6777b538SAndroid Build Coastguard Worker  fuchsia_sdk = "//third_party/fuchsia-sdk/sdk"
17*6777b538SAndroid Build Coastguard Worker
18*6777b538SAndroid Build Coastguard Worker  # ID uniquely identifying the Fuchsia IDK build. This is exposed as a
19*6777b538SAndroid Build Coastguard Worker  # property so it can be used to locate images and packages on GCS and
20*6777b538SAndroid Build Coastguard Worker  # as a marker to indicate the "version" of the IDK.
21*6777b538SAndroid Build Coastguard Worker  # Defaults to the id found in the manifest.json file of the SDK.
22*6777b538SAndroid Build Coastguard Worker  fuchsia_sdk_id = ""
23*6777b538SAndroid Build Coastguard Worker}
24*6777b538SAndroid Build Coastguard Worker
25*6777b538SAndroid Build Coastguard Worker# The SDK manifest file. This is useful to include as a dependency
26*6777b538SAndroid Build Coastguard Worker# for some targets in order to cause a rebuild when the version of the
27*6777b538SAndroid Build Coastguard Worker# SDK is changed.
28*6777b538SAndroid Build Coastguard Workerfuchsia_sdk_manifest_file = "${fuchsia_sdk}/meta/manifest.json"
29*6777b538SAndroid Build Coastguard Worker
30*6777b538SAndroid Build Coastguard Worker# fuchsia_tool_dir is used to specify the directory in the SDK to locate
31*6777b538SAndroid Build Coastguard Worker# tools for the host cpu architecture. If the host_cpu is not recognized,
32*6777b538SAndroid Build Coastguard Worker# then tool dir defaults to x64.
33*6777b538SAndroid Build Coastguard Workerfuchsia_tool_dir = "${fuchsia_sdk}/tools/${host_cpu}"
34*6777b538SAndroid Build Coastguard Worker
35*6777b538SAndroid Build Coastguard Workerif (fuchsia_sdk_id == "") {
36*6777b538SAndroid Build Coastguard Worker  # Note: If we need to expose more than just the id in the future,
37*6777b538SAndroid Build Coastguard Worker  # we should consider exposing the entire json object for the metadata vs.
38*6777b538SAndroid Build Coastguard Worker  # adding a bunch of variables.
39*6777b538SAndroid Build Coastguard Worker  _meta = read_file(fuchsia_sdk_manifest_file, "json")
40*6777b538SAndroid Build Coastguard Worker  fuchsia_sdk_id = _meta.id
41*6777b538SAndroid Build Coastguard Worker}
42*6777b538SAndroid Build Coastguard Worker
43*6777b538SAndroid Build Coastguard Workerdeclare_args() {
44*6777b538SAndroid Build Coastguard Worker  # Specify a readelf_exec path to use. If not specified, the host's system
45*6777b538SAndroid Build Coastguard Worker  # executable will be used. Passed to populate_build_id_dir.py and
46*6777b538SAndroid Build Coastguard Worker  # prepare_package_inputs.py via the --readelf-exec flag.
47*6777b538SAndroid Build Coastguard Worker  # Must be a GN path (not an absolute path) since it is adjusted with
48*6777b538SAndroid Build Coastguard Worker  # rebase_path().
49*6777b538SAndroid Build Coastguard Worker  if (!defined(fuchsia_sdk_readelf_exec)) {
50*6777b538SAndroid Build Coastguard Worker    fuchsia_sdk_readelf_exec = ""
51*6777b538SAndroid Build Coastguard Worker  }
52*6777b538SAndroid Build Coastguard Worker}
53*6777b538SAndroid Build Coastguard Worker
54*6777b538SAndroid Build Coastguard Worker# Copy from third_party/fuchsia-gn-sdk/src/gn_configs.gni to avoid importing
55*6777b538SAndroid Build Coastguard Worker# files from //third_party/ in //build/.
56*6777b538SAndroid Build Coastguard Worker# Note, `current_cpu` should always exist in the //build/ tree, so the
57*6777b538SAndroid Build Coastguard Worker# `target_cpu` fallback has been removed.
58*6777b538SAndroid Build Coastguard Workerfuchsia_arch_root =
59*6777b538SAndroid Build Coastguard Worker    "${fuchsia_sdk}/obj/${target_cpu}-api-${fuchsia_target_api_level}"
60