refactor: move common parts of libselinux builds into defaults

Bug: 37343404
Bug: 37919668
Test: Build and boot

(cherry-picked from commit 51428ba055)

Change-Id: If42d24d381839c2a39f8cff3fc82ce5d3073eeb7
Merged-In: I375a4a2926326a5f733f4a49348e1ffae086ffd6
This commit is contained in:
Sandeep Patil 2017-05-03 07:04:18 -07:00 committed by Vijay Venkatraman
parent 1c8c58625d
commit f5addf2232
2 changed files with 35 additions and 97 deletions

View file

@ -1,4 +1,3 @@
common_LIBRARIES = ["libpcre2"]
common_CFLAGS = [
"-DUSE_PCRE2",
@ -15,24 +14,10 @@ common_CFLAGS = [
]
cc_defaults {
name: "libselinux_flags",
name: "libselinux_defaults",
cflags: common_CFLAGS,
target: {
host: {
cflags: [
"-DBUILD_HOST",
],
},
},
}
cc_library {
name: "libselinux_vendor",
defaults: ["libselinux_flags"],
vendor: true,
srcs: [
"src/booleans.c",
"src/callbacks.c",
@ -48,6 +33,12 @@ cc_library {
],
target: {
host: {
cflags: [
"-DBUILD_HOST",
],
},
android: {
srcs: [
"src/android/android.c",
@ -90,45 +81,44 @@ cc_library {
local_include_dirs: [ "src" ],
version_script: "exported_vendor.map",
// 1003 corresponds to auditd, from system/core/logd/event.logtags
cflags: [
"-DAUDITD_LOG_TAG=1003",
],
},
},
static: {
whole_static_libs: common_LIBRARIES,
},
shared: {
shared_libs: common_LIBRARIES,
// mapping.c has redundant check of array p_in->perms.
clang_cflags: ["-Wno-pointer-bool-conversion"],
}
},
local_include_dirs: ["include"],
export_include_dirs: ["include"],
static: {
whole_static_libs: ["libpcre2"],
},
shared: {
shared_libs: ["libpcre2"],
},
}
cc_library {
name: "libselinux_vendor",
defaults: ["libselinux_defaults"],
vendor: true,
target: {
android: {
version_script: "exported_vendor.map",
},
},
}
cc_library {
name: "libselinux",
defaults: ["libselinux_flags"],
defaults: ["libselinux_defaults"],
host_supported: true,
srcs: [
"src/booleans.c",
"src/callbacks.c",
"src/freecon.c",
"src/label_backends_android.c",
"src/label.c",
"src/label_file.c",
"src/label_support.c",
"src/matchpathcon.c",
"src/regex.c",
"src/setrans_client.c",
"src/sha1.c",
],
target: {
linux: {
srcs: [
@ -174,82 +164,30 @@ cc_library {
"src/setexecfilecon.c",
"src/stringrep.c",
],
},
android: {
srcs: [
"src/android/android.c",
"src/android/android_seapp.c",
"src/avc.c",
"src/avc_internal.c",
"src/avc_sidtab.c",
"src/canonicalize_context.c",
"src/checkAccess.c",
"src/check_context.c",
"src/compute_av.c",
"src/compute_create.c",
"src/compute_member.c",
"src/context.c",
"src/deny_unknown.c",
"src/disable.c",
"src/enabled.c",
"src/fgetfilecon.c",
"src/fsetfilecon.c",
"src/getenforce.c",
"src/getfilecon.c",
"src/get_initial_context.c",
"src/getpeercon.c",
"src/init.c",
"src/lgetfilecon.c",
"src/load_policy.c",
"src/lsetfilecon.c",
"src/mapping.c",
"src/policyvers.c",
"src/procattr.c",
"src/sestatus.c",
"src/setenforce.c",
"src/setfilecon.c",
"src/stringrep.c",
"src/android/android_platform.c",
],
shared_libs: [
"libcrypto",
"liblog",
],
static: {
whole_static_libs: ["libpackagelistparser"],
},
shared: {
shared_libs: ["libpackagelistparser"],
},
local_include_dirs: ["src"],
version_script: "exported.map",
// 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"],
defaults: ["libselinux_defaults"],
cflags: ["-DUSE_PCRE2"],
srcs: ["utils/sefcontext_compile.c"],
static_libs: [