1common_CFLAGS = [ 2 // Persistently stored patterns (pcre2) are architecture dependent. 3 // In particular paterns built on amd64 can not run on devices with armv7 4 // (32bit). Therefore, this feature stays off for now. 5 "-DNO_PERSISTENTLY_STORED_PATTERNS", 6 "-DDISABLE_SETRANS", 7 "-DDISABLE_BOOL", 8 "-D_GNU_SOURCE", 9 "-DNO_MEDIA_BACKEND", 10 "-DNO_X_BACKEND", 11 "-DNO_DB_BACKEND", 12 "-Wall", 13 "-Werror", 14 "-Wno-error=missing-noreturn", 15 "-Wno-error=unused-function", 16 "-Wno-error=unused-variable", 17] 18 19cc_defaults { 20 name: "libselinux_defaults", 21 22 cflags: common_CFLAGS, 23 24 srcs: [ 25 "src/booleans.c", 26 "src/callbacks.c", 27 "src/freecon.c", 28 "src/label_backends_android.c", 29 "src/label.c", 30 "src/label_support.c", 31 "src/matchpathcon.c", 32 "src/setrans_client.c", 33 "src/sha1.c", 34 ], 35 36 target: { 37 host: { 38 cflags: [ 39 "-DBUILD_HOST", 40 ], 41 }, 42 43 android: { 44 srcs: [ 45 "src/android/android.c", 46 "src/avc.c", 47 "src/avc_internal.c", 48 "src/avc_sidtab.c", 49 "src/canonicalize_context.c", 50 "src/checkAccess.c", 51 "src/check_context.c", 52 "src/compute_av.c", 53 "src/compute_create.c", 54 "src/compute_member.c", 55 "src/context.c", 56 "src/deny_unknown.c", 57 "src/disable.c", 58 "src/enabled.c", 59 "src/fgetfilecon.c", 60 "src/fsetfilecon.c", 61 "src/getenforce.c", 62 "src/getfilecon.c", 63 "src/get_initial_context.c", 64 "src/getpeercon.c", 65 "src/init.c", 66 "src/lgetfilecon.c", 67 "src/load_policy.c", 68 "src/lsetfilecon.c", 69 "src/mapping.c", 70 "src/policyvers.c", 71 "src/procattr.c", 72 "src/reject_unknown.c", 73 "src/sestatus.c", 74 "src/setenforce.c", 75 "src/setfilecon.c", 76 "src/stringrep.c", 77 ], 78 79 shared_libs: [ 80 "libcrypto", 81 "liblog", 82 ], 83 84 local_include_dirs: [ "src" ], 85 86 // 1003 corresponds to auditd, from system/core/logd/event.logtags 87 cflags: [ 88 "-DAUDITD_LOG_TAG=1003", 89 ], 90 } 91 }, 92 93 local_include_dirs: ["include"], 94 export_include_dirs: ["include"], 95} 96 97cc_library { 98 name: "libselinux", 99 defaults: ["libselinux_defaults"], 100 101 vendor_available: true, 102 vndk: { 103 enabled: true, 104 }, 105 double_loadable: true, 106 recovery_available: true, 107 108 host_supported: true, 109 cflags: ["-DUSE_PCRE2"], 110 111 srcs: [ 112 "src/label_file.c", 113 "src/regex.c", 114 ], 115 116 target: { 117 linux_glibc: { 118 srcs: [ 119 "src/android/android_host.c", 120 "src/avc.c", 121 "src/avc_internal.c", 122 "src/avc_sidtab.c", 123 "src/compute_av.c", 124 "src/compute_create.c", 125 "src/compute_member.c", 126 "src/context.c", 127 "src/deny_unknown.c", 128 "src/enabled.c", 129 "src/fgetfilecon.c", 130 "src/getenforce.c", 131 "src/getfilecon.c", 132 "src/get_initial_context.c", 133 "src/init.c", 134 "src/lgetfilecon.c", 135 "src/load_policy.c", 136 "src/lsetfilecon.c", 137 "src/mapping.c", 138 "src/procattr.c", 139 "src/reject_unknown.c", 140 "src/setenforce.c", 141 "src/setexecfilecon.c", 142 "src/setfilecon.c", 143 "src/stringrep.c", 144 ], 145 }, 146 linux_bionic: { 147 enabled: true, 148 srcs: [ 149 "src/android/android_host.c", 150 "src/avc.c", 151 "src/avc_internal.c", 152 "src/avc_sidtab.c", 153 "src/compute_av.c", 154 "src/compute_create.c", 155 "src/compute_member.c", 156 "src/context.c", 157 "src/deny_unknown.c", 158 "src/enabled.c", 159 "src/getenforce.c", 160 "src/getfilecon.c", 161 "src/get_initial_context.c", 162 "src/init.c", 163 "src/load_policy.c", 164 "src/mapping.c", 165 "src/procattr.c", 166 "src/reject_unknown.c", 167 "src/setexecfilecon.c", 168 "src/stringrep.c", 169 ], 170 }, 171 172 android: { 173 srcs: [ 174 "src/android/android_platform.c", 175 ], 176 177 static: { 178 whole_static_libs: ["libpackagelistparser"], 179 }, 180 181 shared: { 182 shared_libs: ["libpackagelistparser"], 183 }, 184 185 version_script: "exported.map", 186 }, 187 188 vendor: { 189 exclude_srcs: [ 190 "src/android/android_platform.c", 191 ], 192 srcs: [ 193 "src/android/android_vendor.c", 194 ], 195 cflags: ["-DNO_FILE_BACKEND"], 196 exclude_shared_libs: ["libpackagelistparser"], 197 exclude_static_libs: ["libpackagelistparser"], 198 version_script: "exported_vendor.map", 199 }, 200 }, 201 202 static: { 203 whole_static_libs: ["libpcre2"], 204 }, 205 shared: { 206 shared_libs: ["libpcre2"], 207 }, 208} 209 210cc_binary_host { 211 name: "sefcontext_compile", 212 defaults: ["libselinux_defaults"], 213 cflags: ["-DUSE_PCRE2"], 214 srcs: ["utils/sefcontext_compile.c"], 215 216 static_libs: [ 217 "libselinux", 218 "libsepol", 219 ], 220 whole_static_libs: ["libpcre2"], 221} 222