Separate libutils and libsystemproperties

This commit is contained in:
topjohnwu 2018-09-27 03:30:16 -04:00
parent df8b047bca
commit 41446ec9ba
31 changed files with 32 additions and 25 deletions

View File

@ -171,7 +171,7 @@ def build_binary(args):
header('* Building binaries: ' + ' '.join(args.target))
# Force update logging.h timestamp to trigger recompilation for the flags to make a difference
os.utime(os.path.join('native', 'jni', 'include', 'logging.h'))
os.utime(os.path.join('native', 'jni', 'utils', 'include', 'logging.h'))
# Basic flags
base_flags = 'MAGISK_VERSION=\"{}\" MAGISK_VER_CODE={} MAGISK_DEBUG={}'.format(config['version'], config['versionCode'],

View File

@ -10,15 +10,8 @@ LIBLZ4 := $(EXT_PATH)/lz4/lib
LIBBZ2 := $(EXT_PATH)/bzip2
LIBFDT := $(EXT_PATH)/dtc/libfdt
LIBNANOPB := $(EXT_PATH)/nanopb
LIBSYSTEMPROPERTIES := jni/resetprop/libsystemproperties/include
COMMON_UTILS := \
utils/file.c \
utils/list.c \
utils/misc.c \
utils/vector.c \
utils/selinux.c \
utils/logging.c \
utils/xwrap.c
LIBSYSTEMPROPERTIES := jni/systemproperties/include
LIBUTILS := jni/utils/include
########################
# Binaries
@ -30,12 +23,13 @@ ifdef B_MAGISK
include $(CLEAR_VARS)
LOCAL_MODULE := magisk
LOCAL_SHARED_LIBRARIES := libsqlite
LOCAL_STATIC_LIBRARIES := libnanopb libsystemproperties
LOCAL_STATIC_LIBRARIES := libnanopb libsystemproperties libutils
LOCAL_C_INCLUDES := \
jni/include \
$(EXT_PATH)/include \
$(LIBNANOPB) \
$(LIBSYSTEMPROPERTIES)
$(LIBSYSTEMPROPERTIES) \
$(LIBUTILS)
LOCAL_SRC_FILES := \
core/magisk.c \
@ -55,10 +49,8 @@ LOCAL_SRC_FILES := \
su/connect.c \
su/pts.c \
su/su_daemon.c \
utils/img.c \
$(COMMON_UTILS)
utils/img.c
LOCAL_CFLAGS := -DIS_DAEMON
LOCAL_LDLIBS := -llog
include $(BUILD_EXECUTABLE)
@ -69,22 +61,22 @@ ifdef B_INIT
# magiskinit
include $(CLEAR_VARS)
LOCAL_MODULE := magiskinit
LOCAL_STATIC_LIBRARIES := libsepol libxz
LOCAL_STATIC_LIBRARIES := libsepol libxz libutils
LOCAL_C_INCLUDES := \
jni/include \
jni/magiskpolicy \
$(EXT_PATH)/include \
out \
out/$(TARGET_ARCH_ABI) \
$(LIBSEPOL)
$(LIBSEPOL) \
$(LIBUTILS)
LOCAL_SRC_FILES := \
core/magiskinit.c \
magiskpolicy/api.c \
magiskpolicy/magiskpolicy.c \
magiskpolicy/rules.c \
magiskpolicy/sepolicy.c \
$(COMMON_UTILS)
magiskpolicy/sepolicy.c
LOCAL_LDFLAGS := -static
include $(BUILD_EXECUTABLE)
@ -96,14 +88,15 @@ ifdef B_BOOT
# magiskboot
include $(CLEAR_VARS)
LOCAL_MODULE := magiskboot
LOCAL_STATIC_LIBRARIES := libmincrypt liblzma liblz4 libbz2 libfdt
LOCAL_STATIC_LIBRARIES := libmincrypt liblzma liblz4 libbz2 libfdt libutils
LOCAL_C_INCLUDES := \
jni/include \
$(EXT_PATH)/include \
$(LIBLZMA) \
$(LIBLZ4) \
$(LIBBZ2) \
$(LIBFDT)
$(LIBFDT) \
$(LIBUTILS)
LOCAL_SRC_FILES := \
magiskboot/cpio.c \
@ -114,10 +107,8 @@ LOCAL_SRC_FILES := \
magiskboot/format.c \
magiskboot/dtb.c \
magiskboot/ramdisk.c \
magiskboot/pattern.c \
$(COMMON_UTILS)
magiskboot/pattern.c
LOCAL_CFLAGS := -DXWRAP_EXIT
LOCAL_LDLIBS := -lz
include $(BUILD_EXECUTABLE)
@ -146,5 +137,6 @@ endif
########################
# Libraries
########################
include jni/utils/Android.mk
include jni/systemproperties/Android.mk
include jni/external/Android.mk
include jni/resetprop/libsystemproperties/Android.mk

View File

@ -0,0 +1,15 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE:= libutils
LOCAL_C_INCLUDES := jni/include $(LIBUTILS)
LOCAL_SRC_FILES := \
file.c \
list.c \
misc.c \
vector.c \
selinux.c \
logging.c \
xwrap.c
include $(BUILD_STATIC_LIBRARY)