File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Test FreeBSD Build
2+
3+ on :
4+ workflow_dispatch :
5+ pull_request :
6+ paths :
7+ - ' Cargo.toml'
8+ - ' build.rs'
9+ - ' src/**'
10+ - ' .github/workflows/test-freebsd.yml'
11+
12+ env :
13+ RUST_BACKTRACE : 1
14+
15+ jobs :
16+ test-freebsd-build :
17+ name : Test FreeBSD x64 Build
18+ runs-on : ubuntu-22.04
19+
20+ steps :
21+ - name : Checkout repository
22+ uses : actions/checkout@v6
23+
24+ - name : Install Linux dependencies
25+ run : |
26+ sudo apt-get update -y
27+ sudo apt-get install -y libpcap-dev pkg-config
28+
29+ - name : Install Rust
30+ uses : dtolnay/rust-toolchain@stable
31+ with :
32+ toolchain : stable
33+ targets : x86_64-unknown-freebsd
34+
35+ - name : Install cross
36+ run : cargo install cross@0.2.5
37+
38+ - name : Build for FreeBSD (without eBPF)
39+ env :
40+ RUSTFLAGS : " -C strip=symbols"
41+ run : |
42+ echo "Building for FreeBSD target without default features (no eBPF)"
43+ cross build --verbose --release --target x86_64-unknown-freebsd --no-default-features
44+
45+ - name : Verify binary was created
46+ run : |
47+ if [ -f "target/x86_64-unknown-freebsd/release/rustnet" ]; then
48+ echo "✅ FreeBSD binary successfully built"
49+ ls -lh target/x86_64-unknown-freebsd/release/rustnet
50+ else
51+ echo "❌ FreeBSD binary not found"
52+ exit 1
53+ fi
54+
55+ - name : Upload binary as artifact
56+ uses : actions/upload-artifact@v5
57+ with :
58+ name : rustnet-freebsd-x64
59+ path : target/x86_64-unknown-freebsd/release/rustnet
60+ if-no-files-found : error
Original file line number Diff line number Diff line change @@ -85,15 +85,15 @@ windows = { version = "0.62", features = [
8585] }
8686
8787[target .'cfg(target_os = "linux")' .build-dependencies ]
88- libbpf-cargo = " 0.25"
88+ libbpf-cargo = { version = " 0.25" , optional = true }
8989
9090[features ]
9191# eBPF is enabled by default for enhanced performance on Linux.
9292# On non-Linux platforms, this feature has no effect as all eBPF code
9393# and dependencies are Linux-specific (guarded by target_os checks).
9494default = [" ebpf" ]
9595linux-default = [" ebpf" ] # Deprecated: kept for backwards compatibility
96- ebpf = [" libbpf-rs" , " bytes" , " libc" ]
96+ ebpf = [" libbpf-rs" , " bytes" , " libc" , " dep:libbpf-cargo " ]
9797
9898# Minimal cross configuration to override dependency conflicts
9999[workspace .metadata .cross .build .env ]
You can’t perform that action at this time.
0 commit comments