mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
stdbuf: fix cargo --git build (#1276)
This commit is contained in:
parent
4ae838a8b2
commit
ebd5e965e9
1 changed files with 16 additions and 10 deletions
|
@ -20,17 +20,23 @@ mod platform {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let manifest_dir = env::var("CARGO_MANIFEST_DIR").expect("Could not find manifest dir");
|
|
||||||
let profile = env::var("PROFILE").expect("Could not determine profile");
|
|
||||||
|
|
||||||
let out_dir = env::var("OUT_DIR").unwrap();
|
let out_dir = env::var("OUT_DIR").unwrap();
|
||||||
let libstdbuf = format!(
|
let mut target_dir = Path::new(&out_dir);
|
||||||
"{}/../../../{}/{}/deps/liblibstdbuf{}",
|
|
||||||
manifest_dir,
|
// Depending on how this is util is built, the directory structure. This seems to work for now.
|
||||||
env::var("CARGO_TARGET_DIR").unwrap_or_else(|_| "target".to_string()),
|
// Here are three cases to test when changing this:
|
||||||
profile,
|
// - cargo run
|
||||||
platform::DYLIB_EXT
|
// - cross run
|
||||||
);
|
// - cargo install --git
|
||||||
|
let mut name = target_dir.file_name().unwrap().to_string_lossy();
|
||||||
|
while name != "target" && !name.starts_with("cargo-install") {
|
||||||
|
target_dir = target_dir.parent().unwrap();
|
||||||
|
name = target_dir.file_name().unwrap().to_string_lossy();
|
||||||
|
}
|
||||||
|
let mut libstdbuf = target_dir.to_path_buf();
|
||||||
|
libstdbuf.push(env::var("PROFILE").unwrap());
|
||||||
|
libstdbuf.push("deps");
|
||||||
|
libstdbuf.push(format!("liblibstdbuf{}", platform::DYLIB_EXT));
|
||||||
|
|
||||||
fs::copy(libstdbuf, Path::new(&out_dir).join("libstdbuf.so")).unwrap();
|
fs::copy(libstdbuf, Path::new(&out_dir).join("libstdbuf.so")).unwrap();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue