Skip to contentSkip to conversation

libsepol, checkpolicy: Update Android.mk

PATCH In review Bowgo Tsai 4 participants 8 messages Sep 22, 2016 – Oct 4, 2016 SELinux security module

lore
Share & tools
lore

Bowgo Tsai

author
#0 lore raw

PATCH 1/2 libsepol, checkpolicy: Update Android.mk

From: bowgotsai <[email protected]>

---
 checkpolicy/Android.mk | 11 ++---------
 libsepol/Android.mk    | 16 ++++++++--------
 2 files changed, 10 insertions(+), 17 deletions(-)
checkpolicy/Android.mk +2 -9
index 3b7ff8a..ee2f158 100644
@@ -18,13 +18,6 @@ common_includes := \
 	$(LOCAL_PATH)/../libsepol/src/ \
 
 ##
-# "-x c" forces the lex/yacc files to be compiled as c the build system
-# otherwise forces them to be c++. Need to also add an explicit -std because the
-# build system will soon default C++ to -std=c++11.
-yacc_flags := -x c -std=gnu89
-
-
-##
 # checkpolicy
 #
 include $(CLEAR_VARS)
@@ -32,7 +25,7 @@ include $(CLEAR_VARS)
 LOCAL_MODULE := checkpolicy
 LOCAL_MODULE_TAGS := optional
 LOCAL_C_INCLUDES := $(common_includes) 
-LOCAL_CFLAGS := $(yacc_flags) $(common_cflags)
+LOCAL_CFLAGS := $(common_cflags)
 LOCAL_SRC_FILES := $(common_src_files) checkpolicy.c
 LOCAL_STATIC_LIBRARIES := libsepol
 LOCAL_YACCFLAGS := -v
@@ -49,7 +42,7 @@ include $(CLEAR_VARS)
 LOCAL_MODULE := checkmodule
 LOCAL_MODULE_TAGS := optional
 LOCAL_C_INCLUDES := $(common_includes) 
-LOCAL_CFLAGS := $(yacc_flags) $(common_cflags)
+LOCAL_CFLAGS := $(common_cflags)
 LOCAL_SRC_FILES := $(common_src_files) checkmodule.c
 LOCAL_STATIC_LIBRARIES := libsepol
 LOCAL_YACCFLAGS := -v
libsepol/Android.mk +8 -8
index 6d89f17..e9cfeef 100644
@@ -81,6 +81,7 @@ common_includes := \
 # build system will soon default C++ to -std=c++11.
 yacc_flags := -x c -std=gnu89
 
+
 ##
 # libsepol.so
 #
@@ -88,12 +89,11 @@ include $(CLEAR_VARS)
 
 LOCAL_MODULE := libsepol
 LOCAL_MODULE_TAGS := optional
-LOCAL_COPY_HEADERS_TO := sepol
-LOCAL_COPY_HEADERS := include/sepol/handle.h include/sepol/policydb.h cil/include/cil/cil.h
 LOCAL_C_INCLUDES := $(common_includes) 
-LOCAL_CFLAGS := $(yacc_flags) $(common_cflags)
+LOCAL_CFLAGS := $(common_cflags)
+LOCAL_CPPFLAGS := $(yacc_flags)
 LOCAL_SRC_FILES := $(common_src_files) $(cil_src_files)
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
 
 include $(BUILD_HOST_SHARED_LIBRARY)
 
@@ -105,9 +105,10 @@ include $(CLEAR_VARS)
 LOCAL_MODULE := libsepol
 LOCAL_MODULE_TAGS := optional
 LOCAL_C_INCLUDES := $(common_includes) 
-LOCAL_CFLAGS := $(yacc_flags) $(common_cflags)
+LOCAL_CFLAGS := $(common_cflags)
+LOCAL_CPPFLAGS := $(yacc_flags)
 LOCAL_SRC_FILES := $(common_src_files) $(cil_src_files)
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
 
 include $(BUILD_HOST_STATIC_LIBRARY)
 
@@ -122,7 +123,6 @@ LOCAL_C_INCLUDES := $(common_includes)
 LOCAL_CFLAGS := $(common_cflags)
 LOCAL_SRC_FILES := utils/chkcon.c
 LOCAL_SHARED_LIBRARIES := libsepol
-LOCAL_MODULE_CLASS := EXECUTABLES
 
 include $(BUILD_HOST_EXECUTABLE)
 
@@ -133,6 +133,6 @@ LOCAL_MODULE_TAGES := optional
 LOCAL_C_INCLUDES := $(common_includes)
 LOCAL_CFLAGS := $(common_cflags)
 LOCAL_SRC_FILES := $(common_src_files)
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
 
 include $(BUILD_STATIC_LIBRARY)
Signature · 1 line
2.8.0.rc3.226.g39d4020
author
#1 lore raw

+Jeffrey and Daniel

Quoted 106 lines · Bowgo Tsai

From: bowgotsai <[email protected]>

---
 checkpolicy/Android.mk | 11 ++---------
 libsepol/Android.mk    | 16 ++++++++--------
 2 files changed, 10 insertions(+), 17 deletions(-)
checkpolicy/Android.mk +0 -2
index 3b7ff8a..ee2f158 100644
@@ -18,13 +18,6 @@ common_includes := \
        $(LOCAL_PATH)/../libsepol/src/ \
 
 ##
-# "-x c" forces the lex/yacc files to be compiled as c the build system
-# otherwise forces them to be c++. Need to also add an explicit -std

because the

checkpolicy/Android.mk +2 -7
-# build system will soon default C++ to -std=c++11.
-yacc_flags := -x c -std=gnu89
-
-
-##
 # checkpolicy
 #
 include $(CLEAR_VARS)
@@ -32,7 +25,7 @@ include $(CLEAR_VARS)
 LOCAL_MODULE := checkpolicy
 LOCAL_MODULE_TAGS := optional
 LOCAL_C_INCLUDES := $(common_includes)
-LOCAL_CFLAGS := $(yacc_flags) $(common_cflags)
+LOCAL_CFLAGS := $(common_cflags)
 LOCAL_SRC_FILES := $(common_src_files) checkpolicy.c
 LOCAL_STATIC_LIBRARIES := libsepol
 LOCAL_YACCFLAGS := -v
@@ -49,7 +42,7 @@ include $(CLEAR_VARS)
 LOCAL_MODULE := checkmodule
 LOCAL_MODULE_TAGS := optional
 LOCAL_C_INCLUDES := $(common_includes)
-LOCAL_CFLAGS := $(yacc_flags) $(common_cflags)
+LOCAL_CFLAGS := $(common_cflags)
 LOCAL_SRC_FILES := $(common_src_files) checkmodule.c
 LOCAL_STATIC_LIBRARIES := libsepol
 LOCAL_YACCFLAGS := -v
libsepol/Android.mk +1 -2
index 6d89f17..e9cfeef 100644
@@ -81,6 +81,7 @@ common_includes := \
 # build system will soon default C++ to -std=c++11.
 yacc_flags := -x c -std=gnu89
 
+
 ##
 # libsepol.so
 #
@@ -88,12 +89,11 @@ include $(CLEAR_VARS)
 
 LOCAL_MODULE := libsepol
 LOCAL_MODULE_TAGS := optional
-LOCAL_COPY_HEADERS_TO := sepol
-LOCAL_COPY_HEADERS := include/sepol/handle.h include/sepol/policydb.h

cil/include/cil/cil.h
LOCAL_C_INCLUDES := $(common_includes)

libsepol/Android.mk +7 -7
-LOCAL_CFLAGS := $(yacc_flags) $(common_cflags)
+LOCAL_CFLAGS := $(common_cflags)
+LOCAL_CPPFLAGS := $(yacc_flags)
 LOCAL_SRC_FILES := $(common_src_files) $(cil_src_files)
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
 
 include $(BUILD_HOST_SHARED_LIBRARY)
@@ -105,9 +105,10 @@ include $(CLEAR_VARS)
 LOCAL_MODULE := libsepol
 LOCAL_MODULE_TAGS := optional
 LOCAL_C_INCLUDES := $(common_includes)
-LOCAL_CFLAGS := $(yacc_flags) $(common_cflags)
+LOCAL_CFLAGS := $(common_cflags)
+LOCAL_CPPFLAGS := $(yacc_flags)
 LOCAL_SRC_FILES := $(common_src_files) $(cil_src_files)
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
 
 include $(BUILD_HOST_STATIC_LIBRARY)
 
@@ -122,7 +123,6 @@ LOCAL_C_INCLUDES := $(common_includes)
 LOCAL_CFLAGS := $(common_cflags)
 LOCAL_SRC_FILES := utils/chkcon.c
 LOCAL_SHARED_LIBRARIES := libsepol
-LOCAL_MODULE_CLASS := EXECUTABLES
 
 include $(BUILD_HOST_EXECUTABLE)
 
