Proper build scripts

This commit is contained in:
topjohnwu 2022-07-24 05:39:14 -07:00
parent b9e89a1a2d
commit a7ab8216ce
2 changed files with 11 additions and 2 deletions

View File

@ -231,10 +231,11 @@ def run_cargo_build(args):
env['CARGO_BUILD_RUSTC'] = op.join(rust_bin, 'rustc' + EXE_EXT)
# Install cxxbridge and generate C++ bindings
native_out = op.join('..', '..', 'native', 'out')
native_out = op.join('..', 'out')
cxx_src = op.join('external', 'cxx-rs', 'gen', 'cmd')
local_cargo_root = op.join(native_out, '.cargo')
mkdir_p(local_cargo_root)
cmds = [cargo, 'install', '--root', local_cargo_root, 'cxxbridge-cmd']
cmds = [cargo, 'install', '--root', local_cargo_root, '--path', cxx_src]
if not args.verbose:
cmds.append('-q')
proc = execv(cmds, env)

View File

@ -4,22 +4,30 @@ LOCAL_PATH := $(call my-dir)
# Rust compilation outputs
###########################
ifdef B_MAGISK
include $(CLEAR_VARS)
LOCAL_MODULE := magisk-rs
LOCAL_SRC_FILES := ../out/$(TARGET_ARCH_ABI)/libmagisk-rs.a
include $(PREBUILT_STATIC_LIBRARY)
endif
ifdef B_BOOT
include $(CLEAR_VARS)
LOCAL_MODULE := boot-rs
LOCAL_SRC_FILES := ../out/$(TARGET_ARCH_ABI)/libmagiskboot-rs.a
include $(PREBUILT_STATIC_LIBRARY)
endif
ifdef B_INIT
include $(CLEAR_VARS)
LOCAL_MODULE := init-rs
LOCAL_SRC_FILES := ../out/$(TARGET_ARCH_ABI)/libmagiskinit-rs.a
include $(PREBUILT_STATIC_LIBRARY)
endif
ifdef B_POLICY
include $(CLEAR_VARS)
LOCAL_MODULE := policy-rs
LOCAL_SRC_FILES := ../out/$(TARGET_ARCH_ABI)/libmagiskpolicy-rs.a
include $(PREBUILT_STATIC_LIBRARY)
endif