mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-22 16:07: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()
|
dump_flag_header()
|
||||||
|
|
||||||
# Build shared executables
|
|
||||||
|
|
||||||
flag = ''
|
flag = ''
|
||||||
|
|
||||||
if 'magisk' in args.target:
|
if 'magisk' in args.target:
|
||||||
@ -344,18 +342,6 @@ def build_binary(args):
|
|||||||
if 'magiskinit' in args.target:
|
if 'magiskinit' in args.target:
|
||||||
flag += ' B_PRELOAD=1'
|
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:
|
if 'resetprop' in args.target:
|
||||||
flag += ' B_PROP=1'
|
flag += ' B_PROP=1'
|
||||||
|
|
||||||
@ -364,6 +350,13 @@ def build_binary(args):
|
|||||||
|
|
||||||
if flag:
|
if flag:
|
||||||
run_ndk_build(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:
|
if 'busybox' in args.target:
|
||||||
run_ndk_build('B_BB=1')
|
run_ndk_build('B_BB=1')
|
||||||
|
@ -78,7 +78,6 @@ LOCAL_SRC_FILES := \
|
|||||||
init/twostage.cpp \
|
init/twostage.cpp \
|
||||||
init/selinux.cpp
|
init/selinux.cpp
|
||||||
|
|
||||||
LOCAL_LDFLAGS := -static
|
|
||||||
include $(BUILD_EXECUTABLE)
|
include $(BUILD_EXECUTABLE)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
@ -109,7 +108,6 @@ LOCAL_SRC_FILES := \
|
|||||||
boot/pattern.cpp \
|
boot/pattern.cpp \
|
||||||
boot/cpio.cpp
|
boot/cpio.cpp
|
||||||
|
|
||||||
LOCAL_LDFLAGS := -static
|
|
||||||
include $(BUILD_EXECUTABLE)
|
include $(BUILD_EXECUTABLE)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
@ -145,7 +143,6 @@ LOCAL_SRC_FILES := \
|
|||||||
resetprop/resetprop.cpp \
|
resetprop/resetprop.cpp \
|
||||||
|
|
||||||
LOCAL_CFLAGS := -DAPPLET_STUB_MAIN=resetprop_main
|
LOCAL_CFLAGS := -DAPPLET_STUB_MAIN=resetprop_main
|
||||||
LOCAL_LDFLAGS := -static
|
|
||||||
include $(BUILD_EXECUTABLE)
|
include $(BUILD_EXECUTABLE)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
@ -7,15 +7,10 @@ APP_PLATFORM := android-21
|
|||||||
APP_THIN_ARCHIVE := true
|
APP_THIN_ARCHIVE := true
|
||||||
APP_STRIP_MODE := --strip-all
|
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
|
# Busybox should use stock libc.a
|
||||||
ifdef B_BB
|
ifdef B_BB
|
||||||
APP_PLATFORM := android-24
|
APP_PLATFORM := android-24
|
||||||
|
APP_LDFLAGS += -T jni/lto_fix.lds
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
APP_SHORT_COMMANDS := true
|
APP_SHORT_COMMANDS := true
|
||||||
endif
|
endif
|
||||||
|
@ -18,10 +18,14 @@ LOCAL_SRC_FILES := \
|
|||||||
stream.cpp
|
stream.cpp
|
||||||
include $(BUILD_STATIC_LIBRARY)
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
|
|
||||||
# Workaround "hacky" libc.a missing symbols
|
# All static executables should link with libcompat
|
||||||
# To build Magisk with vanilla NDK, remove all usage of libcompat
|
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
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
|
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)
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user