Move host functionality to common selinux dir

Device side libselinux has Android specific modifications.
but host side tools do not. Move host functionality over to common
selinux directory. This allows tools with libselinux dependency e.g.
audit2allow to be built in tree.

Change-Id: I10a7174b415bad7b5154c382a55eb10a8ed52fa5
This commit is contained in:
Jeff Vander Stoep 2015-05-13 10:08:25 -07:00
parent c617134621
commit 527d945abc
3 changed files with 154 additions and 66 deletions

View file

@ -1 +1 @@
include $(call all-named-subdir-makefiles, libsepol checkpolicy) include $(call all-named-subdir-makefiles, libsepol checkpolicy libselinux)

65
libselinux/Android.mk Normal file
View file

@ -0,0 +1,65 @@
LOCAL_PATH:= $(call my-dir)
common_HOST_FILES := \
src/enabled.c \
src/setrans_client.c \
src/callbacks.c \
src/check_context.c \
src/freecon.c \
src/init.c \
src/label.c \
src/lgetfilecon.c \
src/canonicalize_context.c \
src/matchpathcon.c \
src/label_media.c \
src/label_x.c \
src/label_db.c \
src/seusers.c \
src/load_policy.c \
src/policyvers.c \
src/selinux_config.c \
src/label_file.c \
src/lsetfilecon.c \
src/disable.c \
src/booleans.c \
src/getenforce.c \
src/setenforce.c \
src/label_android_property.c
common_COPY_HEADERS_TO := selinux
common_COPY_HEADERS := \
include/selinux/selinux.h \
include/selinux/label.h \
include/selinux/context.h \
include/selinux/avc.h \
include/selinux/get_default_type.h
include $(CLEAR_VARS)
LOCAL_CFLAGS := -DHOST -D_GNU_SOURCE
ifeq ($(HOST_OS),darwin)
LOCAL_CFLAGS += -DDARWIN
endif
LOCAL_SRC_FILES := $(common_HOST_FILES)
LOCAL_MODULE:= libselinux
LOCAL_MODULE_TAGS := eng
LOCAL_WHOLE_STATIC_LIBRARIES := libpcre libsepol
LOCAL_C_INCLUDES := external/pcre
include $(BUILD_HOST_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_CFLAGS := -DHOST -D_GNU_SOURCE
ifeq ($(HOST_OS),darwin)
LOCAL_CFLAGS += -DDARWIN
endif
LOCAL_SRC_FILES := $(common_HOST_FILES)
LOCAL_MODULE:= libselinux
LOCAL_MODULE_TAGS := eng
LOCAL_COPY_HEADERS_TO := $(common_COPY_HEADERS_TO)
LOCAL_COPY_HEADERS := $(common_COPY_HEADERS)
LOCAL_WHOLE_STATIC_LIBRARIES := libpcre libsepol
LOCAL_C_INCLUDES := external/pcre
include $(BUILD_HOST_SHARED_LIBRARY)

View file

@ -1,71 +1,94 @@
LOCAL_PATH:= $(call my-dir) LOCAL_PATH:= $(call my-dir)
common_src_files := \ common_src_files := \
src/assertion.c \ src/assertion.c \
src/avrule_block.c \ src/avrule_block.c \
src/avtab.c \ src/avtab.c \
src/boolean_record.c \ src/boolean_record.c \
src/booleans.c \ src/booleans.c \
src/conditional.c \ src/conditional.c \
src/constraint.c \ src/constraint.c \
src/context.c \ src/context.c \
src/context_record.c \ src/context_record.c \
src/debug.c \ src/debug.c \
src/ebitmap.c \ src/ebitmap.c \
src/expand.c \ src/expand.c \
src/genbools.c \ src/genbools.c \
src/genusers.c \ src/genusers.c \
src/handle.c \ src/handle.c \
src/hashtab.c \ src/hashtab.c \
src/hierarchy.c \ src/hierarchy.c \
src/iface_record.c \ src/iface_record.c \
src/interfaces.c \ src/interfaces.c \
src/link.c \ src/link.c \
src/mls.c \ src/mls.c \
src/module.c \ src/module.c \
src/module_to_cil.c \ src/module_to_cil.c \
src/node_record.c \ src/node_record.c \
src/nodes.c \ src/nodes.c \
src/polcaps.c \ src/polcaps.c \
src/policydb.c \ src/policydb.c \
src/policydb_convert.c \ src/policydb_convert.c \
src/policydb_public.c \ src/policydb_public.c \
src/port_record.c \ src/port_record.c \
src/ports.c \ src/ports.c \
src/roles.c \ src/roles.c \
src/services.c \ src/services.c \
src/sidtab.c \ src/sidtab.c \
src/symtab.c \ src/symtab.c \
src/user_record.c \ src/user_record.c \
src/users.c \ src/users.c \
src/util.c \ src/util.c \
src/write.c src/write.c
cil_src_files := \ cil_src_files := \
cil/src/cil_binary.c \ cil/src/cil_binary.c \
cil/src/cil_build_ast.c \ cil/src/cil_build_ast.c \
cil/src/cil.c \ cil/src/cil.c \
cil/src/cil_copy_ast.c \ cil/src/cil_copy_ast.c \
cil/src/cil_fqn.c \ cil/src/cil_fqn.c \
cil/src/cil_lexer.l \ cil/src/cil_lexer.l \
cil/src/cil_list.c \ cil/src/cil_list.c \
cil/src/cil_log.c \ cil/src/cil_log.c \
cil/src/cil_mem.c \ cil/src/cil_mem.c \
cil/src/cil_parser.c \ cil/src/cil_parser.c \
cil/src/cil_policy.c \ cil/src/cil_policy.c \
cil/src/cil_post.c \ cil/src/cil_post.c \
cil/src/cil_reset_ast.c \ cil/src/cil_reset_ast.c \
cil/src/cil_resolve_ast.c \ cil/src/cil_resolve_ast.c \
cil/src/cil_stack.c \ cil/src/cil_stack.c \
cil/src/cil_strpool.c \ cil/src/cil_strpool.c \
cil/src/cil_symtab.c \ cil/src/cil_symtab.c \
cil/src/cil_tree.c \ cil/src/cil_tree.c \
cil/src/cil_verify.c cil/src/cil_verify.c
common_cflags := \ common_cflags := \
-Wall -W -Wundef \ -Wall -W -Wundef \
-Wshadow -Wmissing-noreturn \ -Wshadow -Wmissing-noreturn \
-Wmissing-format-attribute -Wmissing-format-attribute
common_COPY_HEADERS := \
include/sepol/handle.h \
include/sepol/policydb.h \
cil/include/cil/cil.h \
include/sepol/sepol.h \
include/sepol/policydb.h \
include/sepol/user_record.h \
include/sepol/context_record.h \
include/sepol/iface_record.h \
include/sepol/port_record.h \
include/sepol/boolean_record.h \
include/sepol/node_record.h \
include/sepol/booleans.h \
include/sepol/interfaces.h \
include/sepol/ports.h \
include/sepol/nodes.h \
include/sepol/users.h \
include/sepol/handle.h \
include/sepol/debug.h \
include/sepol/policydb.h \
include/sepol/module.h \
include/sepol/context.h
ifeq ($(HOST_OS), darwin) ifeq ($(HOST_OS), darwin)
common_cflags += -DDARWIN common_cflags += -DDARWIN
@ -91,8 +114,8 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libsepol LOCAL_MODULE := libsepol
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
LOCAL_COPY_HEADERS_TO := sepol LOCAL_COPY_HEADERS_TO := sepol
LOCAL_COPY_HEADERS := include/sepol/handle.h include/sepol/policydb.h cil/include/cil/cil.h LOCAL_COPY_HEADERS := $(common_COPY_HEADERS)
LOCAL_C_INCLUDES := $(common_includes) LOCAL_C_INCLUDES := $(common_includes)
LOCAL_CFLAGS := $(yacc_flags) $(common_cflags) LOCAL_CFLAGS := $(yacc_flags) $(common_cflags)
LOCAL_SRC_FILES := $(common_src_files) $(cil_src_files) LOCAL_SRC_FILES := $(common_src_files) $(cil_src_files)
LOCAL_MODULE_CLASS := SHARED_LIBRARIES LOCAL_MODULE_CLASS := SHARED_LIBRARIES
@ -106,7 +129,7 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libsepol LOCAL_MODULE := libsepol
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) LOCAL_C_INCLUDES := $(common_includes)
LOCAL_CFLAGS := $(yacc_flags) $(common_cflags) LOCAL_CFLAGS := $(yacc_flags) $(common_cflags)
LOCAL_SRC_FILES := $(common_src_files) $(cil_src_files) LOCAL_SRC_FILES := $(common_src_files) $(cil_src_files)
LOCAL_MODULE_CLASS := STATIC_LIBRARIES LOCAL_MODULE_CLASS := STATIC_LIBRARIES
@ -120,7 +143,7 @@ include $(CLEAR_VARS)
LOCAL_MODULE := chkcon LOCAL_MODULE := chkcon
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) LOCAL_C_INCLUDES := $(common_includes)
LOCAL_CFLAGS := $(common_cflags) LOCAL_CFLAGS := $(common_cflags)
LOCAL_SRC_FILES := utils/chkcon.c LOCAL_SRC_FILES := utils/chkcon.c
LOCAL_SHARED_LIBRARIES := libsepol LOCAL_SHARED_LIBRARIES := libsepol