- source/rust → rust/ - source/conf → conf/ - source/www → www/ - source/data-seed → data-seed/ - source/data → data/ - scripts/ 保留(语义不对应 ipass deploy/) - /build/ 加入 .gitignore(本机 nginx 源码树) - README.md 目录树同步 + build 路径 /tmp/sso-build → ./build - Cargo.toml path 依赖 '../../deps/ipass' → '../deps/ipass' - CLAUDE.md 同步路径示例 cargo check 通过(52s);release build 通过(1m26s),产物 libsso_gateway.dylib
21 lines
978 B
Rust
21 lines
978 B
Rust
//! 构建脚本:让 cdylib 允许「未定义符号」。
|
||
//!
|
||
//! nginx 动态模块的运行时符号(`ngx_palloc` / `ngx_http_add_variable` /
|
||
//! `ngx_shared_memory_add` …)由 nginx 主程序在 `load_module` 时提供,
|
||
//! 链接本模块时它们必然是未定义的——这是动态模块的固有属性,不是错误。
|
||
//!
|
||
//! * Linux:cdylib 默认允许未定义符号,无需处理。
|
||
//! * macOS:必须显式 `-undefined dynamic_lookup`,否则 ld 直接报
|
||
//! `symbol(s) not found for architecture x86_64`。
|
||
//!
|
||
//! 注意:vendored 的 `ngx` crate 的 build.rs 也设了这两项,但
|
||
//! `rustc-link-arg` 只对「设置它的那个 crate」生效,不会传递给依赖它的
|
||
//! crate,所以本 crate 必须自己再设一次。
|
||
|
||
fn main() {
|
||
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("macos") {
|
||
println!("cargo::rustc-link-arg=-undefined");
|
||
println!("cargo::rustc-link-arg=dynamic_lookup");
|
||
}
|
||
}
|