From 5adb3f397a2a639b841d4df3cb964def2112bf76 Mon Sep 17 00:00:00 2001 From: Quentin Baradat Date: Wed, 11 Feb 2015 20:41:13 +0100 Subject: [PATCH 1/2] Fix the target for windows --- openssl-sys/build.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/openssl-sys/build.rs b/openssl-sys/build.rs index a27f5e77..90e65341 100644 --- a/openssl-sys/build.rs +++ b/openssl-sys/build.rs @@ -15,12 +15,10 @@ fn main() { (instructions in the README) and provide their location through \ $OPENSSL_PATH."); println!("cargo:rustc-flags=-L native={} -l crypto:static -l ssl:static", path); - // going to assume the user built a new version of openssl - build_old_openssl_shim(false); return; } - if target.contains("win32") || target.contains("win64") { + if target.contains("win32") || target.contains("win64") || target.contains("i386-pc-windows-gnu") || target.contains("x86_64-pc-windows-gnu") { println!("cargo:rustc-flags=-l crypto -l ssl -l gdi32 -l wsock32"); // going to assume the user has a new version of openssl build_old_openssl_shim(false); @@ -41,14 +39,15 @@ fn main() { } fn build_old_openssl_shim(is_old: bool) { - let mut config: gcc::Config = Default::default(); - if is_old { - config.definitions.push(("OLD_OPENSSL".to_string(), None)); - } + let mut config: gcc::Config = Default::default(); + if is_old { + config.definitions.push(("OLD_OPENSSL".to_string(), None)); gcc::compile_library("libold_openssl_shim.a", - &config, - &["src/old_openssl_shim.c"]); + &config, + &["src/old_openssl_shim.c"]); + let out_dir = env::var_string("OUT_DIR").unwrap(); println!("cargo:rustc-flags=-L native={} -l old_openssl_shim:static", out_dir); + } } From e11bfa6f0cfa7e49f3f7fd0af8f2222b7293b230 Mon Sep 17 00:00:00 2001 From: Quentin Baradat Date: Wed, 11 Feb 2015 21:29:07 +0100 Subject: [PATCH 2/2] Fix a bad fix :) --- openssl-sys/build.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openssl-sys/build.rs b/openssl-sys/build.rs index 90e65341..5cfe9b4f 100644 --- a/openssl-sys/build.rs +++ b/openssl-sys/build.rs @@ -42,12 +42,12 @@ fn build_old_openssl_shim(is_old: bool) { let mut config: gcc::Config = Default::default(); if is_old { config.definitions.push(("OLD_OPENSSL".to_string(), None)); + } - gcc::compile_library("libold_openssl_shim.a", + gcc::compile_library("libold_openssl_shim.a", &config, &["src/old_openssl_shim.c"]); - let out_dir = env::var_string("OUT_DIR").unwrap(); - println!("cargo:rustc-flags=-L native={} -l old_openssl_shim:static", out_dir); - } + let out_dir = env::var_string("OUT_DIR").unwrap(); + println!("cargo:rustc-flags=-L native={} -l old_openssl_shim:static", out_dir); }