mirror of
https://github.com/denoland/rusty_v8.git
synced 2025-01-11 08:34:01 -05:00
Make it build on windows (#5)
This commit is contained in:
parent
0463a8bbfb
commit
7dbde4e6fb
3 changed files with 61 additions and 6 deletions
8
.gitattributes
vendored
Normal file
8
.gitattributes
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
build symlink=dir
|
||||
buildtools symlink=dir
|
||||
build_overrides symlink=dir
|
||||
testing symlink=dir
|
||||
third_party/googletest symlink=dir
|
||||
third_party/jinja2 symlink=dir
|
||||
third_party/llvm-build symlink=dir
|
||||
third_party/markupsafe symlink=dir
|
20
.github/workflows/ci.yml
vendored
20
.github/workflows/ci.yml
vendored
|
@ -9,7 +9,7 @@ jobs:
|
|||
timeout-minutes: 60
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macOS-10.14, ubuntu-16.04] # TODO(ry) windows-2019
|
||||
os: [macOS-10.14, ubuntu-16.04, windows-2019]
|
||||
steps:
|
||||
- name: Configure git
|
||||
run: git config --global core.symlinks true
|
||||
|
@ -30,6 +30,20 @@ jobs:
|
|||
with:
|
||||
python-version: "2.7.16"
|
||||
|
||||
- name: Remove unused versions of Python
|
||||
# Depot_tools bootstraps its own copy of virtualenv. This fails on
|
||||
# windows when multiple versions of python are in present in PATH,
|
||||
# so we remove all but the first one.
|
||||
# 🤯 Removing items from PATH does not seem possible on Github Actions,
|
||||
# not even by using `echo ::set-env name=PATH`, so we have to rename
|
||||
# or delete the actual Python directories.
|
||||
if: startsWith(matrix.os, 'windows')
|
||||
run: |-
|
||||
$env:PATH -split ";" |
|
||||
Where-Object { Test-Path "$_\python.exe" } |
|
||||
Select-Object -Skip 1 |
|
||||
ForEach-Object { Move-Item "$_" "$_.disabled" }
|
||||
|
||||
- name: Environment (common)
|
||||
run: |
|
||||
echo ::set-env name=GH_ACTIONS::1
|
||||
|
@ -59,13 +73,9 @@ jobs:
|
|||
- name: Environment (windows)
|
||||
if: startsWith(matrix.os, 'windows')
|
||||
run: |
|
||||
# These appear unnecessary:
|
||||
#choco install curl
|
||||
#choco install archive
|
||||
curl -LO https://github.com/mozilla/sccache/releases/download/0.2.12/sccache-0.2.12-x86_64-pc-windows-msvc.tar.gz
|
||||
tar -zxvf sccache-0.2.12-x86_64-pc-windows-msvc.tar.gz
|
||||
echo ::add-path::$(pwd)\sccache-0.2.12-x86_64-pc-windows-msvc\
|
||||
echo ::add-path::$(pwd)\third_party\depot_tools\
|
||||
|
||||
- name: Start sccache
|
||||
env:
|
||||
|
|
39
build.rs
39
build.rs
|
@ -7,13 +7,17 @@ use std::process::Command;
|
|||
use which::which;
|
||||
|
||||
fn main() {
|
||||
if cfg!(windows) {
|
||||
init_depot_tools_windows();
|
||||
}
|
||||
if !Path::new("third_party/v8/src").is_dir()
|
||||
|| env::var_os("GCLIENT_SYNC").is_some()
|
||||
{
|
||||
gclient_sync();
|
||||
}
|
||||
|
||||
let mut gn_args = if cargo_gn::is_debug() {
|
||||
// On windows, rustc cannot link with a V8 debug build.
|
||||
let mut gn_args = if cargo_gn::is_debug() && !cfg!(target_os = "windows") {
|
||||
vec!["is_debug=true".to_string()]
|
||||
} else {
|
||||
vec!["is_debug=false".to_string()]
|
||||
|
@ -46,6 +50,39 @@ fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
fn init_depot_tools_windows() {
|
||||
let depot_tools = env::current_dir()
|
||||
.unwrap()
|
||||
.join("third_party")
|
||||
.join("depot_tools");
|
||||
// Bootstrap depot_tools.
|
||||
if !depot_tools.join("git.bat").is_file() {
|
||||
let status = Command::new("cmd.exe")
|
||||
.arg("/c")
|
||||
.arg("bootstrap\\win_tools.bat")
|
||||
.current_dir(&depot_tools)
|
||||
.status()
|
||||
.expect("bootstrapping depot_tools failed");
|
||||
assert!(status.success());
|
||||
}
|
||||
// Add third_party/depot_tools and buildtools/win to PATH.
|
||||
// TODO: this should be done on all platforms.
|
||||
// TODO: buildtools/win should not be added; instead, cargo_gn should invoke
|
||||
// depot_tools/gn.bat.
|
||||
let buildtools_win =
|
||||
env::current_dir().unwrap().join("buildtools").join("win");
|
||||
// Bootstrap depot_tools.
|
||||
let path = env::var_os("PATH").unwrap();
|
||||
let paths = vec![depot_tools, buildtools_win]
|
||||
.into_iter()
|
||||
.chain(env::split_paths(&path))
|
||||
.collect::<Vec<_>>();
|
||||
let path = env::join_paths(paths).unwrap();
|
||||
env::set_var("PATH", &path);
|
||||
// TODO: cargo_gn should do this.
|
||||
env::set_var("DEPOT_TOOLS_WIN_TOOLCHAIN", "0");
|
||||
}
|
||||
|
||||
fn git_submodule_update() {
|
||||
Command::new("git")
|
||||
.arg("submodule")
|
||||
|
|
Loading…
Reference in a new issue