mirror of
https://github.com/denoland/deno
synced 2024-08-27 12:00:17 +00:00
Add basic Arm64 build to CI (#1887)
This commit is contained in:
parent
aed3e590ba
commit
8c7a12d1b2
29
.travis.yml
29
.travis.yml
|
@ -77,7 +77,7 @@ script:
|
|||
jobs:
|
||||
fast_finish: true
|
||||
include:
|
||||
- name: "gn release mac"
|
||||
- name: "gn release mac x86_64"
|
||||
os: osx
|
||||
after_success:
|
||||
- &gzip_release
|
||||
|
@ -93,7 +93,7 @@ jobs:
|
|||
repo: denoland/deno
|
||||
skip-cleanup: true
|
||||
|
||||
- name: "gn release linux"
|
||||
- name: "gn release linux x86_64"
|
||||
os: linux
|
||||
after_success:
|
||||
- *gzip_release
|
||||
|
@ -109,12 +109,33 @@ jobs:
|
|||
branch: master
|
||||
repo: denoland/deno
|
||||
skip-cleanup: true
|
||||
|
||||
- name: "cargo release linux arm64"
|
||||
os: linux
|
||||
dist: xenial
|
||||
script:
|
||||
- rustup target add aarch64-unknown-linux-gnu
|
||||
- sudo apt update
|
||||
- |-
|
||||
sudo apt -yq --no-install-suggests --no-install-recommends install \
|
||||
g++-5-aarch64-linux-gnu gcc-5-aarch64-linux-gnu g++-5-multilib \
|
||||
libc6-arm64-cross
|
||||
- build/linux/sysroot_scripts/install-sysroot.py --arch=arm64
|
||||
- export DENO_BUILD_ARGS="target_cpu=\"arm64\" v8_target_cpu=\"arm64\""
|
||||
- export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER="/usr/bin/aarch64-linux-gnu-gcc-5"
|
||||
- export CC_aarch64_unknown_linux_gnu="/usr/bin/aarch64-linux-gnu-gcc-5"
|
||||
- cargo build -vv --target=aarch64-unknown-linux-gnu --release --locked
|
||||
- cargo build -vv --target=aarch64-unknown-linux-gnu --release --tests --locked
|
||||
- sudo apt -yq install qemu qemu-user binfmt-support qemu-user-binfmt
|
||||
- sudo ln -s /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 /lib/ld-linux-aarch64.so.1
|
||||
- export QEMU_LD_PREFIX=/usr/aarch64-linux-gnu
|
||||
- $CARGO_TARGET_DIR/aarch64-unknown-linux-gnu/release/deno tests/002_hello.ts
|
||||
# - DENO_BUILD_MODE=release ./tools/test.py $CARGO_TARGET_DIR/aarch64-unknown-linux-gnu/release TODO(afinch7): Get the tests working
|
||||
|
||||
- name: "cargo release linux"
|
||||
- name: "cargo release linux x86_64"
|
||||
os: linux
|
||||
script:
|
||||
- cargo build -vv --release --locked
|
||||
|
||||
# LSAN: We are in the process of getting a completely clean LSAN build,
|
||||
# but it will take some work. So for now we just run a subset of the
|
||||
# tests. We want to detect leaks during the build process as well as
|
||||
|
|
13
BUILD.gn
13
BUILD.gn
|
@ -135,6 +135,19 @@ group("deno_deps") {
|
|||
]
|
||||
}
|
||||
|
||||
# Optimized dependencies for cross compiled builds.
|
||||
# This can be removed once we get snapshots into cross compiled builds.
|
||||
group("deno_deps_cross") {
|
||||
testonly = true
|
||||
deps = [
|
||||
":compiler_bundle",
|
||||
":main_bundle",
|
||||
":msg_rs",
|
||||
"libdeno:libdeno_static_lib",
|
||||
"libdeno:test_cc",
|
||||
]
|
||||
}
|
||||
|
||||
# Reads the cargo info from Cargo.toml
|
||||
deno_cargo_info = exec_script("build_extra/rust/get_cargo_info.py",
|
||||
[ rebase_path("Cargo.toml", root_build_dir) ],
|
||||
|
|
50
build.rs
50
build.rs
|
@ -20,8 +20,33 @@ fn main() {
|
|||
env::var("PROFILE").unwrap()
|
||||
};
|
||||
|
||||
// Equivalent to target arch != host arch
|
||||
let is_different_target_arch =
|
||||
env::var("CARGO_CFG_TARGET_ARCH").unwrap().as_str() != env::var("HOST")
|
||||
.unwrap()
|
||||
.as_str()
|
||||
.split("-")
|
||||
.collect::<Vec<&str>>()[0];
|
||||
|
||||
// If we are using the same target as the host's default
|
||||
// "rustup target list" should show your default target
|
||||
let is_default_target =
|
||||
env::var("TARGET").unwrap() == env::var("HOST").unwrap();
|
||||
|
||||
let cwd = env::current_dir().unwrap();
|
||||
let gn_out_path = cwd.join(format!("target/{}", gn_mode));
|
||||
// If not using host default target the output folder will change
|
||||
// target/release will become target/$TARGET/release
|
||||
// Gn should also be using this output directory as well
|
||||
// most things will work with gn using the default
|
||||
// output directory but some tests depend on artifacts
|
||||
// being in a specific directory relative to the main build output
|
||||
let gn_out_path = cwd.join(format!(
|
||||
"target/{}",
|
||||
match is_default_target {
|
||||
true => gn_mode.clone(),
|
||||
false => format!("{}/{}", env::var("TARGET").unwrap(), gn_mode.clone()),
|
||||
}
|
||||
));
|
||||
let gn_out_dir = normalize_path(&gn_out_path);
|
||||
|
||||
// Tell Cargo when to re-run this file. We do this first, so these directives
|
||||
|
@ -56,8 +81,11 @@ fn main() {
|
|||
println!("cargo:rustc-cfg=feature=\"check-only\"");
|
||||
} else {
|
||||
// "Full" (non-RLS) build.
|
||||
gn_target = "deno_deps";
|
||||
|
||||
if is_different_target_arch {
|
||||
gn_target = "deno_deps_cross";
|
||||
} else {
|
||||
gn_target = "deno_deps";
|
||||
}
|
||||
// Link with libdeno.a/.lib, which includes V8.
|
||||
println!("cargo:rustc-link-search=native={}/obj/libdeno", gn_out_dir);
|
||||
if cfg!(target_os = "windows") {
|
||||
|
@ -76,13 +104,15 @@ fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
// If target_arch != host_arch disable snapshots since we are cross compiling.
|
||||
if env::var("CARGO_CFG_TARGET_ARCH").unwrap().as_str() != env::var("HOST")
|
||||
.unwrap()
|
||||
.as_str()
|
||||
.split("-")
|
||||
.collect::<Vec<&str>>()[0]
|
||||
{
|
||||
// If target_arch != host_arch disable snapshots.
|
||||
// v8 snapshots seem to not be compatible with binaries
|
||||
// other than the ones used to gernerate them,
|
||||
// so for non native architecture builds we don't
|
||||
// have an easy way to generate these snapshots.
|
||||
// We can't run any binary capable of generating
|
||||
// compatible snapshots without emulating the
|
||||
// target architecture.
|
||||
if is_different_target_arch {
|
||||
// no-snapshot-init is not related to v8_use_snapshots
|
||||
println!("cargo:rustc-cfg=feature=\"no-snapshot-init\"");
|
||||
}
|
||||
|
|
|
@ -29,10 +29,10 @@ pub fn deno_isolate_init() -> IsolateInit {
|
|||
}
|
||||
} else {
|
||||
debug!("Deno isolate init with snapshots.");
|
||||
#[cfg(not(feature = "check-only"))]
|
||||
#[cfg(not(any(feature = "check-only", feature = "no-snapshot-init")))]
|
||||
let data =
|
||||
include_bytes!(concat!(env!("GN_OUT_DIR"), "/gen/snapshot_deno.bin"));
|
||||
#[cfg(feature = "check-only")]
|
||||
#[cfg(any(feature = "check-only", feature = "no-snapshot-init"))]
|
||||
let data = vec![];
|
||||
|
||||
unsafe {
|
||||
|
@ -62,10 +62,10 @@ pub fn compiler_isolate_init() -> IsolateInit {
|
|||
}
|
||||
} else {
|
||||
debug!("Deno isolate init with snapshots.");
|
||||
#[cfg(not(feature = "check-only"))]
|
||||
#[cfg(not(any(feature = "check-only", feature = "no-snapshot-init")))]
|
||||
let data =
|
||||
include_bytes!(concat!(env!("GN_OUT_DIR"), "/gen/snapshot_compiler.bin"));
|
||||
#[cfg(feature = "check-only")]
|
||||
#[cfg(any(feature = "check-only", feature = "no-snapshot-init"))]
|
||||
let data = vec![];
|
||||
|
||||
unsafe {
|
||||
|
|
Loading…
Reference in a new issue