@@ -133,6 +133,6 @@ LOCAL_MODULE_TAGES := optional
 LOCAL_C_INCLUDES := $(common_includes)
 LOCAL_CFLAGS := $(common_cflags)
 LOCAL_SRC_FILES := $(common_src_files)
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
 
 include $(BUILD_STATIC_LIBRARY)
--

2.8.0.rc3.226.g39d4020

Signature · 2 lines
Bowgo Tsai |  Engineer |  [email protected] |  +886 (2) 8729-6364
<%2B886287296364>
#2 lore raw
In reply to Bowgo Tsai
Quoted 1 line · Bowgo Tsai

From: bowgotsai <[email protected]>

It looks to me as if the final versions of these patches changed before they were committed to AOSP, so I'm going to ignore these and assume you'll submit new ones. Also, if updating these, shouldn't you also update the top-level selinux/Android.mk file as well?

I was wondering however if it makes sense to keep these files upstream or if we should just drop them and let them only exist in the Android tree.

Quoted 100 lines
---
 checkpolicy/Android.mk | 11 ++---------
 libsepol/Android.mk    | 16 ++++++++--------
 2 files changed, 10 insertions(+), 17 deletions(-)
checkpolicy/Android.mk +2 -9
index 3b7ff8a..ee2f158 100644
@@ -18,13 +18,6 @@ common_includes := \
 	$(LOCAL_PATH)/../libsepol/src/ \
 
 ##
-# "-x c" forces the lex/yacc files to be compiled as c the build system
-# otherwise forces them to be c++. Need to also add an explicit -std because the
-# build system will soon default C++ to -std=c++11.
-yacc_flags := -x c -std=gnu89
-
-
-##
 # checkpolicy
 #
 include $(CLEAR_VARS)
@@ -32,7 +25,7 @@ include $(CLEAR_VARS)
 LOCAL_MODULE := checkpolicy
 LOCAL_MODULE_TAGS := optional
 LOCAL_C_INCLUDES := $(common_includes) 
-LOCAL_CFLAGS := $(yacc_flags) $(common_cflags)
+LOCAL_CFLAGS := $(common_cflags)
 LOCAL_SRC_FILES := $(common_src_files) checkpolicy.c
 LOCAL_STATIC_LIBRARIES := libsepol
 LOCAL_YACCFLAGS := -v
@@ -49,7 +42,7 @@ include $(CLEAR_VARS)
 LOCAL_MODULE := checkmodule
 LOCAL_MODULE_TAGS := optional
 LOCAL_C_INCLUDES := $(common_includes) 
-LOCAL_CFLAGS := $(yacc_flags) $(common_cflags)
+LOCAL_CFLAGS := $(common_cflags)
 LOCAL_SRC_FILES := $(common_src_files) checkmodule.c
 LOCAL_STATIC_LIBRARIES := libsepol
 LOCAL_YACCFLAGS := -v
libsepol/Android.mk +8 -8
index 6d89f17..e9cfeef 100644
@@ -81,6 +81,7 @@ common_includes := \
 # build system will soon default C++ to -std=c++11.
 yacc_flags := -x c -std=gnu89
 
+
 ##
 # libsepol.so
 #
@@ -88,12 +89,11 @@ include $(CLEAR_VARS)
 
 LOCAL_MODULE := libsepol
 LOCAL_MODULE_TAGS := optional
-LOCAL_COPY_HEADERS_TO := sepol
-LOCAL_COPY_HEADERS := include/sepol/handle.h include/sepol/policydb.h cil/include/cil/cil.h
 LOCAL_C_INCLUDES := $(common_includes) 
-LOCAL_CFLAGS := $(yacc_flags) $(common_cflags)
+LOCAL_CFLAGS := $(common_cflags)
+LOCAL_CPPFLAGS := $(yacc_flags)
 LOCAL_SRC_FILES := $(common_src_files) $(cil_src_files)
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
 
 include $(BUILD_HOST_SHARED_LIBRARY)
 
@@ -105,9 +105,10 @@ include $(CLEAR_VARS)
 LOCAL_MODULE := libsepol
 LOCAL_MODULE_TAGS := optional
 LOCAL_C_INCLUDES := $(common_includes) 
-LOCAL_CFLAGS := $(yacc_flags) $(common_cflags)
+LOCAL_CFLAGS := $(common_cflags)
+LOCAL_CPPFLAGS := $(yacc_flags)
 LOCAL_SRC_FILES := $(common_src_files) $(cil_src_files)
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
 
 include $(BUILD_HOST_STATIC_LIBRARY)
 
@@ -122,7 +123,6 @@ LOCAL_C_INCLUDES := $(common_includes)
 LOCAL_CFLAGS := $(common_cflags)
 LOCAL_SRC_FILES := utils/chkcon.c
 LOCAL_SHARED_LIBRARIES := libsepol
