xref: /aosp_15_r20/external/selinux/libsepol/Android.bp (revision 2d543d20722ada2425b5bdab9d0d1d29470e7bba)
1package {
2    default_applicable_licenses: ["external_selinux_libsepol_license"],
3}
4
5// Added automatically by a large-scale-change that took the approach of
6// 'apply every license found to every target'. While this makes sure we respect
7// every license restriction, it may not be entirely correct.
8//
9// e.g. GPL in an MIT project might only apply to the contrib/ directory.
10//
11// Please consider splitting the single license below into multiple licenses,
12// taking care not to lose any license_kind information, and overriding the
13// default license using the 'licenses: [...]' property on targets as needed.
14//
15// For unused files, consider creating a 'filegroup' with "//visibility:private"
16// to attach the license to, and including a comment whether the files may be
17// used in the current project.
18// http://go/android-license-faq
19license {
20    name: "external_selinux_libsepol_license",
21    visibility: [":__subpackages__"],
22    license_kinds: [
23        "SPDX-license-identifier-BSD",
24        "SPDX-license-identifier-GPL",
25        "SPDX-license-identifier-LGPL",
26        "SPDX-license-identifier-LGPL-2.1",
27        "SPDX-license-identifier-LGPL-3.0",
28        "SPDX-license-identifier-Zlib",
29        "legacy_unencumbered",
30    ],
31    license_text: [
32        "LICENSE",
33    ],
34}
35
36cc_defaults {
37    name: "libsepol_defaults",
38    cflags: [
39      "-D_GNU_SOURCE",
40      "-Wall",
41      "-Werror",
42      "-W",
43      "-Wundef",
44      "-Wshadow",
45      "-Wno-error=missing-noreturn",
46      "-Wmissing-format-attribute",
47    ],
48    target: {
49        bionic: {
50            cflags: ["-DHAVE_REALLOCARRAY"]
51        },
52        musl: {
53            cflags: ["-DHAVE_REALLOCARRAY"]
54        }
55    }
56}
57
58cc_library {
59    name: "libsepol",
60    defaults: ["libsepol_defaults"],
61    host_supported: true,
62    srcs: [
63        "src/assertion.c",
64        "src/avrule_block.c",
65        "src/avtab.c",
66        "src/boolean_record.c",
67        "src/booleans.c",
68        "src/conditional.c",
69        "src/constraint.c",
70        "src/context.c",
71        "src/context_record.c",
72        "src/debug.c",
73        "src/ebitmap.c",
74        "src/expand.c",
75        "src/handle.c",
76        "src/hashtab.c",
77        "src/hierarchy.c",
78        "src/iface_record.c",
79        "src/interfaces.c",
80        "src/kernel_to_cil.c",
81        "src/kernel_to_common.c",
82        "src/kernel_to_conf.c",
83        "src/link.c",
84        "src/mls.c",
85        "src/module.c",
86        "src/module_to_cil.c",
87        "src/node_record.c",
88        "src/nodes.c",
89        "src/optimize.c",
90        "src/polcaps.c",
91        "src/policydb.c",
92        "src/policydb_convert.c",
93        "src/policydb_public.c",
94        "src/policydb_validate.c",
95        "src/port_record.c",
96        "src/ports.c",
97        "src/services.c",
98        "src/sidtab.c",
99        "src/symtab.c",
100        "src/user_record.c",
101        "src/users.c",
102        "src/util.c",
103        "src/write.c",
104        "cil/src/android.c",
105        "cil/src/cil_binary.c",
106        "cil/src/cil_build_ast.c",
107        "cil/src/cil.c",
108        "cil/src/cil_copy_ast.c",
109        "cil/src/cil_deny.c",
110        "cil/src/cil_find.c",
111        "cil/src/cil_fqn.c",
112        "cil/src/cil_lexer.l",
113        "cil/src/cil_list.c",
114        "cil/src/cil_log.c",
115        "cil/src/cil_mem.c",
116        "cil/src/cil_parser.c",
117        "cil/src/cil_policy.c",
118        "cil/src/cil_post.c",
119        "cil/src/cil_reset_ast.c",
120        "cil/src/cil_resolve_ast.c",
121        "cil/src/cil_stack.c",
122        "cil/src/cil_strpool.c",
123        "cil/src/cil_symtab.c",
124        "cil/src/cil_tree.c",
125        "cil/src/cil_verify.c",
126        "cil/src/cil_write_ast.c",
127    ],
128    local_include_dirs: [
129        "cil/src",
130        "src",
131    ],
132    export_include_dirs: [
133        "cil/include",
134        "include",
135    ],
136    stl: "none",
137    // The host version of libsepol is loaded by the system python, which does
138    // not have the sanitizer runtimes.
139    target: {
140        host: {
141            sanitize: {
142                never: true,
143            },
144        },
145    },
146}
147
148cc_binary_host {
149    name: "chkcon",
150    defaults: ["libsepol_defaults"],
151    srcs: ["utils/chkcon.c"],
152    shared_libs: ["libsepol"],
153}
154