From 33cc13302f0c435dcd7c33578bf722cdbef779b3 Mon Sep 17 00:00:00 2001 From: Arthur Silva Date: Fri, 11 Mar 2022 17:14:01 +0100 Subject: [PATCH 1/4] Use ubuntu 20 in fork --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6374e32b4b..0abf691428 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,12 +31,12 @@ jobs: variant: release cargo: cargo - - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-18.04' }} + - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-20.04' }} target: x86_64-unknown-linux-gnu variant: debug cargo: cargo - - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-18.04' }} + - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-20.04' }} target: x86_64-unknown-linux-gnu variant: release cargo: cargo @@ -46,17 +46,17 @@ jobs: variant: release # Note: we do not support windows debug builds. cargo: cargo - - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-18.04' }} + - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-20.04' }} target: aarch64-unknown-linux-gnu variant: debug cargo: cargo - - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-18.04' }} + - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-20.04' }} target: aarch64-unknown-linux-gnu variant: release cargo: cargo - - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-18.04' }} + - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-20.04' }} target: aarch64-linux-android variant: release # Note: v8 debug builds on QEMU is buggy. cargo: cross From 8eb45dc942c207d33febf1f79d6e173052d0de29 Mon Sep 17 00:00:00 2001 From: Arthur Silva Date: Fri, 11 Mar 2022 17:26:56 +0100 Subject: [PATCH 2/4] Publish binaries in getditto fork --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0abf691428..ddf70c610d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -203,7 +203,7 @@ jobs: # https://github.com/softprops/action-gh-release/issues/139 uses: softprops/action-gh-release@59c3b4891632ff9a897f99a91d7bc557467a3a22 if: >- - github.repository == 'denoland/rusty_v8' && + github.repository == 'getditto/rusty_v8' && startsWith(github.ref, 'refs/tags/') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 1758f709b72cb415cbfb1feb725849c4faf2d1d2 Mon Sep 17 00:00:00 2001 From: Arthur Silva Date: Mon, 14 Mar 2022 10:26:02 +0100 Subject: [PATCH 3/4] Disable windows and aarch64 builds --- .github/workflows/ci.yml | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ddf70c610d..3cdfa4b638 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,25 +41,25 @@ jobs: variant: release cargo: cargo - - os: windows-2019 - target: x86_64-pc-windows-msvc - variant: release # Note: we do not support windows debug builds. - cargo: cargo - - - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-20.04' }} - target: aarch64-unknown-linux-gnu - variant: debug - cargo: cargo - - - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-20.04' }} - target: aarch64-unknown-linux-gnu - variant: release - cargo: cargo - - - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-20.04' }} - target: aarch64-linux-android - variant: release # Note: v8 debug builds on QEMU is buggy. - cargo: cross + # - os: windows-2019 + # target: x86_64-pc-windows-msvc + # variant: release # Note: we do not support windows debug builds. + # cargo: cargo + + # - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-20.04' }} + # target: aarch64-unknown-linux-gnu + # variant: debug + # cargo: cargo + + # - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-20.04' }} + # target: aarch64-unknown-linux-gnu + # variant: release + # cargo: cargo + + # - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-20.04' }} + # target: aarch64-linux-android + # variant: release # Note: v8 debug builds on QEMU is buggy. + # cargo: cross env: V8_FROM_SOURCE: true @@ -182,7 +182,7 @@ jobs: env: SCCACHE_IDLE_TIMEOUT: 0 run: - ${{ matrix.config.cargo }} test -vv --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }} + ${{ matrix.config.cargo }} test --no-default-features -vv --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }} --target ${{ matrix.config.target }} - name: Clippy From 262ce4076bec0cbad5b3d5cf72e228888fd3e166 Mon Sep 17 00:00:00 2001 From: Arthur Silva Date: Thu, 10 Mar 2022 16:52:48 +0100 Subject: [PATCH 4/4] Add feature flag for not using custom libcxx and link the system libcxx instead --- Cargo.toml | 4 ++++ build.rs | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 4b5316bed2..ab4f047e39 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,6 +75,10 @@ exclude = [ "!v8/tools/testrunner/utils/dump_build_config.py", ] +[features] +default = ["use_custom_libcxx"] +use_custom_libcxx = [] + [dependencies] lazy_static = "1.4.0" libc = "0.2.93" diff --git a/build.rs b/build.rs index 19bcf30e07..7cc1013e57 100644 --- a/build.rs +++ b/build.rs @@ -12,6 +12,7 @@ use which::which; fn main() { println!("cargo:rerun-if-changed=src/binding.cc"); + println!("cargo:rerun-if-changed=build.rs"); // These are all the environment variables that we check. This is // probably more than what is needed, but missing an important @@ -109,6 +110,10 @@ fn build_v8() { vec!["is_debug=false".to_string()] }; + if cfg!(not(feature = "use_custom_libcxx")) { + gn_args.push("use_custom_libcxx=false".to_string()); + } + if !is_debug() { gn_args.push("v8_enable_handle_zapping=false".to_string()); } @@ -398,6 +403,25 @@ fn download_static_lib_binaries() { fn print_link_flags() { println!("cargo:rustc-link-lib=static=rusty_v8"); + let should_dyn_link_libcxx = cfg!(not(feature = "use_custom_libcxx")) + || env::var("GN_ARGS").map_or(false, |gn_args| { + gn_args + .split_whitespace() + .any(|ba| ba == "use_custom_libcxx=false") + }); + + if should_dyn_link_libcxx { + let target = env::var("TARGET").unwrap(); + if target.contains("apple") + || target.contains("freebsd") + || target.contains("openbsd") + { + println!("cargo:rustc-link-lib=dylib=c++"); + } else if target.contains("linux") { + println!("cargo:rustc-link-lib=dylib=stdc++"); + } + } + if cfg!(target_os = "windows") { println!("cargo:rustc-link-lib=dylib=winmm"); println!("cargo:rustc-link-lib=dylib=dbghelp");