-LOCAL_MODULE_CLASS := EXECUTABLES
 
 include $(BUILD_HOST_EXECUTABLE)
 
@@ -133,6 +133,6 @@ LOCAL_MODULE_TAGES := optional
 LOCAL_C_INCLUDES := $(common_includes)
 LOCAL_CFLAGS := $(common_cflags)
 LOCAL_SRC_FILES := $(common_src_files)
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
 
 include $(BUILD_STATIC_LIBRARY)
author
#3 lore raw

OK, please ignore these patches, will update new ones.
I'll update the top-level Android.mk if we still want to keep Android.mk upstream.

However, I was thinking the same thing: it seems better to only keep Android.mk files in Android tree.
For other *.c/*.h files, keep these files up-to-date in the upstream as well.

If no one objects to this, I'll prepare two patches.

1. Update secilc/secilc.c
2. Delete all Android.mk files in the upstream

Let me know your thoughts.
Thanks,

Quoted 115 lines · Stephen Smalley
Quoted 1 line · Bowgo Tsai

From: bowgotsai <[email protected]>

It looks to me as if the final versions of these patches changed before they were committed to AOSP, so I'm going to ignore these and assume you'll submit new ones. Also, if updating these, shouldn't you also update the top-level selinux/Android.mk file as well?

I was wondering however if it makes sense to keep these files upstream or if we should just drop them and let them only exist in the Android tree.

Quoted 11 lines
---
 checkpolicy/Android.mk | 11 ++---------
 libsepol/Android.mk    | 16 ++++++++--------
 2 files changed, 10 insertions(+), 17 deletions(-)
checkpolicy/Android.mk +0 -0
index 3b7ff8a..ee2f158 100644

checkpolicy/Android.mk common_includes := \ · line 22

Quoted 5 lines
checkpolicy/Android.mk +0 -2
@@ -18,13 +18,6 @@ common_includes := \
      $(LOCAL_PATH)/../libsepol/src/ \
 
 ##
-# "-x c" forces the lex/yacc files to be compiled as c the build system
-# otherwise forces them to be c++. Need to also add an explicit -std

because the

Quoted 39 lines
checkpolicy/Android.mk +2 -7
-# build system will soon default C++ to -std=c++11.
-yacc_flags := -x c -std=gnu89
-
-
-##
 # checkpolicy
 #
 include $(CLEAR_VARS)
@@ -32,7 +25,7 @@ include $(CLEAR_VARS)
 LOCAL_MODULE := checkpolicy
 LOCAL_MODULE_TAGS := optional
 LOCAL_C_INCLUDES := $(common_includes)
-LOCAL_CFLAGS := $(yacc_flags) $(common_cflags)
+LOCAL_CFLAGS := $(common_cflags)
 LOCAL_SRC_FILES := $(common_src_files) checkpolicy.c
 LOCAL_STATIC_LIBRARIES := libsepol
 LOCAL_YACCFLAGS := -v
@@ -49,7 +42,7 @@ include $(CLEAR_VARS)
 LOCAL_MODULE := checkmodule
 LOCAL_MODULE_TAGS := optional
 LOCAL_C_INCLUDES := $(common_includes)
-LOCAL_CFLAGS := $(yacc_flags) $(common_cflags)
+LOCAL_CFLAGS := $(common_cflags)
 LOCAL_SRC_FILES := $(common_src_files) checkmodule.c
 LOCAL_STATIC_LIBRARIES := libsepol
 LOCAL_YACCFLAGS := -v
libsepol/Android.mk +1 -0
index 6d89f17..e9cfeef 100644
@@ -81,6 +81,7 @@ common_includes := \
 # build system will soon default C++ to -std=c++11.
 yacc_flags := -x c -std=gnu89
 
+
 ##
 # libsepol.so
 #

libsepol/Android.mk include $(CLEAR_VARS) · line 92

Quoted 5 lines
libsepol/Android.mk +0 -2
@@ -88,12 +89,11 @@ include $(CLEAR_VARS)
 
 LOCAL_MODULE := libsepol
 LOCAL_MODULE_TAGS := optional
-LOCAL_COPY_HEADERS_TO := sepol
-LOCAL_COPY_HEADERS := include/sepol/handle.h include/sepol/policydb.h

cil/include/cil/cil.h

Quoted 40 lines
libsepol/Android.mk +7 -6
 LOCAL_C_INCLUDES := $(common_includes)
-LOCAL_CFLAGS := $(yacc_flags) $(common_cflags)
+LOCAL_CFLAGS := $(common_cflags)
+LOCAL_CPPFLAGS := $(yacc_flags)
 LOCAL_SRC_FILES := $(common_src_files) $(cil_src_files)
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
 
 include $(BUILD_HOST_SHARED_LIBRARY)
 
@@ -105,9 +105,10 @@ include $(CLEAR_VARS)
 LOCAL_MODULE := libsepol
 LOCAL_MODULE_TAGS := optional
 LOCAL_C_INCLUDES := $(common_includes)
-LOCAL_CFLAGS := $(yacc_flags) $(common_cflags)
+LOCAL_CFLAGS := $(common_cflags)
+LOCAL_CPPFLAGS := $(yacc_flags)
 LOCAL_SRC_FILES := $(common_src_files) $(cil_src_files)
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
 
 include $(BUILD_HOST_STATIC_LIBRARY)
 
@@ -122,7 +123,6 @@ LOCAL_C_INCLUDES := $(common_includes)
 LOCAL_CFLAGS := $(common_cflags)
 LOCAL_SRC_FILES := utils/chkcon.c
 LOCAL_SHARED_LIBRARIES := libsepol
-LOCAL_MODULE_CLASS := EXECUTABLES
 
 include $(BUILD_HOST_EXECUTABLE)
 
@@ -133,6 +133,6 @@ LOCAL_MODULE_TAGES := optional
 LOCAL_C_INCLUDES := $(common_includes)
 LOCAL_CFLAGS := $(common_cflags)
 LOCAL_SRC_FILES := $(common_src_files)
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
 
 include $(BUILD_STATIC_LIBRARY)
Signature · 2 lines
Bowgo Tsai |  Engineer |  [email protected] |  +886 (2) 8729-6364
<%2B886287296364>
#4 lore raw
Quoted 9 lines · Bowgo Tsai

OK, please ignore these patches, will update new ones.
I'll update the top-level Android.mk if we still want to keep Android.mk upstream.

However, I was thinking the same thing: it seems better to only keep Android.mk files in Android tree.
For other *.c/*.h files, keep these files up-to-date in the upstream as well.

Quoted 4 lines

If no one objects to this, I'll prepare two patches.

1. Update secilc/secilc.c
2. Delete all Android.mk files in the upstream

SGTM

#5 lore raw
Quoted 10 lines · Stephen Smalley
Quoted 9 lines · Bowgo Tsai

OK, please ignore these patches, will update new ones.
I'll update the top-level Android.mk if we still want to keep Android.mk upstream.

However, I was thinking the same thing: it seems better to only keep Android.mk files in Android tree.
For other *.c/*.h files, keep these files up-to-date in the upstream as well.

Quoted 6 lines
Quoted 4 lines

If no one objects to this, I'll prepare two patches.

1. Update secilc/secilc.c
2. Delete all Android.mk files in the upstream

SGTM

SGTM

#6 lore raw

+1 SGTM.

Quoted 21 lines · William Roberts
Quoted 10 lines · Stephen Smalley
Quoted 9 lines · Bowgo Tsai

OK, please ignore these patches, will update new ones.
I'll update the top-level Android.mk if we still want to keep Android.mk upstream.

However, I was thinking the same thing: it seems better to only keep Android.mk files in Android tree.
For other *.c/*.h files, keep these files up-to-date in the upstream as well.

Quoted 6 lines
Quoted 4 lines

If no one objects to this, I'll prepare two patches.

1. Update secilc/secilc.c
2. Delete all Android.mk files in the upstream

SGTM

SGTM

author
#7 lore raw

Thanks for the confirmation, both changes were merged into upstream.

Quoted 28 lines · Daniel Cashman

+1 SGTM.

Quoted 22 lines · William Roberts
Quoted 3 lines · Stephen Smalley
Quoted 2 lines · Bowgo Tsai

OK, please ignore these patches, will update new ones. I'll update the top-level Android.mk if we still want to keep

Android.mk

Quoted 7 lines
Quoted 7 lines

upstream.

However, I was thinking the same thing: it seems better to only keep Android.mk files in Android tree.
For other *.c/*.h files, keep these files up-to-date in the upstream as well.

Quoted 6 lines
Quoted 4 lines

If no one objects to this, I'll prepare two patches.

1. Update secilc/secilc.c
2. Delete all Android.mk files in the upstream

SGTM

SGTM

Signature · 2 lines
Bowgo Tsai |  Engineer |  [email protected] |  +886 (2) 8729-6364
<%2B886287296364>