Skip to content

Commit

Permalink
Separate libutils and libsystemproperties
Browse files Browse the repository at this point in the history
  • Loading branch information
topjohnwu committed Sep 27, 2018
1 parent df8b047 commit 41446ec
Show file tree
Hide file tree
Showing 31 changed files with 32 additions and 25 deletions.
2 changes: 1 addition & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
40 changes: 16 additions & 24 deletions native/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \
Expand All @@ -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)

Expand All @@ -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)
Expand All @@ -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 \
Expand All @@ -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)

Expand Down Expand Up @@ -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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions native/jni/utils/Android.mk
Original file line number Diff line number Diff line change
@@ -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)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 41446ec

Please sign in to comment.