tweak rust

This commit is contained in:
Cody P Schafer
2014-11-26 11:26:53 -05:00
parent d91fa8700a
commit 0035ec3172
6 changed files with 110 additions and 9 deletions

View File

@@ -2,9 +2,17 @@ inherit rust
CARGO = "cargo"
# FIXME: this is a workaround for a misbehavior in cargo when used with quilt.
# See https://github.com/rust-lang/cargo/issues/978
PATCHTOOL = "patch"
# Cargo only supports in-tree builds at the moment
B = "${S}"
# In case something fails in the build process, give a bit more feedback on
# where the issue occured
export RUST_BACKTRACE = "1"
EXTRA_OECARGO_PATHS ??= ""
oe_cargo_config () {
@@ -18,8 +26,8 @@ oe_cargo_config () {
echo "paths = [" >.cargo/config
for p in ${EXTRA_OECARGO_PATHS}; do
printf "\"%s\" " "$p"
done | sed -e 's/[ \n]+/,/g' -e 's/,$//' >>.cargo/config
printf "\"%s\"\n" "$p"
done | sed -e 's/$/,/' >>.cargo/config
echo "]" >>.cargo/config
}

View File

@@ -45,9 +45,6 @@ do_configure () {
}
do_compile () {
echo "COMPILE ${PN}"
env
oe_runmake ARGS="--verbose"
}

View File

@@ -2,12 +2,19 @@ SRCREV_cargo = "f936f3543fd1d4f2101cd937a4f52ce9f9676eae"
require cargo.inc
SRC_URI += " \
git://github.com/carllerche/curl-rust.git;protocol=http;name=curl-rust;destsuffix=curl-rust \
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 \
file://curl-rust//0001-openssl-sys-is-used-in-curl-rust-so-include-it-expli.patch;patchdir=../curl-rust \
file://curl-rust/0001-openssl-sys-is-used-in-curl-rust-so-include-it-expli.patch;patchdir=../curl-rust \
\
git://github.com/alexcrichton/gcc-rs.git;protocol=https;name=gcc-rs;destsuffix=gcc-rs \
file://gcc-rs/0001-XXX-hacks.patch;patchdir=../gcc-rs \
"
SRCREV_curl-rust = "c1b96e146f6752353a1e84cca932c628e6bf73af"
SRCREV_FORMAT = "cargo_curl-rust"
EXTRA_OECARGO_PATHS = "${WORKDIR}/curl-rust"
SRCREV_gcc-rs = "903e8f8a2e3766ad3d514404d452dbaa1d3b2d79"
SRCREV_FORMAT = "cargo_curl-rust_gcc-rs"
EXTRA_OECARGO_PATHS = "\
${WORKDIR}/curl-rust \
${WORKDIR}/gcc-rs \
"

View File

@@ -0,0 +1,32 @@
From 66911257957f29ccf3a4386956977e97168200e7 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 25 Nov 2014 16:28:25 -0500
Subject: [PATCH] XXX: hacks
---
src/lib.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/lib.rs b/src/lib.rs
index de90de6..a388af3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -99,13 +99,14 @@ pub fn compile_library(output: &str, config: &Config, files: &[&str]) {
}
fn run(cmd: &mut Command) {
- println!("running: {}", cmd);
+ println!("running: '{}' : {}", cmd.program(), cmd);
assert!(cmd.stdout(InheritFd(1))
.stderr(InheritFd(2))
.status()
.unwrap()
.success());
+ println!("Run done");
}
fn gcc() -> String {
--
2.1.3

View File

@@ -0,0 +1,56 @@
From 2e75d7858baf8b00388f51928f2eab9395b67e49 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Wed, 26 Nov 2014 10:00:32 -0500
Subject: [PATCH] libstd/io/process/Command: fully quote and escape the command
and all args
---
src/libstd/io/process.rs | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs
index d4d24c1..0904928 100644
--- a/src/libstd/io/process.rs
+++ b/src/libstd/io/process.rs
@@ -383,14 +383,36 @@ impl Command {
}
}
+struct SingleQuotedStr<'a> {
+ s: &'a str
+}
+
+impl<'b> SingleQuotedStr<'b> {
+ fn new<'a>(i: &'a str) -> SingleQuotedStr<'a> {
+ SingleQuotedStr { s: i }
+ }
+}
+
+impl<'a> fmt::Show for SingleQuotedStr<'a> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ let mut elems = self.s.split('\'');
+ let fst = elems.next().unwrap_or("");
+ try!(write!(f, "'{}", fst));
+ for elem in elems {
+ try!(write!(f, "'\\''{}", elem));
+ }
+ write!(f, "'")
+ }
+}
+
impl fmt::Show for Command {
/// Format the program and arguments of a Command for display. Any
/// non-utf8 data is lossily converted using the utf8 replacement
/// character.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- try!(write!(f, "{}", String::from_utf8_lossy(self.program.as_bytes_no_nul())));
+ try!(write!(f, "{}", SingleQuotedStr::new(String::from_utf8_lossy(self.program.as_bytes_no_nul()).as_slice())));
for arg in self.args.iter() {
- try!(write!(f, " '{}'", String::from_utf8_lossy(arg.as_bytes_no_nul())));
+ try!(write!(f, " {}", SingleQuotedStr::new(String::from_utf8_lossy(arg.as_bytes_no_nul()).as_slice())));
}
Ok(())
}
--
2.1.3

View File

@@ -11,4 +11,5 @@ SRC_URI_append = "\
file://0007-XXX-remove-conflicting-realpath-hack.patch \
file://0008-XXX-configure-unneeded-windows-check.patch \
file://0009-Parallelize-submake-invocations.patch \
file://0001-libstd-io-process-Command-fully-quote-and-escape-the.patch \
"