Revert "Refactor sources in Android.bp"

Revert submission 2110147

Reason for revert: Broken sdk_mac target.
Reverted Changes:
Ifcd00954b:Refactor sources in Android.bp
Ie313b6d63:Add unit tests for service contexts backend

Change-Id: Id3d9c69c508b4774e667a600346b03a7c09e3a96
This commit is contained in:
Thiébaud Weksteen 2022-06-16 23:46:53 +00:00
parent 94ad1bb10e
commit 46c4d4521e
3 changed files with 116 additions and 79 deletions

View file

@ -45,9 +45,6 @@ common_CFLAGS = [
"-Wno-error=missing-noreturn",
"-Wno-error=unused-function",
"-Wno-error=unused-variable",
"-DUSE_PCRE2",
// 1003 corresponds to auditd, from system/core/logd/event.logtags
"-DAUDITD_LOG_TAG=1003",
]
cc_defaults {
@ -56,49 +53,15 @@ cc_defaults {
cflags: common_CFLAGS,
srcs: [
"src/android/android.c",
"src/avc.c",
"src/avc_internal.c",
"src/avc_sidtab.c",
"src/booleans.c",
"src/callbacks.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/freecon.c",
"src/fsetfilecon.c",
"src/get_initial_context.c",
"src/getenforce.c",
"src/getfilecon.c",
"src/getpeercon.c",
"src/init.c",
"src/label.c",
"src/label_backends_android.c",
"src/label_file.c",
"src/label.c",
"src/label_support.c",
"src/lgetfilecon.c",
"src/load_policy.c",
"src/lsetfilecon.c",
"src/mapping.c",
"src/matchpathcon.c",
"src/policyvers.c",
"src/procattr.c",
"src/regex.c",
"src/reject_unknown.c",
"src/sestatus.c",
"src/setenforce.c",
"src/setfilecon.c",
"src/setrans_client.c",
"src/sha1.c",
"src/stringrep.c",
],
target: {
@ -107,49 +70,60 @@ cc_defaults {
"-DBUILD_HOST",
],
},
android: {
srcs: [
"src/android/android_platform.c",
"src/android/android.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/reject_unknown.c",
"src/sestatus.c",
"src/setenforce.c",
"src/setfilecon.c",
"src/stringrep.c",
],
static: {
whole_static_libs: [
"libpackagelistparser",
],
},
shared: {
shared_libs: [
"libpackagelistparser",
],
},
shared_libs: [
"liblog",
],
system_shared_libs: ["libc"],
},
header_libs: ["libcutils_headers"],
local_include_dirs: [ "src" ],
// 1003 corresponds to auditd, from system/core/logd/event.logtags
cflags: [
"-DAUDITD_LOG_TAG=1003",
],
}
},
shared_libs: [
"liblog",
],
static: {
whole_static_libs: [
"libpcre2",
],
},
shared: {
shared_libs: [
"libpcre2",
],
},
header_libs: [
"libbase_headers",
"libcutils_headers",
"liblog_headers",
],
local_include_dirs: [
"include",
"src",
],
local_include_dirs: ["include"],
export_include_dirs: ["include"],
stl: "none",
@ -166,18 +140,76 @@ cc_library {
ramdisk_available: true,
vendor_ramdisk_available: true,
recovery_available: true,
host_supported: true,
cflags: ["-DUSE_PCRE2"],
srcs: [
"src/label_file.c",
"src/regex.c",
],
target: {
host_linux: {
srcs: [
"src/avc.c",
"src/avc_internal.c",
"src/avc_sidtab.c",
"src/compute_av.c",
"src/compute_create.c",
"src/compute_member.c",
"src/context.c",
"src/deny_unknown.c",
"src/enabled.c",
"src/getenforce.c",
"src/getfilecon.c",
"src/get_initial_context.c",
"src/init.c",
"src/load_policy.c",
"src/mapping.c",
"src/procattr.c",
"src/reject_unknown.c",
"src/sestatus.c",
"src/setexecfilecon.c",
"src/stringrep.c",
],
},
linux_glibc: {
srcs: [
"src/fgetfilecon.c",
"src/lgetfilecon.c",
"src/lsetfilecon.c",
"src/setfilecon.c",
],
},
linux_bionic: {
enabled: true,
},
android: {
srcs: [
"src/android/android_platform.c",
],
static: {
whole_static_libs: ["libpackagelistparser"],
},
shared: {
shared_libs: ["libpackagelistparser"],
},
version_script: "exported.map.txt",
},
},
static: {
whole_static_libs: ["libpcre2"],
},
shared: {
shared_libs: ["libpcre2"],
},
stubs: {
symbol_file: "exported.map.txt",
versions: ["30"],
@ -187,12 +219,14 @@ cc_library {
cc_binary_host {
name: "sefcontext_compile",
defaults: ["libselinux_defaults"],
cflags: ["-DUSE_PCRE2"],
srcs: ["utils/sefcontext_compile.c"],
static_libs: [
"libselinux",
"libsepol",
],
whole_static_libs: ["libpcre2"],
}
rust_bindgen {

View file

@ -13,10 +13,14 @@
#include <sys/stat.h>
#include <sys/xattr.h>
#include <fcntl.h>
#include <fts.h>
#include <selinux/selinux.h>
#include <selinux/context.h>
#include <selinux/android.h>
#include <selinux/label.h>
#ifndef __ANDROID_VNDK__
#include <private/android_filesystem_config.h>
#endif
#include <log/log.h>
#include "policy.h"
#include "callbacks.h"
@ -28,6 +32,9 @@
#include <linux/magic.h>
#include <libgen.h>
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h>
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define FC_DIGEST_SIZE SHA_DIGEST_LENGTH

View file

@ -1,10 +1,6 @@
#include "android_common.h"
#include "android_internal.h"
#include <fts.h>
#include <packagelistparser/packagelistparser.h>
#include <private/android_filesystem_config.h>
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h>
/* Locations for the file_contexts files. For each partition, only the first
* existing entry will be used (for example, if