blob: 32f8ec47d9a87873c0b51c1ec90bde5c02942ba0 [file] [log] [blame]
# Copyright 2019 The Fuchsia 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/fuchsia/zircon.gni")
# The `gn gen` stage of the Zircon GN build writes this file.
# It's a list of {name=... path=... type=...} scopes.
zircon_images = read_file("$zircon_root_build_dir/legacy_images.json", "json")
foreach(image, zircon_images) {
if (image.name == "kernel" && image.type == "zbi" &&
image.cpu == target_cpu) {
zircon_kernel_zbi = "$zircon_root_build_dir/${image.path}"
}
}
# Produce a manifest of binaries from the Zircon build.
#
# This is meant to be used with a package() target that does:
# deps = [ this_target ]
# extras = get_target_outputs(this_target)
#
# Parameters
#
# manifest
# - Required: Which Zircon manifest to draw from.
# - Type: "image" or "tests"
#
# patterns
# - Required: List of filename patterns to match in the manifest.
# These are shell filename patterns that match the whole target path
# with no leading slash: "bin/foo" or "bin/*" or "*" all match "bin/foo".
# - Type: list(string)
#
template("zircon_extras_manifest") {
action(target_name) {
forward_variables_from(invoker,
[
"visibility",
"testonly",
])
foreach(image, zircon_images) {
if (image.type == "manifest" &&
image.name == "legacy-${invoker.manifest}-$target_cpu") {
sources = [
"$zircon_root_build_dir/${image.path}",
]
}
}
outputs = [
"$target_gen_dir/$target_name.manifest",
]
script = "//build/images/manifest.py"
args = [ "--output=" + rebase_path(outputs[0], root_build_dir) ]
foreach(pattern, invoker.patterns) {
args += [ "--include=$pattern" ]
}
foreach(manifest, sources) {
args += [
"--cwd=" + rebase_path(get_path_info(manifest, "dir"), root_build_dir),
"--manifest=" + rebase_path(manifest, root_build_dir),
]
}
}
}