1
mirror of https://github.com/topjohnwu/Magisk synced 2024-11-13 20:54:12 +01:00

Support building standalone resetprop

This commit is contained in:
topjohnwu 2020-01-21 00:48:52 +08:00
parent c3e77b1ec1
commit b13a35057a
2 changed files with 53 additions and 26 deletions

View File

@ -56,7 +56,7 @@ cpu_count = multiprocessing.cpu_count()
gradlew = os.path.join('.', 'gradlew' + ('.bat' if is_windows else ''))
archs = ['armeabi-v7a', 'x86']
arch64 = ['arm64-v8a', 'x86_64']
support_targets = ['magisk', 'magiskinit', 'magiskboot', 'magiskpolicy', 'busybox', 'test']
support_targets = ['magisk', 'magiskinit', 'magiskboot', 'magiskpolicy', 'resetprop', 'busybox', 'test']
default_targets = ['magisk', 'magiskinit', 'magiskboot', 'busybox']
build_tools = os.path.join(os.environ['ANDROID_HOME'], 'build-tools', '29.0.2')
@ -286,6 +286,9 @@ def build_binary(args):
if 'magiskpolicy' in args.target:
run_ndk_build('B_POLICY=1')
if 'resetprop' in args.target:
run_ndk_build('B_PROP=1')
if 'magiskboot' in args.target:
run_ndk_build('B_BOOT=1')

View File

@ -57,31 +57,6 @@ include $(BUILD_EXECUTABLE)
endif
ifdef B_POLICY
include $(CLEAR_VARS)
LOCAL_MODULE := magiskpolicy
LOCAL_STATIC_LIBRARIES := libsepol libutils
LOCAL_C_INCLUDES := \
jni/include \
$(LIBSEPOL) \
$(LIBUTILS)
LOCAL_SRC_FILES := \
core/applet_stub.cpp \
magiskpolicy/api.cpp \
magiskpolicy/magiskpolicy.cpp \
magiskpolicy/rules.cpp \
magiskpolicy/policydb.cpp \
magiskpolicy/statement.cpp \
magiskpolicy/sepolicy.c
LOCAL_CFLAGS := -DAPPLET_STUB_MAIN=magiskpolicy_main
LOCAL_LDFLAGS := -static
include $(BUILD_EXECUTABLE)
endif
include $(CLEAR_VARS)
ifdef B_INIT
@ -152,6 +127,55 @@ include $(BUILD_EXECUTABLE)
endif
ifdef B_POLICY
include $(CLEAR_VARS)
LOCAL_MODULE := magiskpolicy
LOCAL_STATIC_LIBRARIES := libsepol libutils
LOCAL_C_INCLUDES := \
jni/include \
$(LIBSEPOL) \
$(LIBUTILS)
LOCAL_SRC_FILES := \
core/applet_stub.cpp \
magiskpolicy/api.cpp \
magiskpolicy/magiskpolicy.cpp \
magiskpolicy/rules.cpp \
magiskpolicy/policydb.cpp \
magiskpolicy/statement.cpp \
magiskpolicy/sepolicy.c
LOCAL_CFLAGS := -DAPPLET_STUB_MAIN=magiskpolicy_main
LOCAL_LDFLAGS := -static
include $(BUILD_EXECUTABLE)
endif
ifdef B_PROP
include $(CLEAR_VARS)
LOCAL_MODULE := resetprop
LOCAL_STATIC_LIBRARIES := libnanopb libsystemproperties libutils
LOCAL_C_INCLUDES := \
jni/include \
$(LIBNANOPB) \
$(LIBSYSTEMPROPERTIES) \
$(LIBUTILS)
LOCAL_SRC_FILES := \
core/applet_stub.cpp \
resetprop/persist_properties.cpp \
resetprop/resetprop.cpp \
resetprop/system_property_api.cpp \
resetprop/system_property_set.cpp
LOCAL_CFLAGS := -DAPPLET_STUB_MAIN=resetprop_main
LOCAL_LDFLAGS := -static
include $(BUILD_EXECUTABLE)
endif
ifdef B_TEST
include $(CLEAR_VARS)