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)) header('* Building binaries: ' + ' '.join(args.target))
# Force update logging.h timestamp to trigger recompilation for the flags to make a difference # 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 # Basic flags
base_flags = 'MAGISK_VERSION=\"{}\" MAGISK_VER_CODE={} MAGISK_DEBUG={}'.format(config['version'], config['versionCode'], 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 LIBBZ2 := $(EXT_PATH)/bzip2
LIBFDT := $(EXT_PATH)/dtc/libfdt LIBFDT := $(EXT_PATH)/dtc/libfdt
LIBNANOPB := $(EXT_PATH)/nanopb LIBNANOPB := $(EXT_PATH)/nanopb
LIBSYSTEMPROPERTIES := jni/resetprop/libsystemproperties/include LIBSYSTEMPROPERTIES := jni/systemproperties/include
COMMON_UTILS := \ LIBUTILS := jni/utils/include
utils/file.c \
utils/list.c \
utils/misc.c \
utils/vector.c \
utils/selinux.c \
utils/logging.c \
utils/xwrap.c
######################## ########################
# Binaries # Binaries
@ -30,12 +23,13 @@ ifdef B_MAGISK
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := magisk LOCAL_MODULE := magisk
LOCAL_SHARED_LIBRARIES := libsqlite LOCAL_SHARED_LIBRARIES := libsqlite
LOCAL_STATIC_LIBRARIES := libnanopb libsystemproperties LOCAL_STATIC_LIBRARIES := libnanopb libsystemproperties libutils
LOCAL_C_INCLUDES := \ LOCAL_C_INCLUDES := \
jni/include \ jni/include \
$(EXT_PATH)/include \ $(EXT_PATH)/include \
$(LIBNANOPB) \ $(LIBNANOPB) \
$(LIBSYSTEMPROPERTIES) $(LIBSYSTEMPROPERTIES) \
$(LIBUTILS)
LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \
core/magisk.c \ core/magisk.c \
@ -55,10 +49,8 @@ LOCAL_SRC_FILES := \
su/connect.c \ su/connect.c \
su/pts.c \ su/pts.c \
su/su_daemon.c \ su/su_daemon.c \
utils/img.c \ utils/img.c
$(COMMON_UTILS)
LOCAL_CFLAGS := -DIS_DAEMON
LOCAL_LDLIBS := -llog LOCAL_LDLIBS := -llog
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)
@ -69,22 +61,22 @@ ifdef B_INIT
# magiskinit # magiskinit
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := magiskinit LOCAL_MODULE := magiskinit
LOCAL_STATIC_LIBRARIES := libsepol libxz LOCAL_STATIC_LIBRARIES := libsepol libxz libutils
LOCAL_C_INCLUDES := \ LOCAL_C_INCLUDES := \
jni/include \ jni/include \
jni/magiskpolicy \ jni/magiskpolicy \
$(EXT_PATH)/include \ $(EXT_PATH)/include \
out \ out \
out/$(TARGET_ARCH_ABI) \ out/$(TARGET_ARCH_ABI) \
$(LIBSEPOL) $(LIBSEPOL) \
$(LIBUTILS)
LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \
core/magiskinit.c \ core/magiskinit.c \
magiskpolicy/api.c \ magiskpolicy/api.c \
magiskpolicy/magiskpolicy.c \ magiskpolicy/magiskpolicy.c \
magiskpolicy/rules.c \ magiskpolicy/rules.c \
magiskpolicy/sepolicy.c \ magiskpolicy/sepolicy.c
$(COMMON_UTILS)
LOCAL_LDFLAGS := -static LOCAL_LDFLAGS := -static
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)
@ -96,14 +88,15 @@ ifdef B_BOOT
# magiskboot # magiskboot
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := magiskboot LOCAL_MODULE := magiskboot
LOCAL_STATIC_LIBRARIES := libmincrypt liblzma liblz4 libbz2 libfdt LOCAL_STATIC_LIBRARIES := libmincrypt liblzma liblz4 libbz2 libfdt libutils
LOCAL_C_INCLUDES := \ LOCAL_C_INCLUDES := \
jni/include \ jni/include \
$(EXT_PATH)/include \ $(EXT_PATH)/include \
$(LIBLZMA) \ $(LIBLZMA) \
$(LIBLZ4) \ $(LIBLZ4) \
$(LIBBZ2) \ $(LIBBZ2) \
$(LIBFDT) $(LIBFDT) \
$(LIBUTILS)
LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \
magiskboot/cpio.c \ magiskboot/cpio.c \
@ -114,10 +107,8 @@ LOCAL_SRC_FILES := \
magiskboot/format.c \ magiskboot/format.c \
magiskboot/dtb.c \ magiskboot/dtb.c \
magiskboot/ramdisk.c \ magiskboot/ramdisk.c \
magiskboot/pattern.c \ magiskboot/pattern.c
$(COMMON_UTILS)
LOCAL_CFLAGS := -DXWRAP_EXIT
LOCAL_LDLIBS := -lz LOCAL_LDLIBS := -lz
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)
@ -146,5 +137,6 @@ endif
######################## ########################
# Libraries # Libraries
######################## ########################
include jni/utils/Android.mk
include jni/systemproperties/Android.mk
include jni/external/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)