- build.rs: pass target -arch to cc so macos_shim cross-compiles (x86_64-apple-darwin) - AACS/CSS: unit-aligned decrypting sweep; per-VTS CSS title keys (hard-fail on wrong VTS); reject truncated Unit_Key_RO; AACS 2.0 sig-verify skip; CSS bus-auth random nonce - recovery: gap-filling mapfile load; sweep/copy resume reconciliation; stale-mapfile abort; patch wedge/damage-window range reset - mux: TS continuity + PSI CC desync guards; HEVC numTemporalLayers clamp; MPEG-2 pending byte-cap; PS parse_pts marker-bit validation; HdrFormat strict parse; Unknown-variant metadata - net/keydb: network:// SSRF parity (IPv4-mapped, CGNAT, 0.0.0.0/8, Class-E); bounded keydb header read + size cap + error context - io: durable mapfile fsync; NFS writeback degrade; sync_file_range error capture; Windows SCSI u32 transfer guard
51 lines
1.8 KiB
Rust
51 lines
1.8 KiB
Rust
fn main() {
|
|
let target = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
|
|
if target == "macos" {
|
|
println!("cargo:rustc-link-lib=framework=IOKit");
|
|
println!("cargo:rustc-link-lib=framework=CoreFoundation");
|
|
|
|
let out_dir = std::env::var("OUT_DIR").unwrap();
|
|
let obj = format!("{out_dir}/macos_shim.o");
|
|
let lib = format!("{out_dir}/libmacos_scsi.a");
|
|
|
|
// Build the shim for the TARGET arch, not the host's. A bare `cc` on an
|
|
// Apple-Silicon CI runner defaults to arm64, so cross-building to
|
|
// x86_64-apple-darwin would link a host-arch object against x86_64 Rust
|
|
// code → "Undefined symbols for architecture x86_64". (Still raw `cc`,
|
|
// not the `cc` crate, which breaks IOKit exclusive access.)
|
|
let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default();
|
|
let clang_arch: &str = if target_arch == "aarch64" {
|
|
"arm64"
|
|
} else {
|
|
&target_arch // x86_64 → x86_64
|
|
};
|
|
|
|
std::process::Command::new("cc")
|
|
.args([
|
|
"-arch",
|
|
clang_arch,
|
|
"-c",
|
|
"src/scsi/macos_shim.c",
|
|
"-o",
|
|
&obj,
|
|
"-framework",
|
|
"IOKit",
|
|
"-framework",
|
|
"CoreFoundation",
|
|
"-Wall",
|
|
"-O2",
|
|
])
|
|
.status()
|
|
.expect("failed to compile macos_shim.c");
|
|
|
|
std::process::Command::new("ar")
|
|
.args(["rcs", &lib, &obj])
|
|
.status()
|
|
.expect("failed to create static lib");
|
|
|
|
println!("cargo:rustc-link-search=native={out_dir}");
|
|
println!("cargo:rustc-link-lib=static=macos_scsi");
|
|
println!("cargo:rerun-if-changed=src/scsi/macos_shim.c");
|
|
}
|
|
}
|