From bb47e045581fe25cb6ef0e4b3f2eeace41395240 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Sun, 13 Sep 2020 21:23:47 +0200 Subject: [PATCH] Improve the binary's long version --- acme_common/build.rs | 1 - acmed/src/main.rs | 4 ++-- tacd/build.rs | 7 +++++++ tacd/src/main.rs | 10 +++++++++- 4 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 tacd/build.rs diff --git a/acme_common/build.rs b/acme_common/build.rs index d7d0d92..05ee769 100644 --- a/acme_common/build.rs +++ b/acme_common/build.rs @@ -6,7 +6,6 @@ macro_rules! set_rustc_env_var { }}; } - fn main() { if let Ok(_) = env::var("DEP_OPENSSL_VERSION_NUMBER") { set_rustc_env_var!("ACMED_TLS_LIB_NAME", "OpenSSL"); diff --git a/acmed/src/main.rs b/acmed/src/main.rs index a0f5d1e..2bbbc73 100644 --- a/acmed/src/main.rs +++ b/acmed/src/main.rs @@ -1,6 +1,6 @@ use crate::main_event_loop::MainEventLoop; use acme_common::crypto::{ - HashFunction, JwsSignatureAlgorithm, KeyType, get_lib_name, get_lib_version + get_lib_name, get_lib_version, HashFunction, JwsSignatureAlgorithm, KeyType, }; use acme_common::logs::{set_log_system, DEFAULT_LOG_LEVEL}; use acme_common::{clean_pid_file, init_server}; @@ -49,7 +49,7 @@ pub const MIN_RATE_LIMIT_SLEEP_MILISEC: u64 = 100; fn main() { let full_version = format!( - "{} {}\n\nCompiled with:\n {} {}\n {} {}", + "{} built for {}\n\nCryptographic library:\n - {} {}\nHTTP client library:\n - {} {}", APP_VERSION, env!("ACMED_TARGET"), get_lib_name(), diff --git a/tacd/build.rs b/tacd/build.rs new file mode 100644 index 0000000..8773cee --- /dev/null +++ b/tacd/build.rs @@ -0,0 +1,7 @@ +use std::env; + +fn main() { + if let Ok(target) = env::var("TARGET") { + println!("cargo:rustc-env=TACD_TARGET={}", target); + }; +} diff --git a/tacd/src/main.rs b/tacd/src/main.rs index c6f92c6..a0e385d 100644 --- a/tacd/src/main.rs +++ b/tacd/src/main.rs @@ -1,7 +1,7 @@ mod openssl_server; use crate::openssl_server::start as server_start; -use acme_common::crypto::{HashFunction, KeyType, X509Certificate}; +use acme_common::crypto::{get_lib_name, get_lib_version, HashFunction, KeyType, X509Certificate}; use acme_common::error::Error; use acme_common::logs::{set_log_system, DEFAULT_LOG_LEVEL}; use acme_common::{clean_pid_file, to_idna}; @@ -67,11 +67,19 @@ fn init(cnf: &ArgMatches) -> Result<(), Error> { } fn main() { + let full_version = format!( + "{} built for {}\n\nCryptographic library:\n - {} {}", + APP_VERSION, + env!("TACD_TARGET"), + get_lib_name(), + get_lib_version(), + ); let default_crt_key_type = DEFAULT_CRT_KEY_TYPE.to_string(); let default_crt_digest = DEFAULT_CRT_DIGEST.to_string(); let default_log_level = DEFAULT_LOG_LEVEL.to_string().to_lowercase(); let matches = App::new(APP_NAME) .version(APP_VERSION) + .long_version(full_version.as_str()) .arg( Arg::with_name("listen") .long("listen")