Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add env var for specifying custom BDWGC path #108

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions library/boehm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use std::process::Command;

const BOEHM_REPO: &str = "https://github.com/softdevteam/bdwgc.git";
const BOEHM_ATOMICS_REPO: &str = "https://github.com/ivmai/libatomic_ops.git";
const BOEHM_DIR: &str = "bdwgc";
const BUILD_DIR: &str = "lib";
const BOEHM_DEFAULT_SRC_DIR: &str = "bdwgc";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consistently call this BDWGC (including the env var etc)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so really yeah. I'll push an update.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this PR is really just a bunch of miscellaneous fixes, I've decided to go ahead and fix this across the entire codebase: 6cfff56

const BOEHM_BUILD_DIR: &str = "lib";

#[cfg(not(all(target_pointer_width = "64", target_arch = "x86_64")))]
compile_error!("Requires x86_64 with 64 bit pointer width.");
Expand All @@ -25,11 +25,16 @@ where
fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let mut boehm_src = PathBuf::from(&out_dir);
boehm_src.push(BOEHM_DIR);

match env::var("BOEHM") {
Ok(path) => boehm_src.push(path),
Err(_) => boehm_src.push(BOEHM_DEFAULT_SRC_DIR),
}

let mut build_dir = PathBuf::from(&out_dir);
build_dir.push(BUILD_DIR);
build_dir.push(BOEHM_BUILD_DIR);

if !boehm_src.exists() {
if !boehm_src.exists() && env::var("BOEHM").is_err() {
run("git", |cmd| cmd.arg("clone").arg(BOEHM_REPO).arg(&boehm_src));
run("git", |cmd| cmd.arg("clone").arg(BOEHM_ATOMICS_REPO).current_dir(&boehm_src));
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/runtime/gc/thread_local.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ignore-test
// run-pass
// ignore-tidy-linelength
// no-prefer-dynamic
#![feature(allocator_api)]
Expand Down