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        "COPYING",
33    ],
34}
35
36common_CFLAGS = [
37    "-D_GNU_SOURCE",
38    "-Wall",
39    "-Werror",
40    "-W",
41    "-Wundef",
42    "-Wshadow",
43    "-Wno-error=missing-noreturn",
44    "-Wmissing-format-attribute",
45]
46
47cc_library {
48    name: "libsepol",
49    host_supported: true,
50    cflags: common_CFLAGS,
51    srcs: [
52        "src/assertion.c",
53        "src/avrule_block.c",
54        "src/avtab.c",
55        "src/boolean_record.c",
56        "src/booleans.c",
57        "src/conditional.c",
58        "src/constraint.c",
59        "src/context.c",
60        "src/context_record.c",
61        "src/debug.c",
62        "src/ebitmap.c",
63        "src/expand.c",
64        "src/handle.c",
65        "src/hashtab.c",
66        "src/hierarchy.c",
67        "src/iface_record.c",
68        "src/interfaces.c",
69        "src/kernel_to_cil.c",
70        "src/kernel_to_common.c",
71        "src/kernel_to_conf.c",
72        "src/link.c",
73        "src/mls.c",
74        "src/module.c",
75        "src/module_to_cil.c",
76        "src/node_record.c",
77        "src/nodes.c",
78        "src/optimize.c",
79        "src/polcaps.c",
80        "src/policydb.c",
81        "src/policydb_convert.c",
82        "src/policydb_public.c",
83        "src/port_record.c",
84        "src/ports.c",
85        "src/roles.c",
86        "src/services.c",
87        "src/sidtab.c",
88        "src/symtab.c",
89        "src/user_record.c",
90        "src/users.c",
91        "src/util.c",
92        "src/write.c",
93        "cil/src/android.c",
94        "cil/src/cil_binary.c",
95        "cil/src/cil_build_ast.c",
96        "cil/src/cil.c",
97        "cil/src/cil_copy_ast.c",
98        "cil/src/cil_find.c",
99        "cil/src/cil_fqn.c",
100        "cil/src/cil_lexer.l",
101        "cil/src/cil_list.c",
102        "cil/src/cil_log.c",
103        "cil/src/cil_mem.c",
104        "cil/src/cil_parser.c",
105        "cil/src/cil_policy.c",
106        "cil/src/cil_post.c",
107        "cil/src/cil_reset_ast.c",
108        "cil/src/cil_resolve_ast.c",
109        "cil/src/cil_stack.c",
110        "cil/src/cil_strpool.c",
111        "cil/src/cil_symtab.c",
112        "cil/src/cil_tree.c",
113        "cil/src/cil_verify.c",
114        "cil/src/cil_write_ast.c",
115    ],
116    local_include_dirs: [
117        "cil/src",
118        "src",
119    ],
120    export_include_dirs: [
121        "cil/include",
122        "include",
123    ],
124    stl: "none",
125    // The host version of libsepol is loaded by the system python, which does
126    // not have the sanitizer runtimes.
127    target: {
128        host: {
129            sanitize: {
130                never: true,
131            },
132        },
133    },
134}
135
136cc_binary_host {
137    name: "chkcon",
138    srcs: ["utils/chkcon.c"],
139    shared_libs: ["libsepol"],
140    cflags: common_CFLAGS,
141}
142