mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 07:12:44 +00:00
Add release-fast and release-small targets to Cargo.toml
This commit is contained in:
parent
24fb3897c3
commit
0c4f5864d9
2 changed files with 32 additions and 3 deletions
19
Cargo.toml
19
Cargo.toml
|
@ -512,3 +512,22 @@ path = "src/bin/coreutils.rs"
|
|||
name = "uudoc"
|
||||
path = "src/bin/uudoc.rs"
|
||||
required-features = ["uudoc"]
|
||||
|
||||
# The default release profile. It contains all optimizations, without
|
||||
# sacrificing debug info. With this profile (like in the standard
|
||||
# release profile), the debug info and the stack traces will still be available.
|
||||
[profile.release]
|
||||
lto = true
|
||||
|
||||
# A release-like profile that is tuned to be fast, even when being fast
|
||||
# compromises on binary size. This includes aborting on panic.
|
||||
[profile.release-fast]
|
||||
inherits = "release"
|
||||
panic = "abort"
|
||||
|
||||
# A release-like profile that is as small as possible.
|
||||
[profile.release-small]
|
||||
inherits = "release"
|
||||
opt-level = "z"
|
||||
panic = "abort"
|
||||
strip = true
|
||||
|
|
|
@ -23,19 +23,29 @@ fn main() {
|
|||
let out_dir = env::var("OUT_DIR").unwrap();
|
||||
let mut target_dir = Path::new(&out_dir);
|
||||
|
||||
// Depending on how this is util is built, the directory structure. This seems to work for now.
|
||||
// Here are three cases to test when changing this:
|
||||
// Depending on how this is util is built, the directory structure changes.
|
||||
// This seems to work for now. Here are three cases to test when changing
|
||||
// this:
|
||||
//
|
||||
// - cargo run
|
||||
// - cross run
|
||||
// - cargo install --git
|
||||
// - cargo publish --dry-run
|
||||
//
|
||||
// The goal is to find the directory in which we are installing, but that
|
||||
// depends on the build method, which is annoying. Additionally the env
|
||||
// var for the profile can only be "debug" or "release", not a custom
|
||||
// profile name, so we have to use the name of the directory within target
|
||||
// as the profile name.
|
||||
let mut name = target_dir.file_name().unwrap().to_string_lossy();
|
||||
let mut profile_name = name.clone();
|
||||
while name != "target" && !name.starts_with("cargo-install") {
|
||||
target_dir = target_dir.parent().unwrap();
|
||||
profile_name = name.clone();
|
||||
name = target_dir.file_name().unwrap().to_string_lossy();
|
||||
}
|
||||
let mut dir = target_dir.to_path_buf();
|
||||
dir.push(env::var("PROFILE").unwrap());
|
||||
dir.push(profile_name.as_ref());
|
||||
dir.push("deps");
|
||||
let mut path = None;
|
||||
|
||||
|
|
Loading…
Reference in a new issue