use std::env;
fn main() {
let target = env::var("TARGET").expect("TARGET environment variable not set");
let profile = env::var("PROFILE").expect("PROFILE environment variable not set");
if profile == "release" {
let do_upx_compression = env::var("DO_UPX_COMPRESSION").unwrap_or_else(|_| "1".to_string());
if do_upx_compression != "0" {
let mut binary_path = std::path::PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
binary_path.push("target/release/");
let exe_ext = if target.contains("windows") { ".exe" } else { "" };
let binary_name = format!("{}{}", env::var("CARGO_PKG_NAME").unwrap(), exe_ext);
binary_path.push(&binary_name);
println!("cargo:warning=Post-build: To run UPX compression, execute 'cargo run --release --bin post_build'");
}
}
println!("cargo:info=Build script executed for {} profile", profile);
}