feat: update depot package version to 1.0.2 and enhance fakeroot support with ownership tracking
This commit is contained in:
@@ -12,6 +12,7 @@ const BUILD_OPTION_KEYS: &[&str] = &[
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-env-changed=CC");
|
||||
println!("cargo:rerun-if-changed=src/fakeroot_preload.c");
|
||||
for key in BUILD_OPTION_KEYS {
|
||||
println!("cargo:rerun-if-env-changed={key}");
|
||||
if let Ok(value) = std::env::var(key) {
|
||||
@@ -19,6 +20,10 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("linux") {
|
||||
build_fakeroot_preload();
|
||||
}
|
||||
|
||||
if std::env::var_os("CARGO_FEATURE_STATIC_EXCEPT_LIBC").is_some()
|
||||
&& std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("linux")
|
||||
{
|
||||
@@ -32,6 +37,31 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
fn build_fakeroot_preload() {
|
||||
let compiler = std::env::var_os("CC").unwrap_or_else(|| "cc".into());
|
||||
let output_path = std::path::PathBuf::from(
|
||||
std::env::var_os("OUT_DIR").expect("Cargo must provide OUT_DIR to build.rs"),
|
||||
)
|
||||
.join("libdepot_fakeroot.so");
|
||||
let output = std::process::Command::new(compiler)
|
||||
.args([
|
||||
"-std=c11", "-shared", "-fPIC", "-O2", "-Wall", "-Wextra", "-Werror", "-o",
|
||||
])
|
||||
.arg(&output_path)
|
||||
.arg("src/fakeroot_preload.c")
|
||||
.output()
|
||||
.unwrap_or_else(|error| {
|
||||
panic!("failed to launch C compiler for fakeroot preload: {error}")
|
||||
});
|
||||
|
||||
if !output.status.success() {
|
||||
panic!(
|
||||
"failed to build fakeroot preload library:\n{}",
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn gcc_runtime_archive(name: &str) -> Option<String> {
|
||||
let compiler = std::env::var_os("CC").unwrap_or_else(|| "cc".into());
|
||||
let output = std::process::Command::new(compiler)
|
||||
|
||||
Reference in New Issue
Block a user