update cargo

This commit is contained in:
Cody P Schafer
2014-12-08 20:36:06 -05:00
parent b2af286be8
commit 771f5f3fd3
7 changed files with 43 additions and 134 deletions
+1
View File
@@ -1,2 +1,3 @@
require libgit2.inc
S = "${WORKDIR}/git"
SRC_URI = "git://github.com/libgit2/libgit2.git;protocol=https"
-26
View File
@@ -1,26 +0,0 @@
SRCREV_cargo = "70f5205dba9887d8dab07f72dbc507aa74b12c1f"
require cargo.inc
SRC_URI += " \
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 \
file://curl-rust/0001-openssl-sys-is-used-in-curl-rust-so-include-it-expli.patch;patchdir=../curl-rust \
\
git://github.com/alexcrichton/ssh2-rs.git;protocol=https;name=ssh2-rs;destsuffix=ssh2-rs \
file://ssh2-rs/0001-Unconditionally-depend-on-openssl-sys.patch;patchdir=../ssh2-rs \
\
git://github.com/alexcrichton/gcc-rs.git;protocol=https;name=gcc-rs;destsuffix=gcc-rs \
file://gcc-rs/0001-Support-use-of-namespaced-environment-variables-base.patch;patchdir=../gcc-rs \
"
SRCREV_curl-rust = "5d0f5c8848e3cf1e12480a1923ae888e24d58f63"
SRCREV_ssh2-rs = "490f91fb9e90bf4e305f1a23a051228c59e60eaf"
SRCREV_gcc-rs = "d32b24466d3e0094cef1c1809a04d7a28536f0e0"
SRCREV_FORMAT = "cargo_curl-rust_ssh2-rs_gcc-rs"
EXTRA_OECARGO_PATHS = "\
${WORKDIR}/curl-rust \
${WORKDIR}/ssh2-rs \
${WORKDIR}/gcc-rs \
"
+21
View File
@@ -0,0 +1,21 @@
SRCREV_cargo = "0f6667ca0631fe72d1e15759c845f0197e3dfe19"
require cargo.inc
SRC_URI += " \
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 \
file://curl-rust/0002-openssl-sys-is-used-in-curl-rust-so-include-it-expli.patch;patchdir=../curl-rust \
\
git://github.com/alexcrichton/ssh2-rs.git;protocol=https;name=ssh2-rs;destsuffix=ssh2-rs \
file://ssh2-rs/0001-Unconditionally-depend-on-openssl-sys.patch;patchdir=../ssh2-rs \
"
SRCREV_curl-rust = "6f007b4967ec12e36937dcb081abe0bdb3bcc508"
SRCREV_ssh2-rs = "982dc47a45a5a2d66ea092ee6bb9503ddcbf36d9"
SRCREV_FORMAT = "cargo_curl-rust_ssh2-rs"
EXTRA_OECARGO_PATHS = "\
${WORKDIR}/curl-rust \
${WORKDIR}/ssh2-rs \
"
@@ -1,19 +1,19 @@
From b5c97df71c3ed0a6a31281e679cb77440293ef55 Mon Sep 17 00:00:00 2001
From 56ce13c48b28b85071e234317cc90371bac1fd48 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 25 Nov 2014 11:50:28 -0500
Subject: [PATCH] curl-sys: avoid explicitly linking in openssl. If it is
Subject: [PATCH 1/2] curl-sys: avoid explicitly linking in openssl. If it is
needed, pkgconfig will pull it in
---
curl-sys/Cargo.toml | 14 --------------
curl-sys/Cargo.toml | 16 ----------------
curl-sys/lib.rs | 1 -
2 files changed, 15 deletions(-)
2 files changed, 17 deletions(-)
diff --git a/curl-sys/Cargo.toml b/curl-sys/Cargo.toml
index 20bb49a..80a320f 100644
index d166ae9..80a320f 100644
--- a/curl-sys/Cargo.toml
+++ b/curl-sys/Cargo.toml
@@ -14,17 +14,3 @@ path = "lib.rs"
@@ -14,19 +14,3 @@ path = "lib.rs"
[dependencies.libz-sys]
git = "https://github.com/alexcrichton/libz-sys"
@@ -27,6 +27,8 @@ index 20bb49a..80a320f 100644
- git = "https://github.com/sfackler/rust-openssl"
-[target.x86_64-unknown-linux-gnu.dependencies.openssl-sys]
- git = "https://github.com/sfackler/rust-openssl"
-[target.arm-unknown-linux-gnueabihf.dependencies.openssl-sys]
- git = "https://github.com/sfackler/rust-openssl"
-[target.i686-unknown-freebsd.dependencies.openssl-sys]
- git = "https://github.com/sfackler/rust-openssl"
-[target.x86_64-unknown-freebsd.dependencies.openssl-sys]
@@ -1,8 +1,8 @@
From c8c54e266bad3e568f55caea4f061182a0d9fd23 Mon Sep 17 00:00:00 2001
From d71d6fa0b9be06cd84eb6c8f7411c624725431c4 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 25 Nov 2014 12:26:48 -0500
Subject: [PATCH] openssl-sys is used in curl-rust, so include it explicitly
here
Subject: [PATCH 2/2] openssl-sys is used in curl-rust, so include it
explicitly here
---
Cargo.toml | 3 +++
@@ -1,93 +0,0 @@
From 94205321c27fc40f7c9604558e08db345cd5a81a Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Wed, 3 Dec 2014 13:41:11 -0500
Subject: [PATCH] Support use of namespaced environment variables based on
TARGET and HOST
---
README.md | 25 +++++++++++++++++++++++++
src/lib.rs | 21 ++++++++++++++++++---
2 files changed, 43 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index bb7047d..0268ce1 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,31 @@ fn main() {
}
```
+# External configuration via environment variables
+
+To control the programs and flags used for building, the builder can set a number of different enviroment variables.
+* `CFLAGS` - a series of space seperated flags passed to "gcc". Note that
+ individual flags cannot currently contain spaces, so doing
+ something like: "-L=foo\ bar" is not possible.
+* `CC` - the actual c compiler used. Note that this is used as an exact
+ executable name, so (for example) no extra flags can be passed inside
+ this variable, and the builder must ensure that there aren't any
+ trailing spaces. This compiler must understand the `-c` flag. For
+ certain `TARGET`s, it also is assumed to know about other flags (most
+ common is `-fPIC`).
+* `AR` - the `ar` (archiver) executable to use to build the static library.
+
+Each of these variables can also be supplied with certain prefixes and suffixes, in the following prioritized order:
+
+1. `<var>_<target>` - for example, `CC_x86_64-unknown-linux-gnu`
+1. `<var>_<target_with_underscores>` - for example, `CC_x86_64_unknown_linux_gnu`
+1. `<build-kind>_<var>` - for example, `HOST_CC` or `TARGET_CFLAGS`
+1. `<var>` - a plain `CC`, `AR` as above.
+
+If none of these varaibles exist, gcc-rs uses built-in defaults
+
+In addition to the the above optional environment variables, `gcc-rs` has some functions with hard requirements on some variables supplied by [cargo's build-script driver][cargo] that it has the `TARGET`, `OUT_DIR`, `OPT_LEVEL`, and `HOST` variables
+
# Windows notes
Currently use of this crate means that Windows users will require gcc to be
diff --git a/src/lib.rs b/src/lib.rs
index 51157c8..bb0cb3c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -109,8 +109,23 @@ fn run(cmd: &mut Command) {
}
}
+fn get_var(var_base: &str) -> Option<String> {
+ let target = os::getenv("TARGET")
+ .expect("Environment variable 'TARGET' is unset");
+ let host = os::getenv("HOST")
+ .expect("Environment variable 'HOST' is unset");
+ let kind = if host == target { "HOST" } else { "TARGET" };
+ let target_u = target.split('-')
+ .collect::<Vec<&str>>()
+ .connect("_");
+ os::getenv(format!("{}_{}", var_base, target).as_slice())
+ .or_else(|| os::getenv(format!("{}_{}", var_base, target_u).as_slice()))
+ .or_else(|| os::getenv(format!("{}_{}", kind, var_base).as_slice()))
+ .or_else(|| os::getenv(var_base))
+}
+
fn gcc() -> String {
- os::getenv("CC").unwrap_or(if cfg!(windows) {
+ get_var("CC").unwrap_or(if cfg!(windows) {
"gcc".to_string()
} else {
"cc".to_string()
@@ -118,11 +133,11 @@ fn gcc() -> String {
}
fn ar() -> String {
- os::getenv("AR").unwrap_or("ar".to_string())
+ get_var("AR").unwrap_or("ar".to_string())
}
fn cflags() -> Vec<String> {
- os::getenv("CFLAGS").unwrap_or(String::new())
+ get_var("CFLAGS").unwrap_or(String::new())
.as_slice().words().map(|s| s.to_string())
.collect()
}
--
2.1.3
@@ -1,17 +1,17 @@
From 89782cabdc9848865845b2d00a444074ce3d59e7 Mon Sep 17 00:00:00 2001
From 95e10eb73f61a3aef83fb387f22ea6c33732bc8d Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Mon, 1 Dec 2014 10:51:31 -0500
Subject: [PATCH] Unconditionally depend on openssl-sys
---
libssh2-sys/Cargo.toml | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
libssh2-sys/Cargo.toml | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/libssh2-sys/Cargo.toml b/libssh2-sys/Cargo.toml
index b16493b..10ad017 100644
index 74fa893..c3fa4db 100644
--- a/libssh2-sys/Cargo.toml
+++ b/libssh2-sys/Cargo.toml
@@ -12,17 +12,7 @@ path = "lib.rs"
@@ -12,20 +12,8 @@ path = "lib.rs"
[dependencies.libz-sys]
git = "https://github.com/alexcrichton/libz-sys"
@@ -23,13 +23,17 @@ index b16493b..10ad017 100644
- git = "https://github.com/sfackler/rust-openssl"
-[target.x86_64-unknown-linux-gnu.dependencies.openssl-sys]
- git = "https://github.com/sfackler/rust-openssl"
-[target.arm-unknown-linux-gnueabihf.dependencies.openssl-sys]
- git = "https://github.com/sfackler/rust-openssl"
-[target.i686-unknown-freebsd.dependencies.openssl-sys]
- git = "https://github.com/sfackler/rust-openssl"
-[target.x86_64-unknown-freebsd.dependencies.openssl-sys]
- git = "https://github.com/sfackler/rust-openssl"
+[dependencies.openssl-sys]
git = "https://github.com/sfackler/rust-openssl"
+ git = "https://github.com/sfackler/rust-openssl"
[build-dependencies.pkg-config]
git = "https://github.com/alexcrichton/pkg-config-rs"
--
2.1.3