1
0
Fork 0
mirror of https://github.com/imjasonh/krust synced 2026-07-08 06:45:32 +00:00

Use cargo-zigbuild for cross-compilation, add build caching

- Integrate cargo-zigbuild as the default build backend, falling back
  to cargo build with best-effort linker detection if not installed
- Auto-install rustup targets when missing (rustup target add)
- Use persistent target/krust/ directory instead of temp dirs so
  incremental compilation works across runs
- Remove .cargo/config.toml from repo (add to .gitignore) since
  zigbuild handles cross-linker configuration
- Improve error messages: suggest cargo-zigbuild when linker not found
- Simplify CI to use zigbuild instead of per-target system linkers
- Simplify Makefile by removing setup-cross-compile/verify targets
- Update README and CLAUDE.md to reflect new approach

https://claude.ai/code/session_01EcsZDNeWn56wFqryb4Wq7r
This commit is contained in:
Claude 2026-03-17 20:33:41 +00:00
parent 68a9a86e1c
commit bb76a120c3
No known key found for this signature in database
8 changed files with 181 additions and 244 deletions

View file

@ -25,10 +25,10 @@ jobs:
toolchain: ${{ matrix.rust }}
targets: x86_64-unknown-linux-musl,aarch64-unknown-linux-musl
components: rustfmt,clippy
- name: Install cross-compilation tools for both architectures
- name: Install cargo-zigbuild and zig
run: |
sudo apt-get update
sudo apt-get install -y musl-tools gcc-aarch64-linux-gnu gcc-x86-64-linux-gnu
sudo snap install zig --classic --beta || sudo apt-get update && sudo apt-get install -y ziglang
cargo install cargo-zigbuild
- name: Cache cargo registry
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4
with:
@ -47,19 +47,6 @@ jobs:
- run: make check-fmt
- run: make lint
- name: Setup cargo config for CI cross-compilation
run: |
mkdir -p .cargo
cat > .cargo/config.toml << 'EOF'
[target.x86_64-unknown-linux-musl]
linker = "musl-gcc"
[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-gnu-gcc"
EOF
- run: make verify-cross-compile
- run: make build
- run: make test
- run: make test-e2e