| common_LIBRARIES = ["libpcre2"] | |
| common_CFLAGS = [ | |
| "-DUSE_PCRE2", | |
| // Persistently stored patterns (pcre2) are architecture dependent. | |
| // In particular paterns built on amd64 can not run on devices with armv7 | |
| // (32bit). Therefore, this feature stays off for now. | |
| "-DNO_PERSISTENTLY_STORED_PATTERNS", | |
| ] | |
| // uncomment to build libselinux and related artifacts against PCRE | |
| // common_LIBRARIES = ["libpcre"] | |
| // common_CFLAGS = [] | |
| cc_defaults { | |
| name: "libselinux_flags", | |
| cflags: common_CFLAGS, | |
| target: { | |
| host: { | |
| cflags: ["-DHOST"], | |
| }, | |
| darwin: { | |
| cflags: ["-DDARWIN"], | |
| }, | |
| }, | |
| } | |
| cc_library { | |
| name: "libselinux", | |
| defaults: ["libselinux_flags"], | |
| host_supported: true, | |
| srcs: [ | |
| "src/callbacks.c", | |
| "src/check_context.c", | |
| "src/freecon.c", | |
| "src/init.c", | |
| "src/label.c", | |
| "src/label_file.c", | |
| "src/label_android_property.c", | |
| "src/regex.c", | |
| "src/label_support.c", | |
| ], | |
| target: { | |
| android: { | |
| srcs: [ | |
| "src/booleans.c", | |
| "src/canonicalize_context.c", | |
| "src/disable.c", | |
| "src/enabled.c", | |
| "src/fgetfilecon.c", | |
| "src/fsetfilecon.c", | |
| "src/getenforce.c", | |
| "src/getfilecon.c", | |
| "src/getpeercon.c", | |
| "src/lgetfilecon.c", | |
| "src/load_policy.c", | |
| "src/lsetfilecon.c", | |
| "src/policyvers.c", | |
| "src/procattr.c", | |
| "src/setenforce.c", | |
| "src/setfilecon.c", | |
| "src/context.c", | |
| "src/mapping.c", | |
| "src/stringrep.c", | |
| "src/compute_create.c", | |
| "src/compute_av.c", | |
| "src/avc.c", | |
| "src/avc_internal.c", | |
| "src/avc_sidtab.c", | |
| "src/get_initial_context.c", | |
| "src/checkAccess.c", | |
| "src/sestatus.c", | |
| "src/deny_unknown.c", | |
| "src/android.c", | |
| ], | |
| shared_libs: [ | |
| "libcrypto", | |
| "liblog", | |
| ], | |
| static: { | |
| whole_static_libs: ["libpackagelistparser"], | |
| }, | |
| shared: { | |
| shared_libs: ["libpackagelistparser"], | |
| }, | |
| // 1003 corresponds to auditd, from system/core/logd/event.logtags | |
| cflags: ["-DAUDITD_LOG_TAG=1003"], | |
| // mapping.c has redundant check of array p_in->perms. | |
| clang_cflags: ["-Wno-pointer-bool-conversion"], | |
| }, | |
| }, | |
| static: { | |
| whole_static_libs: common_LIBRARIES, | |
| }, | |
| shared: { | |
| shared_libs: common_LIBRARIES, | |
| }, | |
| local_include_dirs: ["include"], | |
| export_include_dirs: ["include"], | |
| } | |
| //################################ | |
| cc_binary_host { | |
| name: "sefcontext_compile", | |
| defaults: ["libselinux_flags"], | |
| srcs: ["utils/sefcontext_compile.c"], | |
| static_libs: ["libselinux"], | |
| whole_static_libs: common_LIBRARIES, | |
| } |