Merge "Add build flags for libselinux" into main

This commit is contained in:
Thiébaud Weksteen 2024-03-04 23:28:31 +00:00 committed by Gerrit Code Review
commit c23cbe8ca5
2 changed files with 28 additions and 0 deletions

View file

@ -52,6 +52,7 @@ common_CFLAGS = [
cc_defaults { cc_defaults {
name: "libselinux_defaults", name: "libselinux_defaults",
defaults: ["libselinux_flags_defaults"],
cflags: common_CFLAGS, cflags: common_CFLAGS,
@ -157,6 +158,28 @@ cc_defaults {
stl: "none", stl: "none",
} }
soong_config_module_type {
name: "cc_defaults_libselinux_flags",
module_type: "cc_defaults",
config_namespace: "ANDROID",
bool_variables: [
"release_selinux_data_data_ignore",
],
properties: [
"cflags",
],
}
cc_defaults_libselinux_flags {
name: "libselinux_flags_defaults",
host_supported: true,
soong_config_variables: {
release_selinux_data_data_ignore: {
cflags: ["-DSELINUX_FLAGS_DATA_DATA_IGNORE"],
}
}
}
cc_library { cc_library {
name: "libselinux", name: "libselinux",
defaults: ["libselinux_defaults"], defaults: ["libselinux_defaults"],

View file

@ -281,6 +281,11 @@ struct pkg_info *package_info_lookup(const char *name)
*/ */
static bool is_app_data_path(const char *pathname) { static bool is_app_data_path(const char *pathname) {
int flags = FNM_LEADING_DIR|FNM_PATHNAME; int flags = FNM_LEADING_DIR|FNM_PATHNAME;
#ifdef SELINUX_FLAGS_DATA_DATA_IGNORE
if (!strcmp(pathname, DATA_DATA_PATH)) {
return true;
}
#endif
return (!strncmp(pathname, DATA_DATA_PREFIX, sizeof(DATA_DATA_PREFIX)-1) || return (!strncmp(pathname, DATA_DATA_PREFIX, sizeof(DATA_DATA_PREFIX)-1) ||
!strncmp(pathname, DATA_USER_PREFIX, sizeof(DATA_USER_PREFIX)-1) || !strncmp(pathname, DATA_USER_PREFIX, sizeof(DATA_USER_PREFIX)-1) ||
!strncmp(pathname, DATA_USER_DE_PREFIX, sizeof(DATA_USER_DE_PREFIX)-1) || !strncmp(pathname, DATA_USER_DE_PREFIX, sizeof(DATA_USER_DE_PREFIX)-1) ||