mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-21 23:47:39 +00:00
Update build scripts
This commit is contained in:
parent
2e51fe20a1
commit
e4094c0caa
21
build.py
21
build.py
@ -328,8 +328,6 @@ def build_binary(args):
|
||||
|
||||
dump_flag_header()
|
||||
|
||||
# Build shared executables
|
||||
|
||||
flag = ''
|
||||
|
||||
if 'magisk' in args.target:
|
||||
@ -344,18 +342,6 @@ def build_binary(args):
|
||||
if 'magiskinit' in args.target:
|
||||
flag += ' B_PRELOAD=1'
|
||||
|
||||
if flag:
|
||||
run_ndk_build(flag + ' B_SHARED=1')
|
||||
clean_elf()
|
||||
|
||||
# Then build static executables
|
||||
|
||||
flag = ''
|
||||
|
||||
if 'magiskinit' in args.target:
|
||||
dump_bin_header(args)
|
||||
flag += ' B_INIT=1'
|
||||
|
||||
if 'resetprop' in args.target:
|
||||
flag += ' B_PROP=1'
|
||||
|
||||
@ -364,6 +350,13 @@ def build_binary(args):
|
||||
|
||||
if flag:
|
||||
run_ndk_build(flag)
|
||||
clean_elf()
|
||||
|
||||
# magiskinit and busybox has to be built separately
|
||||
|
||||
if 'magiskinit' in args.target:
|
||||
dump_bin_header(args)
|
||||
run_ndk_build('B_INIT=1')
|
||||
|
||||
if 'busybox' in args.target:
|
||||
run_ndk_build('B_BB=1')
|
||||
|
@ -78,7 +78,6 @@ LOCAL_SRC_FILES := \
|
||||
init/twostage.cpp \
|
||||
init/selinux.cpp
|
||||
|
||||
LOCAL_LDFLAGS := -static
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
endif
|
||||
@ -109,7 +108,6 @@ LOCAL_SRC_FILES := \
|
||||
boot/pattern.cpp \
|
||||
boot/cpio.cpp
|
||||
|
||||
LOCAL_LDFLAGS := -static
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
endif
|
||||
@ -145,7 +143,6 @@ LOCAL_SRC_FILES := \
|
||||
resetprop/resetprop.cpp \
|
||||
|
||||
LOCAL_CFLAGS := -DAPPLET_STUB_MAIN=resetprop_main
|
||||
LOCAL_LDFLAGS := -static
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
endif
|
||||
@ -170,7 +167,7 @@ endif
|
||||
########################
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE:= libpolicy
|
||||
LOCAL_MODULE := libpolicy
|
||||
LOCAL_STATIC_LIBRARIES := \
|
||||
libbase \
|
||||
libsepol
|
||||
|
@ -7,15 +7,10 @@ APP_PLATFORM := android-21
|
||||
APP_THIN_ARCHIVE := true
|
||||
APP_STRIP_MODE := --strip-all
|
||||
|
||||
ifndef B_SHARED
|
||||
# Fix static variables' ctor/dtor when using LTO
|
||||
# See: https://github.com/android/ndk/issues/1461
|
||||
APP_LDFLAGS += -T jni/lto_fix.lds
|
||||
endif
|
||||
|
||||
# Busybox should use stock libc.a
|
||||
ifdef B_BB
|
||||
APP_PLATFORM := android-24
|
||||
APP_LDFLAGS += -T jni/lto_fix.lds
|
||||
ifeq ($(OS),Windows_NT)
|
||||
APP_SHORT_COMMANDS := true
|
||||
endif
|
||||
|
@ -3,7 +3,7 @@ LOCAL_PATH := $(call my-dir)
|
||||
# Magisk project-wide common code
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE:= libbase
|
||||
LOCAL_MODULE := libbase
|
||||
LOCAL_C_INCLUDES := jni/include $(LOCAL_PATH)/include out/generated
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
|
||||
LOCAL_EXPORT_STATIC_LIBRARIES := libcxx
|
||||
@ -18,10 +18,14 @@ LOCAL_SRC_FILES := \
|
||||
stream.cpp
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
# Workaround "hacky" libc.a missing symbols
|
||||
# To build Magisk with vanilla NDK, remove all usage of libcompat
|
||||
# All static executables should link with libcompat
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE:= libcompat
|
||||
LOCAL_MODULE := libcompat
|
||||
# Workaround "hacky" libc.a missing symbols
|
||||
# To build Magisk with vanilla NDK, comment out the next line
|
||||
LOCAL_SRC_FILES := compat/compat.cpp
|
||||
# Fix static variables' ctor/dtor when using LTO
|
||||
# See: https://github.com/android/ndk/issues/1461
|
||||
LOCAL_EXPORT_LDLIBS := -static -T jni/lto_fix.lds
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
Loading…
x
Reference in New Issue
Block a user