58 lines
1.9 KiB
Bash
Executable File
58 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# ============================================================================
|
|
# MASTER PRODUCTION COMPILATION PIPELINE ENGINE RUNNER (v7.0)
|
|
# ============================================================================
|
|
set -euo pipefail
|
|
|
|
log_step() { echo -e "\n [BUILD STEP] $1"; }
|
|
|
|
log_step "Detecting native host environment profile..."
|
|
if [ -f /etc/arch-release ]; then
|
|
echo " Profile Verified: Arch Linux Host"
|
|
elif [ -f /etc/debian_version ]; then
|
|
echo " Profile Verified: Debian Host"
|
|
fi
|
|
|
|
log_step "Validating global dependency tooling..."
|
|
cargo check
|
|
|
|
log_step "Compiling core system native dynamic library..."
|
|
cargo build --release
|
|
|
|
log_step "Compiling embedded eBPF object code..."
|
|
mkdir -p ebpf_bin
|
|
if command -v clang &> /dev/null; then
|
|
cat << 'EOF' > ebpf_bin/stave_probe.c
|
|
#include <linux/bpf.h>
|
|
#include <bpf/bpf_helpers.h>
|
|
SEC("tracepoint/syscalls/sys_enter_connect")
|
|
int trace_sys_connect(void *ctx) { return 0; }
|
|
char _license[] SEC("license") = "GPL";
|
|
EOF
|
|
clang -O2 -target bpf -c ebpf_bin/stave_probe.c -o ebpf_bin/stave_probe.o
|
|
echo " eBPF binary assembled: ebpf_bin/stave_probe.o"
|
|
else
|
|
echo " Warning: clang missing. Creating stub..."
|
|
touch ebpf_bin/stave_probe.o
|
|
fi
|
|
|
|
if command -v x86_64-w64-mingw32-g++ &> /dev/null; then
|
|
log_step "Cross-compiling Win32/Wine plugin..."
|
|
x86_64-w64-mingw32-g++ -shared -static -O3 \
|
|
-o warlock_bridge.dp64 stave_stub.cpp -lkernel32
|
|
echo " Plugin output: warlock_bridge.dp64"
|
|
fi
|
|
|
|
log_step "Configuring filesystem capabilities..."
|
|
TARGET_DAEMON="./target/release/libstave_core.so"
|
|
if [ -f "$TARGET_DAEMON" ]; then
|
|
sudo setcap cap_net_admin,cap_perfmon+ep "$TARGET_DAEMON" \
|
|
|| echo " Warning: Capability injection bypassed. Run with sudo."
|
|
fi
|
|
|
|
log_step "Build complete. Master Engine v7.0 is ready."
|
|
|
|
|
|
===============================================================================
|
|
11B. BINARY TARGETS
|