1 common_LIBRARIES = ["libpcre2"] 2 common_CFLAGS = [ 3 "-DUSE_PCRE2", 4 5 // Persistently stored patterns (pcre2) are architecture dependent. 6 // In particular paterns built on amd64 can not run on devices with armv7 7 // (32bit). Therefore, this feature stays off for now. 8 "-DNO_PERSISTENTLY_STORED_PATTERNS", 9 "-DDISABLE_SETRANS", 10 "-DDISABLE_BOOL", 11 "-D_GNU_SOURCE", 12 "-DNO_MEDIA_BACKEND", 13 "-DNO_X_BACKEND", 14 "-DNO_DB_BACKEND" 15 ] 16 17 cc_defaults { 18 name: "libselinux_flags", 19 20 cflags: common_CFLAGS, 21 22 target: { 23 host: { 24 cflags: [ 25 "-DBUILD_HOST", 26 ], 27 }, 28 }, 29 } 30 31 cc_library { 32 name: "libselinux", 33 defaults: ["libselinux_flags"], 34 host_supported: true, 35 36 srcs: [ 37 "src/booleans.c", 38 "src/callbacks.c", 39 "src/freecon.c", 40 "src/label_backends_android.c", 41 "src/label.c", 42 "src/label_file.c", 43 "src/label_support.c", 44 "src/matchpathcon.c", 45 "src/regex.c", 46 "src/setrans_client.c", 47 "src/sha1.c", 48 ], 49 50 target: { 51 linux: { 52 srcs: [ 53 "src/android/android_host.c", 54 "src/avc.c", 55 "src/avc_internal.c", 56 "src/avc_sidtab.c", 57 "src/compute_av.c", 58 "src/compute_create.c", 59 "src/compute_member.c", 60 "src/context.c", 61 "src/enabled.c", 62 "src/getenforce.c", 63 "src/getfilecon.c", 64 "src/get_initial_context.c", 65 "src/init.c", 66 "src/load_policy.c", 67 "src/mapping.c", 68 "src/procattr.c", 69 "src/setexecfilecon.c", 70 "src/stringrep.c", 71 ], 72 }, 73 linux_bionic: { 74 enabled: true, 75 }, 76 android: { 77 srcs: [ 78 "src/android/android.c", 79 "src/avc.c", 80 "src/avc_internal.c", 81 "src/avc_sidtab.c", 82 "src/canonicalize_context.c", 83 "src/checkAccess.c", 84 "src/check_context.c", 85 "src/compute_av.c", 86 "src/compute_create.c", 87 "src/compute_member.c", 88 "src/context.c", 89 "src/deny_unknown.c", 90 "src/disable.c", 91 "src/enabled.c", 92 "src/fgetfilecon.c", 93 "src/fsetfilecon.c", 94 "src/getenforce.c", 95 "src/getfilecon.c", 96 "src/get_initial_context.c", 97 "src/getpeercon.c", 98 "src/init.c", 99 "src/lgetfilecon.c", 100 "src/load_policy.c", 101 "src/lsetfilecon.c", 102 "src/mapping.c", 103 "src/policyvers.c", 104 "src/procattr.c", 105 "src/sestatus.c", 106 "src/setenforce.c", 107 "src/setfilecon.c", 108 "src/stringrep.c", 109 ], 110 111 shared_libs: [ 112 "libcrypto", 113 "liblog", 114 ], 115 static: { 116 whole_static_libs: ["libpackagelistparser"], 117 }, 118 shared: { 119 shared_libs: ["libpackagelistparser"], 120 }, 121 122 local_include_dirs: [ "src" ], 123 124 version_script: "exported.map", 125 126 // 1003 corresponds to auditd, from system/core/logd/event.logtags 127 cflags: [ 128 "-DAUDITD_LOG_TAG=1003", 129 ], 130 // mapping.c has redundant check of array p_in->perms. 131 clang_cflags: ["-Wno-pointer-bool-conversion"], 132 }, 133 }, 134 135 static: { 136 whole_static_libs: common_LIBRARIES, 137 }, 138 shared: { 139 shared_libs: common_LIBRARIES, 140 }, 141 142 local_include_dirs: ["include"], 143 export_include_dirs: ["include"], 144 } 145 146 // If one attempts to comment out the sefcontext_compile target in the 147 // Android.mk that exists in the directory of this Android.bp file, understand 148 // that I encountered 2 issues. The first issue was that it could not find 149 // sepol/sepol.h. This is usually an issue if a dependency between the 150 // export_includes of another component is not coupled to this component 151 // properly. Looking at the Makefile from upstream, sefcontext_compile seems 152 // to have a dependency on libsepol. The second issue occurs when you add the 153 // libsepol dependency. The build system claims that their is no libsepol 154 // library declared anywhere. Switching sefcontext_compile to an Android.mk for 155 // now resolved the issue. 156 //################################ 157 //cc_binary_host { 158 // name: "sefcontext_compile", 159 // defaults: ["libselinux_flags"], 160 // srcs: ["utils/sefcontext_compile.c"], 161 // 162 // static_libs: ["libselinux"], 163 // whole_static_libs: common_LIBRARIES, 164 //} 165