new cargo + fix

This commit is contained in:
Cody P Schafer
2014-12-05 01:56:57 -05:00
parent 3badeb4b5e
commit ba0a6ea3de
3 changed files with 28 additions and 55 deletions
@@ -1,8 +1,8 @@
SRCREV_cargo = "a0f0abca4f718e36ddc7cc23f9bce4c51d93cbe5"
SRCREV_cargo = "70f5205dba9887d8dab07f72dbc507aa74b12c1f"
require cargo.inc
SRC_URI += " \
file://0001-custom_build-add-the-HOST-environment-variable.patch \
file:///0001-custom_build-build-output-goes-in-the-directory-for-.patch \
\
git://github.com/carllerche/curl-rust.git;protocol=https;name=curl-rust;destsuffix=curl-rust \
file://curl-rust/0001-curl-sys-avoid-explicitly-linking-in-openssl-If-it-.patch;patchdir=../curl-rust \
@@ -1,53 +0,0 @@
From 41de2918fa69fa7e48bcfe7b3e68974befb0d5e6 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Wed, 3 Dec 2014 13:09:46 -0500
Subject: [PATCH] custom_build: add the HOST environment variable
---
src/cargo/ops/cargo_rustc/custom_build.rs | 3 ++-
src/doc/build-script.md | 1 +
tests/test_cargo_compile_custom_build.rs | 2 ++
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/cargo/ops/cargo_rustc/custom_build.rs b/src/cargo/ops/cargo_rustc/custom_build.rs
index 6791e66..07ccbaf 100644
--- a/src/cargo/ops/cargo_rustc/custom_build.rs
+++ b/src/cargo/ops/cargo_rustc/custom_build.rs
@@ -61,7 +61,8 @@ pub fn prepare(pkg: &Package, target: &Target, req: Platform,
}))
.env("DEBUG", Some(profile.get_debug().to_string()))
.env("OPT_LEVEL", Some(profile.get_opt_level().to_string()))
- .env("PROFILE", Some(profile.get_env()));
+ .env("PROFILE", Some(profile.get_env()))
+ .env("HOST", Some(cx.config.rustc_host()));
// Be sure to pass along all enabled features for this package, this is the
// last piece of statically known information that we have.
diff --git a/src/doc/build-script.md b/src/doc/build-script.md
index f5ece41..3a3f0ea 100644
--- a/src/doc/build-script.md
+++ b/src/doc/build-script.md
@@ -43,6 +43,7 @@ all passed in the form of environment variables:
* `TARGET` - the target triple that is being compiled for. Native code should be
compiled for this triple. Some more information about target
triples can be found in [clang's own documentation][clang].
+* `HOST` - the host triple of the rust compiler.
* `NUM_JOBS` - the parallelism specified as the top-level parallelism. This can
be useful to pass a `-j` parameter to a system like `make`.
* `CARGO_MANIFEST_DIR` - The directory containing the manifest for the package
diff --git a/tests/test_cargo_compile_custom_build.rs b/tests/test_cargo_compile_custom_build.rs
index 9ea71f0..aef3c77 100644
--- a/tests/test_cargo_compile_custom_build.rs
+++ b/tests/test_cargo_compile_custom_build.rs
@@ -99,6 +99,8 @@ test!(custom_build_env_vars {
assert!(out.as_slice().starts_with(r"{0}"));
assert!(Path::new(out).is_dir());
+ let _host = os::getenv("HOST").unwrap();
+
let _feat = os::getenv("CARGO_FEATURE_FOO").unwrap();
}}
"#,
--
2.1.3
@@ -0,0 +1,26 @@
From 9b4cbb5a0faaa8fac85e8703ab67cac26cb7f99d Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Fri, 5 Dec 2014 01:54:33 -0500
Subject: [PATCH] custom_build: build output goes in the directory for the req,
not hard coded to Target
---
src/cargo/ops/cargo_rustc/custom_build.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cargo/ops/cargo_rustc/custom_build.rs b/src/cargo/ops/cargo_rustc/custom_build.rs
index 07ccbaf..ed03074 100644
--- a/src/cargo/ops/cargo_rustc/custom_build.rs
+++ b/src/cargo/ops/cargo_rustc/custom_build.rs
@@ -39,7 +39,7 @@ pub fn prepare(pkg: &Package, target: &Target, req: Platform,
let kind = match req { Platform::Plugin => Kind::Host, _ => Kind::Target, };
let (script_output, build_output) = {
(cx.layout(pkg, Kind::Host).build(pkg),
- cx.layout(pkg, Kind::Target).build_out(pkg))
+ cx.layout(pkg, kind).build_out(pkg))
};
// Building the command to execute
--
2.0.4