mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 07:04:29 +00:00
build.rs: canonicalize CARGO_MANIFEST_DIR
We use this so you can run fish from the build directory and it picks up its data files. If this wasn't canonicalized, that would break if you're building with a $PWD through a symlink.
This commit is contained in:
parent
6f797ac958
commit
1deb065f59
1 changed files with 10 additions and 0 deletions
10
build.rs
10
build.rs
|
@ -13,6 +13,16 @@ fn main() {
|
||||||
let build_dir = format!("{}/build", env!("CARGO_MANIFEST_DIR"));
|
let build_dir = format!("{}/build", env!("CARGO_MANIFEST_DIR"));
|
||||||
let build_dir = option_env!("FISH_BUILD_DIR").unwrap_or(&build_dir);
|
let build_dir = option_env!("FISH_BUILD_DIR").unwrap_or(&build_dir);
|
||||||
rsconf::set_env_value("FISH_BUILD_DIR", build_dir);
|
rsconf::set_env_value("FISH_BUILD_DIR", build_dir);
|
||||||
|
// We need to canonicalize (i.e. realpath)
|
||||||
|
// the manifest dir because we want to compare it simply as a string at runtime.
|
||||||
|
rsconf::set_env_value(
|
||||||
|
"CARGO_MANIFEST_DIR",
|
||||||
|
std::fs::canonicalize(env!("CARGO_MANIFEST_DIR"))
|
||||||
|
.unwrap()
|
||||||
|
.as_path()
|
||||||
|
.to_str()
|
||||||
|
.unwrap(),
|
||||||
|
);
|
||||||
|
|
||||||
cc::Build::new()
|
cc::Build::new()
|
||||||
.file("src/libc.c")
|
.file("src/libc.c")
|
||||||
|
|
Loading…
Reference in a new issue