mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
fix stdbuf problem
This commit is contained in:
parent
70d8864fe1
commit
c5e2515833
2 changed files with 21 additions and 6 deletions
|
@ -329,7 +329,7 @@ sort = { optional=true, version="0.0.9", package="uu_sort", path="src/uu/sor
|
||||||
split = { optional=true, version="0.0.9", package="uu_split", path="src/uu/split" }
|
split = { optional=true, version="0.0.9", package="uu_split", path="src/uu/split" }
|
||||||
stat = { optional=true, version="0.0.9", package="uu_stat", path="src/uu/stat" }
|
stat = { optional=true, version="0.0.9", package="uu_stat", path="src/uu/stat" }
|
||||||
# Very ugly, uncomment when the issue #2876 is fixed
|
# Very ugly, uncomment when the issue #2876 is fixed
|
||||||
stdbuf = { optional=true, version="0.0.8", package="uu_stdbuf", path="src/uu/stdbuf" }
|
stdbuf = { optional=true, version="0.0.9", package="uu_stdbuf", path="src/uu/stdbuf" }
|
||||||
sum = { optional=true, version="0.0.9", package="uu_sum", path="src/uu/sum" }
|
sum = { optional=true, version="0.0.9", package="uu_sum", path="src/uu/sum" }
|
||||||
sync = { optional=true, version="0.0.9", package="uu_sync", path="src/uu/sync" }
|
sync = { optional=true, version="0.0.9", package="uu_sync", path="src/uu/sync" }
|
||||||
tac = { optional=true, version="0.0.9", package="uu_tac", path="src/uu/tac" }
|
tac = { optional=true, version="0.0.9", package="uu_tac", path="src/uu/tac" }
|
||||||
|
|
|
@ -28,15 +28,30 @@ fn main() {
|
||||||
// - cargo run
|
// - cargo run
|
||||||
// - cross run
|
// - cross run
|
||||||
// - cargo install --git
|
// - cargo install --git
|
||||||
|
// - cargo publish --dry-run
|
||||||
let mut name = target_dir.file_name().unwrap().to_string_lossy();
|
let mut name = target_dir.file_name().unwrap().to_string_lossy();
|
||||||
while name != "target" && !name.starts_with("cargo-install") {
|
while name != "target" && !name.starts_with("cargo-install") {
|
||||||
target_dir = target_dir.parent().unwrap();
|
target_dir = target_dir.parent().unwrap();
|
||||||
name = target_dir.file_name().unwrap().to_string_lossy();
|
name = target_dir.file_name().unwrap().to_string_lossy();
|
||||||
}
|
}
|
||||||
let mut libstdbuf = target_dir.to_path_buf();
|
let mut dir = target_dir.to_path_buf();
|
||||||
libstdbuf.push(env::var("PROFILE").unwrap());
|
dir.push(env::var("PROFILE").unwrap());
|
||||||
libstdbuf.push("deps");
|
dir.push("deps");
|
||||||
libstdbuf.push(format!("liblibstdbuf{}", platform::DYLIB_EXT));
|
let mut path = None;
|
||||||
|
|
||||||
fs::copy(libstdbuf, Path::new(&out_dir).join("libstdbuf.so")).unwrap();
|
// When running cargo publish, cargo appends hashes to the filenames of the compiled artifacts.
|
||||||
|
// Therefore, it won't work to just get liblibstdbuf.so. Instead, we look for files with the
|
||||||
|
// glob pattern "liblibstdbuf*.so" (i.e. starts with liblibstdbuf and ends with the extension).
|
||||||
|
for entry in fs::read_dir(dir).unwrap().flatten() {
|
||||||
|
let name = entry.file_name();
|
||||||
|
let name = name.to_string_lossy();
|
||||||
|
if name.starts_with("liblibstdbuf") && name.ends_with(platform::DYLIB_EXT) {
|
||||||
|
path = Some(entry.path());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fs::copy(
|
||||||
|
path.expect("liblibstdbuf was not found"),
|
||||||
|
Path::new(&out_dir).join("libstdbuf.so"),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue