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 a XBUILD_SYSROOT_PATH environment variable to override sysroot path #33

Merged
merged 1 commit into from
May 31, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]

- Error when sysroot contains spaces ([#32](https://github.com/rust-osdev/cargo-xbuild/pull/32))
- Allow overriding the sysroot path through a `XBUILD_SYSROOT_PATH` environment variable ([#33](https://github.com/rust-osdev/cargo-xbuild/pull/33))

## [v0.5.9] - 2019-05-24

Expand Down
6 changes: 5 additions & 1 deletion src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ impl Rustflags {

/// Stringifies these flags for Xargo consumption
pub fn for_xargo(&self, home: &Home) -> Result<String> {
let sysroot = format!("{}", home.display());
let sysroot = if let Ok(path) = env::var("XBUILD_SYSROOT_PATH") {
path
} else {
format!("{}", home.display())
};
if env::var_os("XBUILD_ALLOW_SYSROOT_SPACES").is_none() && sysroot.contains(" ") {
return Err(format!("Sysroot must not contain spaces!\n\
See issue https://github.com/rust-lang/cargo/issues/6139\n\n\
Expand Down