Browse Source

Prepare the build tools for the standalone feature

pull/5/head
Rodolphe Breard 6 years ago
parent
commit
51c8d6a0b7
  1. 7
      acme_common/Cargo.toml
  2. 7
      acmed/Cargo.toml
  3. 21
      acmed/build.rs
  4. 8
      tacd/Cargo.toml

7
acme_common/Cargo.toml

@ -11,6 +11,10 @@ include = ["src/**/*", "Cargo.toml", "Licence_*.txt"]
[lib]
name = "acme_common"
[features]
default = ["openssl"]
standalone = []
[dependencies]
base64 = "0.10"
daemonize = "0.4"
@ -18,8 +22,7 @@ env_logger = "0.6"
handlebars = "2.0.0-beta.2"
http_req = "0.5"
log = "0.4"
openssl = "0.10"
serde = { version = "1.0", features = ["derive"] }
openssl = { version = "0.10", optional = true }
serde_json = "1.0"
syslog = "4.0"
time = "0.1"

7
acmed/Cargo.toml

@ -11,6 +11,10 @@ license = "MIT OR Apache-2.0"
include = ["src/**/*", "Cargo.toml", "LICENSE-*.txt"]
build = "build.rs"
[features]
default = ["openssl-sys"]
standalone = []
[dependencies]
acme_common = { path = "../acme_common" }
clap = "2.32"
@ -18,8 +22,7 @@ handlebars = "2.0.0-beta.2"
http_req = "0.5"
log = "0.4"
nom = "5.0.0-beta2"
openssl = "0.10"
openssl-sys = "0.9"
openssl-sys = { version = "0.9", optional = true }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
time = "0.1"

21
acmed/build.rs

@ -5,6 +5,7 @@ use serde::Deserialize;
use std::env;
use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
use std::path::PathBuf;
macro_rules! set_rustc_env_var {
@ -91,6 +92,21 @@ fn get_openssl_version(v: &str) -> String {
}
}
fn get_lib_version(lib: &str) -> Option<String> {
let pat = format!("\"checksum {} ", lib);
let mut lock_file = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
lock_file.push("../Cargo.lock");
let file = File::open(lock_file).unwrap();
for line in BufReader::new(file).lines() {
let line = line.unwrap();
if line.starts_with(&pat) {
let v: Vec<&str> = line.split(' ').collect();
return Some(String::from(v[2]));
}
}
None
}
fn set_tls() {
if let Ok(v) = env::var("DEP_OPENSSL_VERSION_NUMBER") {
let version = get_openssl_version(&v);
@ -102,6 +118,11 @@ fn set_tls() {
set_rustc_env_var!("ACMED_TLS_LIB_VERSION", version);
set_rustc_env_var!("ACMED_TLS_LIB_NAME", "LibreSSL");
}
if let Ok(_) = env::var("CARGO_FEATURE_STANDALONE") {
let version = get_lib_version("ring").unwrap();
set_rustc_env_var!("ACMED_TLS_LIB_VERSION", version);
set_rustc_env_var!("ACMED_TLS_LIB_NAME", "ring");
}
}
fn set_target() {

8
tacd/Cargo.toml

@ -10,10 +10,12 @@ readme = "../README.md"
license = "MIT OR Apache-2.0"
include = ["src/**/*", "Cargo.toml", "LICENSE-*.txt"]
[features]
default = ["openssl"]
standalone = []
[dependencies]
acme_common = { path = "../acme_common" }
clap = "2.32"
env_logger = "0.6"
log = "0.4"
openssl = "0.10"
syslog = "4.0"
openssl = { version = "0.10", optional = true }
Loading…
Cancel
Save