mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +08:00
build.rs: deduplicate the build-dir heuristic
This commit is contained in:
parent
67de32fe2d
commit
a20525c44f
@ -15,12 +15,12 @@ fn main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let build_dir = PathBuf::from(
|
let rust_dir = env!("CARGO_MANIFEST_DIR");
|
||||||
std::env::var("FISH_BUILD_DIR")
|
// Add our default to enable tools that don't go through CMake, like "cargo test" and the
|
||||||
// Add our default to enable tools that don't go through CMake, like "cargo test"
|
// language server.
|
||||||
// and the language server.
|
let build_dir =
|
||||||
.unwrap_or("./build".into()),
|
PathBuf::from(std::env::var("FISH_BUILD_DIR").unwrap_or(format!("{rust_dir}/build")));
|
||||||
);
|
println!("cargo:rustc-env=FISH_BUILD_DIR={}", build_dir.display());
|
||||||
|
|
||||||
let cached_curses_libnames = Path::join(&build_dir, "cached-curses-libnames");
|
let cached_curses_libnames = Path::join(&build_dir, "cached-curses-libnames");
|
||||||
let curses_libnames: Vec<String> = if let Ok(lib_path_list) = env::var("CURSES_LIBRARY_LIST") {
|
let curses_libnames: Vec<String> = if let Ok(lib_path_list) = env::var("CURSES_LIBRARY_LIST") {
|
||||||
@ -66,12 +66,6 @@ fn main() {
|
|||||||
println!("cargo:rustc-cfg=FISH_USE_POSIX_SPAWN");
|
println!("cargo:rustc-cfg=FISH_USE_POSIX_SPAWN");
|
||||||
}
|
}
|
||||||
|
|
||||||
let rust_dir = env!("CARGO_MANIFEST_DIR");
|
|
||||||
// If FISH_BUILD_DIR is given by CMake, then use it; otherwise assume it's at build.
|
|
||||||
let fish_build_dir =
|
|
||||||
std::env::var("FISH_BUILD_DIR").unwrap_or(format!("{}/{}", rust_dir, "build/"));
|
|
||||||
println!("cargo:rustc-env=FISH_BUILD_DIR={fish_build_dir}");
|
|
||||||
|
|
||||||
let mut build = cc::Build::new();
|
let mut build = cc::Build::new();
|
||||||
// Add to the default library search path
|
// Add to the default library search path
|
||||||
build.flag_if_supported("-L/usr/local/lib/");
|
build.flag_if_supported("-L/usr/local/lib/");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user