mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-22 16:07:39 +00:00
Fix building individual applet
This commit is contained in:
parent
357d913f18
commit
d1d26f4481
4
build.py
4
build.py
@ -64,7 +64,7 @@ cpu_count = multiprocessing.cpu_count()
|
|||||||
archs = ['armeabi-v7a', 'x86', 'arm64-v8a', 'x86_64']
|
archs = ['armeabi-v7a', 'x86', 'arm64-v8a', 'x86_64']
|
||||||
triples = ['armv7a-linux-androideabi', 'i686-linux-android', 'aarch64-linux-android', 'x86_64-linux-android']
|
triples = ['armv7a-linux-androideabi', 'i686-linux-android', 'aarch64-linux-android', 'x86_64-linux-android']
|
||||||
default_targets = ['magisk', 'magiskinit', 'magiskboot', 'magiskpolicy', 'busybox']
|
default_targets = ['magisk', 'magiskinit', 'magiskboot', 'magiskpolicy', 'busybox']
|
||||||
support_targets = default_targets + ['resetprop', 'test']
|
support_targets = default_targets + ['resetprop']
|
||||||
rust_targets = ['magisk', 'magiskinit', 'magiskboot', 'magiskpolicy']
|
rust_targets = ['magisk', 'magiskinit', 'magiskboot', 'magiskpolicy']
|
||||||
|
|
||||||
sdk_path = os.environ['ANDROID_SDK_ROOT']
|
sdk_path = os.environ['ANDROID_SDK_ROOT']
|
||||||
@ -220,6 +220,8 @@ def run_ndk_build(flags):
|
|||||||
def run_cargo_build(args):
|
def run_cargo_build(args):
|
||||||
os.chdir(op.join('native', 'src'))
|
os.chdir(op.join('native', 'src'))
|
||||||
targets = set(args.target) & set(rust_targets)
|
targets = set(args.target) & set(rust_targets)
|
||||||
|
if 'resetprop' in args.target:
|
||||||
|
targets.add('magisk')
|
||||||
|
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env['CARGO_BUILD_RUSTC'] = op.join(rust_bin, 'rustc' + EXE_EXT)
|
env['CARGO_BUILD_RUSTC'] = op.join(rust_bin, 'rustc' + EXE_EXT)
|
||||||
|
@ -4,30 +4,34 @@ LOCAL_PATH := $(call my-dir)
|
|||||||
# Rust compilation outputs
|
# Rust compilation outputs
|
||||||
###########################
|
###########################
|
||||||
|
|
||||||
ifdef B_MAGISK
|
LIBRARY_PATH = ../out/$(TARGET_ARCH_ABI)/libmagisk-rs.a
|
||||||
|
ifneq (,$(wildcard $(LOCAL_PATH)/$(LIBRARY_PATH)))
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := magisk-rs
|
LOCAL_MODULE := magisk-rs
|
||||||
LOCAL_SRC_FILES := ../out/$(TARGET_ARCH_ABI)/libmagisk-rs.a
|
LOCAL_SRC_FILES := $(LIBRARY_PATH)
|
||||||
include $(PREBUILT_STATIC_LIBRARY)
|
include $(PREBUILT_STATIC_LIBRARY)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef B_BOOT
|
LIBRARY_PATH = ../out/$(TARGET_ARCH_ABI)/libmagiskboot-rs.a
|
||||||
|
ifneq (,$(wildcard $(LOCAL_PATH)/$(LIBRARY_PATH)))
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := boot-rs
|
LOCAL_MODULE := boot-rs
|
||||||
LOCAL_SRC_FILES := ../out/$(TARGET_ARCH_ABI)/libmagiskboot-rs.a
|
LOCAL_SRC_FILES := $(LIBRARY_PATH)
|
||||||
include $(PREBUILT_STATIC_LIBRARY)
|
include $(PREBUILT_STATIC_LIBRARY)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef B_INIT
|
LIBRARY_PATH = ../out/$(TARGET_ARCH_ABI)/libmagiskinit-rs.a
|
||||||
|
ifneq (,$(wildcard $(LOCAL_PATH)/$(LIBRARY_PATH)))
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := init-rs
|
LOCAL_MODULE := init-rs
|
||||||
LOCAL_SRC_FILES := ../out/$(TARGET_ARCH_ABI)/libmagiskinit-rs.a
|
LOCAL_SRC_FILES := $(LIBRARY_PATH)
|
||||||
include $(PREBUILT_STATIC_LIBRARY)
|
include $(PREBUILT_STATIC_LIBRARY)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef B_POLICY
|
LIBRARY_PATH = ../out/$(TARGET_ARCH_ABI)/libmagiskpolicy-rs.a
|
||||||
|
ifneq (,$(wildcard $(LOCAL_PATH)/$(LIBRARY_PATH)))
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := policy-rs
|
LOCAL_MODULE := policy-rs
|
||||||
LOCAL_SRC_FILES := ../out/$(TARGET_ARCH_ABI)/libmagiskpolicy-rs.a
|
LOCAL_SRC_FILES := $(LIBRARY_PATH)
|
||||||
include $(PREBUILT_STATIC_LIBRARY)
|
include $(PREBUILT_STATIC_LIBRARY)
|
||||||
endif
|
endif
|
||||||
|
@ -150,29 +150,14 @@ LOCAL_STATIC_LIBRARIES := \
|
|||||||
|
|
||||||
LOCAL_SRC_FILES := \
|
LOCAL_SRC_FILES := \
|
||||||
core/applet_stub.cpp \
|
core/applet_stub.cpp \
|
||||||
resetprop/persist_properties.cpp \
|
|
||||||
resetprop/resetprop.cpp \
|
resetprop/resetprop.cpp \
|
||||||
|
resetprop/persist.cpp \
|
||||||
|
|
||||||
LOCAL_CFLAGS := -DAPPLET_STUB_MAIN=resetprop_main
|
LOCAL_CFLAGS := -DAPPLET_STUB_MAIN=resetprop_main
|
||||||
include $(BUILD_EXECUTABLE)
|
include $(BUILD_EXECUTABLE)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef B_TEST
|
|
||||||
ifneq (,$(wildcard src/test.cpp))
|
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
LOCAL_MODULE := test
|
|
||||||
LOCAL_STATIC_LIBRARIES := \
|
|
||||||
libbase \
|
|
||||||
libphmap
|
|
||||||
|
|
||||||
LOCAL_SRC_FILES := test.cpp
|
|
||||||
include $(BUILD_EXECUTABLE)
|
|
||||||
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
########################
|
########################
|
||||||
# Libraries
|
# Libraries
|
||||||
########################
|
########################
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <magisk.hpp>
|
#include <magisk.hpp>
|
||||||
|
#include <selinux.hpp>
|
||||||
#include <base.hpp>
|
#include <base.hpp>
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
umask(0);
|
if (argc < 1)
|
||||||
|
return 1;
|
||||||
|
enable_selinux();
|
||||||
cmdline_logging();
|
cmdline_logging();
|
||||||
|
init_argv0(argc, argv);
|
||||||
|
umask(0);
|
||||||
return APPLET_STUB_MAIN(argc, argv);
|
return APPLET_STUB_MAIN(argc, argv);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include <resetprop.hpp>
|
#include <resetprop.hpp>
|
||||||
#include <base.hpp>
|
#include <base.hpp>
|
||||||
|
|
||||||
|
#undef __INTRODUCED_IN
|
||||||
|
#define __INTRODUCED_IN(...)
|
||||||
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
|
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
|
||||||
#include <_system_properties.h>
|
#include <_system_properties.h>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user