xref: /aosp_15_r20/external/angle/build/config/android/extract_unwind_tables.gni (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1# Copyright 2018 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
5import("//build/config/android/rules.gni")
6
7unwind_table_asset_v1_filename = "unwind_cfi_32"
8
9_dump_syms_target =
10    "//third_party/breakpad:dump_syms($host_system_allocator_toolchain)"
11_dump_syms = get_label_info(_dump_syms_target, "root_out_dir") + "/dump_syms"
12
13template("unwind_table_v1") {
14  action(target_name) {
15    forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
16    _output_path =
17        "$target_out_dir/$target_name/$unwind_table_asset_v1_filename"
18
19    # Strip the "lib" prefix, if present. Add and then remove a space because
20    # our ownly tool is "replace all".
21    _library_name = get_label_info(invoker.library_target, "name")
22    _library_name =
23        string_replace(string_replace(" $_library_name", " $shlib_prefix", ""),
24                       " ",
25                       "")
26    _library_path = "$root_out_dir/lib.unstripped/$shlib_prefix$_library_name$shlib_extension"
27
28    script = "//build/android/gyp/extract_unwind_tables.py"
29    outputs = [ _output_path ]
30    inputs = [
31      _dump_syms,
32      _library_path,
33    ]
34    deps = [
35      _dump_syms_target,
36      invoker.library_target,
37    ]
38
39    args = [
40      "--input_path",
41      rebase_path(_library_path, root_build_dir),
42      "--output_path",
43      rebase_path(_output_path, root_build_dir),
44      "--dump_syms_path",
45      rebase_path(_dump_syms, root_build_dir),
46    ]
47  }
48}
49