0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2025-01-07 06:47:15 -05:00
This commit is contained in:
Divy Srivastava 2024-02-28 16:29:47 +05:30 committed by Ronny Chan
parent b0364c0c5e
commit 0fc46338c0
No known key found for this signature in database
GPG key ID: 438610BEA8DC2E2C
5 changed files with 54 additions and 0 deletions

View file

@ -62,6 +62,10 @@ jobs:
variant: release
cargo: cargo
- os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-24.04-xl' || 'ubuntu-24.04' }}
target: x86_64-unknown-linux-musl
variant: release
- os: ${{ github.repository == 'denoland/rusty_v8' && 'windows-2022-xxl' || 'windows-2022' }}
target: x86_64-pc-windows-msvc
variant: release # Note: we do not support windows debug builds.
@ -107,6 +111,10 @@ jobs:
if: startsWith(matrix.config.os, 'ubuntu')
run: |
sudo apt-get install -y glib2.0
- name: Install cross compilation toolchain (musl)
if: endsWith(matrix.config.target, '-musl')
run: rustup target add ${{ matrix.config.target }}
- name: Install cross compilation toolchain
if: matrix.config.target == 'aarch64-unknown-linux-gnu'

3
.gitmodules vendored
View file

@ -37,3 +37,6 @@
[submodule "third_party/fast_float/src"]
path = third_party/fast_float/src
url = https://chromium.googlesource.com/external/github.com/fastfloat/fast_float.git
[submodule "musl-cross-make"]
path = musl-cross-make
url = https://github.com/richfelker/musl-cross-make.git

View file

@ -190,9 +190,20 @@ fn build_v8(is_asan: bool) {
} else {
vec!["is_debug=false".to_string()]
};
if is_asan {
gn_args.push("is_asan=true".to_string());
}
if std::env::var("CARGO_CFG_TARGET_ENV").map_or(false, |e| e == "musl") {
build_musl_cross_make();
gn_args.push("use_custom_libcxx=true".to_string());
gn_args.push("is_clang=false".to_string());
gn_args.push("treat_warnings_as_errors=false".to_string());
gn_args.push("line_tables_only=false".to_string());
}
if env::var("CARGO_FEATURE_USE_CUSTOM_LIBCXX").is_err() {
gn_args.push("use_custom_libcxx=false".to_string());
}
@ -406,6 +417,30 @@ fn static_lib_name(suffix: &str) -> String {
}
}
fn build_musl_cross_make() {
let toolchain_dir = build_dir().join("musl-cross-make");
if toolchain_dir.exists() {
println!("musl-cross-make toolchain already exists, skipping build");
}
std::fs::copy("config.mak", "musl-cross-make/config.mak").unwrap();
Command::new("make")
.arg("-C")
.arg("musl-cross-make")
.arg("TARGET=x86_64-linux-musl")
.status()
.unwrap();
Command::new("make")
.arg("-C")
.arg("musl-cross-make")
.arg("TARGET=x86_64-linux-musl")
.arg("install")
.arg(format!("OUTPUT={}", toolchain_dir.display()))
.status()
.unwrap();
}
fn static_lib_url() -> String {
if let Ok(custom_archive) = env::var("RUSTY_V8_ARCHIVE") {
return custom_archive;

7
config.mak Normal file
View file

@ -0,0 +1,7 @@
MUSL_VER = 1.1.24
GCC_VER = 9.2.0
GCC_CONFIG += --enable-default-pie
DL_CMD = curl -C - -L -s -o
SHA1_CMD = shasum -a 1 -c

1
musl-cross-make Submodule

@ -0,0 +1 @@
Subproject commit 26bb55104559325b5e840911742220268f556d7a