0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-11-24 15:19:31 -05:00

feat(build): allow native compilation on non-amd64 (#514)

This commit is contained in:
liushuyu 2020-10-31 06:32:33 -06:00 committed by GitHub
parent 315e9a83e0
commit f2f5d86af8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 7 deletions

View file

@ -1,4 +1,5 @@
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. # Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import("//build/config/host_byteorder.gni")
static_library("rusty_v8") { static_library("rusty_v8") {
complete_static_lib = true complete_static_lib = true
@ -18,7 +19,7 @@ static_library("rusty_v8") {
} }
config("rusty_v8_config") { config("rusty_v8_config") {
configs = [ "//v8:external_config" ] configs = [ "//v8:external_config", "//v8:toolchain", "//v8:features" ]
cflags = [] cflags = []
# We need these directories in the search path to be able to include some # We need these directories in the search path to be able to include some

View file

@ -96,12 +96,17 @@ fn build_v8() {
} }
} }
if env::var("TARGET").unwrap() == "aarch64-unknown-linux-gnu" { let target_triple = env::var("TARGET").unwrap();
// check if the target triple describes a non-native environment
if target_triple != env::var("HOST").unwrap() {
// cross-compilation setup
if target_triple == "aarch64-unknown-linux-gnu" {
gn_args.push(r#"target_cpu="arm64""#.to_string()); gn_args.push(r#"target_cpu="arm64""#.to_string());
gn_args.push("use_sysroot=true".to_string()); gn_args.push("use_sysroot=true".to_string());
maybe_install_sysroot("arm64"); maybe_install_sysroot("arm64");
maybe_install_sysroot("amd64"); maybe_install_sysroot("amd64");
}; };
}
let gn_root = env::var("CARGO_MANIFEST_DIR").unwrap(); let gn_root = env::var("CARGO_MANIFEST_DIR").unwrap();