Fix build all

This commit is contained in:
topjohnwu 2018-05-19 16:53:00 +08:00
parent c9ca42aaa9
commit be5be108c3

View File

@ -95,10 +95,15 @@ def collect_binary():
def build_binary(args): def build_binary(args):
# If nothing specified, build everything # If nothing specified, build everything
if len(args.target) == 0: try:
args.target = ['magisk', 'magiskinit', 'magiskboot', 'busybox', 'b64xz'] targets = args.target
except:
targets = []
header('* Building binaries: ' + ' '.join(args.target)) if len(targets) == 0:
targets = ['magisk', 'magiskinit', 'magiskboot', 'busybox', 'b64xz']
header('* Building binaries: ' + ' '.join(targets))
# Force update logging.h timestamp to trigger recompilation for the flags to make a difference # 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', 'include', 'logging.h'))
@ -107,7 +112,7 @@ def build_binary(args):
base_flags = 'MAGISK_VERSION=\"{}\" MAGISK_VER_CODE={} MAGISK_DEBUG={}'.format(config['version'], config['versionCode'], base_flags = 'MAGISK_VERSION=\"{}\" MAGISK_VER_CODE={} MAGISK_DEBUG={}'.format(config['version'], config['versionCode'],
'' if args.release else '-DMAGISK_DEBUG') '' if args.release else '-DMAGISK_DEBUG')
if 'magisk' in args.target: if 'magisk' in targets:
# Magisk is special case as it is a dependency of magiskinit # Magisk is special case as it is a dependency of magiskinit
proc = subprocess.run('{} -C native {} B_MAGISK=1 -j{}'.format(ndk_build, base_flags, cpu_count), shell=True) proc = subprocess.run('{} -C native {} B_MAGISK=1 -j{}'.format(ndk_build, base_flags, cpu_count), shell=True)
if proc.returncode != 0: if proc.returncode != 0:
@ -117,11 +122,11 @@ def build_binary(args):
old_platform = False old_platform = False
flags = base_flags flags = base_flags
if 'busybox' in args.target: if 'busybox' in targets:
flags += ' B_BB=1' flags += ' B_BB=1'
old_platform = True old_platform = True
if 'b64xz' in args.target: if 'b64xz' in targets:
flags += ' B_BXZ=1' flags += ' B_BXZ=1'
old_platform = True old_platform = True
@ -134,7 +139,7 @@ def build_binary(args):
other = False other = False
flags = base_flags flags = base_flags
if 'magiskinit' in args.target: if 'magiskinit' in targets:
# We need to create dump.h beforehand # We need to create dump.h beforehand
if not os.path.exists(os.path.join('native', 'out', 'armeabi-v7a', 'magisk')): if not os.path.exists(os.path.join('native', 'out', 'armeabi-v7a', 'magisk')):
error('Build "magisk" before building "magiskinit"') error('Build "magisk" before building "magiskinit"')
@ -148,7 +153,7 @@ def build_binary(args):
flags += ' B_INIT=1' flags += ' B_INIT=1'
other = True other = True
if 'magiskboot' in args.target: if 'magiskboot' in targets:
flags += ' B_BOOT=1' flags += ' B_BOOT=1'
other = True other = True