Add a feature to openssl-sys to cause it to build a local copy of libressl for

use instead of whatever pkg-config says (which in the case of crosses, is almost
certainly incorrect). This is for PNaCl.
This commit is contained in:
Richard Diamond 2014-12-05 23:38:15 -06:00
parent fd680e8a33
commit 0dff5268de
3 changed files with 17 additions and 0 deletions

View File

@ -18,3 +18,12 @@ aes_xts = []
[build-dependencies] [build-dependencies]
pkg-config = "0.1" pkg-config = "0.1"
[target.le32-unknown-nacl.dependencies]
libressl-pnacl-sys = "2.1.0"
[target.x86_64-unknown-nacl.dependencies]
libressl-pnacl-sys = "2.1.0"
[target.i686-unknown-nacl.dependencies]
libressl-pnacl-sys = "2.1.0"
[target.arm-unknown-nacl.dependencies]
libressl-pnacl-sys = "2.1.0"

View File

@ -3,6 +3,11 @@ extern crate "pkg-config" as pkg_config;
use std::os; use std::os;
fn main() { fn main() {
// Without hackory, pkg-config will only look for host libraries.
// So, abandon ship if we're cross compiling.
if os::getenv("HOST") != os::getenv("TARGET") { return; }
if pkg_config::find_library("openssl").is_err() { if pkg_config::find_library("openssl").is_err() {
let mut flags = " -l crypto -l ssl".to_string(); let mut flags = " -l crypto -l ssl".to_string();

View File

@ -4,6 +4,9 @@
extern crate libc; extern crate libc;
extern crate rustrt; extern crate rustrt;
#[cfg(feature = "libressl-pnacl-sys")]
extern crate "libressl-pnacl-sys" as _for_linkage;
use libc::{c_void, c_int, c_char, c_ulong, c_long, c_uint, c_uchar, size_t}; use libc::{c_void, c_int, c_char, c_ulong, c_long, c_uint, c_uchar, size_t};
use std::mem; use std::mem;
use std::ptr; use std::ptr;