• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2package {
3    default_applicable_licenses: ["external_capstone_license"],
4}
5
6// Added automatically by a large-scale-change that took the approach of
7// 'apply every license found to every target'. While this makes sure we respect
8// every license restriction, it may not be entirely correct.
9//
10// e.g. GPL in an MIT project might only apply to the contrib/ directory.
11//
12// Please consider splitting the single license below into multiple licenses,
13// taking care not to lose any license_kind information, and overriding the
14// default license using the 'licenses: [...]' property on targets as needed.
15//
16// For unused files, consider creating a 'fileGroup' with "//visibility:private"
17// to attach the license to, and including a comment whether the files may be
18// used in the current project.
19//
20// large-scale-change included anything that looked like it might be a license
21// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
22//
23// Please consider removing redundant or irrelevant files from 'license_text:'.
24// See: http://go/android-license-faq
25license {
26    name: "external_capstone_license",
27    visibility: [":__subpackages__"],
28    license_kinds: [
29        "SPDX-license-identifier-APSL-2.0",
30        "SPDX-license-identifier-BSD",
31        "SPDX-license-identifier-MIT",
32        "SPDX-license-identifier-NCSA",
33    ],
34    license_text: [
35        "LICENSE",
36        "LICENSE.TXT",
37        "LICENSE_LLVM.TXT",
38    ],
39}
40
41arm_flags = ["-DCAPSTONE_HAS_ARM"]
42arm_srcs = [
43    "arch/ARM/ARMDisassembler.c",
44    "arch/ARM/ARMInstPrinter.c",
45    "arch/ARM/ARMMapping.c",
46    "arch/ARM/ARMModule.c",
47]
48
49arm64_flags = ["-DCAPSTONE_HAS_ARM64"]
50arm64_srcs = [
51    "arch/AArch64/AArch64BaseInfo.c",
52    "arch/AArch64/AArch64Disassembler.c",
53    "arch/AArch64/AArch64InstPrinter.c",
54    "arch/AArch64/AArch64Mapping.c",
55    "arch/AArch64/AArch64Module.c",
56]
57
58x86_flags = ["-DCAPSTONE_HAS_X86"]
59x86_srcs = [
60    "arch/X86/X86DisassemblerDecoder.c",
61    "arch/X86/X86Disassembler.c",
62    "arch/X86/X86IntelInstPrinter.c",
63    "arch/X86/X86ATTInstPrinter.c",
64    "arch/X86/X86Mapping.c",
65    "arch/X86/X86Module.c",
66]
67
68cc_defaults {
69    name: "capstone-defaults",
70    srcs: [
71        "cs.c",
72        "utils.c",
73        "SStream.c",
74        "MCInstrDesc.c",
75        "MCRegisterInfo.c",
76        "MCInst.c",
77    ],
78    cflags: [
79        "-Wall",
80        "-Werror",
81        "-Wno-unused-parameter",
82        "-Wno-missing-field-initializers",
83        "-DCAPSTONE_USE_SYS_DYN_MEM",
84    ],
85    export_include_dirs: [".", "include"],
86    clang: true,
87    arch: {
88        arm: {
89            cflags: arm_flags,
90            srcs: arm_srcs,
91        },
92        x86: {
93            cflags: arm_flags + arm64_flags + x86_flags,
94            srcs: arm_srcs + arm64_srcs + x86_srcs,
95        },
96	x86_64: {
97            cflags: arm_flags + arm64_flags + x86_flags,
98            srcs: arm_srcs + arm64_srcs + x86_srcs,
99        },
100        arm64: {
101            cflags: arm_flags + arm64_flags,
102            srcs: arm_srcs + arm64_srcs
103        }
104    }
105}
106
107// For the host and device platform
108// =====================================================
109
110cc_library {
111    name: "libcapstone",
112    host_supported: true,
113    defaults: ["capstone-defaults"],
114}
115