What I've done
Fixed incorrect use of cfg! macro use the CARGO_CFG_TARGET_<OS/ARCH> macro instead of the original cfg! (target_<os/arch>) This is because The build script is compiled for the host architecture as a separate build phase, as that's where it runs. Since the cfg macro runs at compile time it'll always report the host configuration there.When cargo runs the build script it passes the configuration through environment variables, one of which is CARGO_CFG_TARGET_ARCH. Some dicussions can be found here
update build.rs to support arm target support arm target. Like the Aarch64 target, we need to additionally install the cross-compilation toolchain and specify the linker in Cargo/config.toml. I can add this part of the work in next pull request if necessary.
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
By default, copying a file will preserve its mode and ownership
attributes.
This is an issue when copying the V8 archive from a read-only
filesystem since the archive file also becomes read-only, so
subsequent builds will fail.
We now create a new destination file and copy the content of the archive
to it, this ensures the destination file has the default attributes.
We may build rusty_v8 on platforms other than the common ones (for
example, linux/riscv64), though they are not officially supported and
prebuilt binaries are not available. This patch adds several
environment variables:
- `DISABLE_CLANG`: use `is_clang=false` and disables Clang-specific
options for building with GCC, etc.
- `EXTRA_GN_ARGS`: allow to pass extra GN arguments, such as custom
toolchain
- `NO_PRINT_GN_ARGS`: Disables printing GN arguments to stdout. GN
currently segfaults on riscv64 when printing arguments. Since it is
trivial, we can have an option to simply disable it.
Also added fallback `arch` and `os` declaration in `platform()` to
remove compile-time error.
Ninja and GN are upgraded to the version specified in V8's `DEPS` file
as of V8 11.0.226.2.
As part of this upgrade, native binaries for linux-arm64 and mac-arm64
were added to the repository, and some directories were renamed to make
the overall naming scheme more consistent.
Ensure allocation of typed arrays and arraybuffers always goes through
the embedder's ArrayBufferAllocator, otherwise small buffers get moved
around by the garbage collector but embedders normally want them to have
fixed addresses.
- remove friendly build script output in favor of brevity
- Revert "Add support for generating a `clangd` compilation database (#823)"
- simplify subprocess invocations
This avoids constant rebuilds when alternating between running
$ cargo build
$ cargo run <something that runs cargo build>
Since the second command will see these environment variables set
during the logic deciding if build.rs should be rerun or not.
Since these are cargo specific variables, hopefully cargo already does
the right thing without our help.
In addition to the problem described in issue #378, we noticed link
error when updating rusty_v8 without doing a clean build. As far as I
can tell, there were two potential bugs:
* Cargo not being informed that it should run build.rs when
CARGO_PKG_VERSION changed.
* Even if build.rs was rerun, it would not download a new package. It
seems that build.rs should either verify that the right package was
downloaded or should just trust cargo to not rerun it when not
needed.
Fixes: #378