-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add build cfg for FUSE mounting implementation
Signed-off-by: Daniel Carl Jones <[email protected]>
- Loading branch information
1 parent
e7dfd3b
commit 8d9e2ac
Showing
3 changed files
with
25 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,48 @@ | ||
fn main() { | ||
// Register rustc cfg for switching between mount implementations | ||
println!("cargo::rustc-check-cfg=cfg(fuser_mount_impl, values(\"pure-rust\", \"libfuse2\", \"libfuse3\"))"); | ||
|
||
#[cfg(all(not(feature = "libfuse"), not(target_os = "linux")))] | ||
unimplemented!("Building without libfuse is only supported on Linux"); | ||
|
||
#[cfg(feature = "libfuse")] | ||
{ | ||
#[cfg(target_os = "macos")] | ||
{ | ||
if cfg!(feature = "libfuse") { | ||
if cfg!(target_os = "macos") { | ||
if pkg_config::Config::new() | ||
.atleast_version("2.6.0") | ||
.probe("fuse") // for macFUSE 4.x | ||
.map_err(|e| eprintln!("{}", e)) | ||
.is_ok() | ||
{ | ||
println!("cargo:rustc-cfg=feature=\"libfuse2\""); | ||
println!("cargo:rustc-cfg=fuser_mount_impl=\"libfuse2\""); | ||
println!("cargo:rustc-cfg=feature=\"macfuse-4-compat\""); | ||
} else { | ||
pkg_config::Config::new() | ||
.atleast_version("2.6.0") | ||
.probe("osxfuse") // for osxfuse 3.x | ||
.map_err(|e| eprintln!("{}", e)) | ||
.unwrap(); | ||
println!("cargo:rustc-cfg=feature=\"libfuse2\""); | ||
println!("cargo:rustc-cfg=fuser_mount_impl=\"libfuse2\""); | ||
} | ||
} | ||
#[cfg(not(target_os = "macos"))] | ||
{ | ||
} else { | ||
// First try to link with libfuse3 | ||
if pkg_config::Config::new() | ||
.atleast_version("3.0.0") | ||
.probe("fuse3") | ||
.map_err(|e| eprintln!("{e}")) | ||
.is_ok() | ||
{ | ||
println!("cargo:rustc-cfg=feature=\"libfuse3\""); | ||
println!("cargo:rustc-cfg=fuser_mount_impl=\"libfuse3\""); | ||
} else { | ||
// Fallback to libfuse | ||
pkg_config::Config::new() | ||
.atleast_version("2.6.0") | ||
.probe("fuse") | ||
.map_err(|e| eprintln!("{e}")) | ||
.unwrap(); | ||
println!("cargo:rustc-cfg=feature=\"libfuse2\""); | ||
println!("cargo:rustc-cfg=fuser_mount_impl=\"libfuse2\""); | ||
} | ||
} | ||
} else { | ||
println!("cargo:rustc-cfg=fuser_mount_impl=\"pure-rust\""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters