mirror of
https://github.com/hanzoai/vm.git
synced 2026-10-01 00:47:56 +00:00
Crates keep their history: vm (lib, was shuru-vm), hanzo-vm (CLI package and binary, was shuru-cli), vm-guest, vm-proto, vm-proxy, vm-sdk, vm-store, vm-darwin, vm-linux; all at 0.1.0, Apache-2.0, hanzoai/vm. Config is vm.json, data lives in ~/.hanzo/vm (HANZO_VM_HOME), env vars are HANZO_VM_*, the guest runs as /usr/bin/vm-guest, and assets download from hanzoai/vm releases. The TypeScript SDK is @hanzo/vm. NOTICE credits shuru as the origin. prepare-rootfs.sh builds the image natively on arm64 Linux with mke2fs -d and re-execs in Docker only on macOS. Includes rustfmt over the tree and fixes for clippy 1.98 lints. Co-authored-by: Hanzo Dev <[email protected]>
60 lines
1.7 KiB
Makefile
60 lines
1.7 KiB
Makefile
guest_target := "aarch64-unknown-linux-musl"
|
|
binary := "target/debug/hanzo-vm"
|
|
data_dir := env_var_or_default("HANZO_VM_HOME", env_var("HOME") + "/.hanzo/vm")
|
|
|
|
# List available recipes
|
|
default:
|
|
@just --list
|
|
|
|
# Build the guest init binary (cross-compiled to aarch64 musl)
|
|
build-guest:
|
|
cargo build -p vm-guest --target {{ guest_target }} --release
|
|
|
|
# Build the CLI binary (debug)
|
|
build-cli:
|
|
cargo build -p hanzo-vm
|
|
|
|
# Codesign the CLI binary with the virtualization entitlement
|
|
codesign:
|
|
codesign --entitlements vm.entitlements --force -s - {{ binary }}
|
|
|
|
# Build everything: guest + CLI + codesign
|
|
build: build-guest build-cli codesign
|
|
|
|
# Build the kernel, initramfs and rootfs into the data dir
|
|
prepare-rootfs:
|
|
./scripts/prepare-rootfs.sh
|
|
|
|
# Run a command inside the VM
|
|
run *args:
|
|
{{ binary }} run -- {{ args }}
|
|
|
|
# Open an interactive shell in the VM
|
|
shell:
|
|
{{ binary }} run -- sh
|
|
|
|
# Full setup from scratch: rootfs + build
|
|
setup: prepare-rootfs build
|
|
|
|
# Check all crates compile (host targets only)
|
|
check:
|
|
cargo check --workspace
|
|
|
|
# Clippy with CI's settings
|
|
clippy:
|
|
cargo clippy --all-targets -- -D warnings
|
|
|
|
# Install the release binary to ~/.local/bin/hanzo-vm
|
|
install: build-guest
|
|
cargo build -p hanzo-vm --release
|
|
codesign --entitlements vm.entitlements --force -s - target/release/hanzo-vm
|
|
mkdir -p ~/.local/bin
|
|
cp target/release/hanzo-vm ~/.local/bin/hanzo-vm
|
|
mkdir -p {{ data_dir }}
|
|
cargo pkgid -p hanzo-vm | sed 's/.*#//' > {{ data_dir }}/VERSION
|
|
|
|
# Tag and push a release (runs .hanzo/workflows/release.yml)
|
|
release version:
|
|
git tag -a "v{{ version }}" -m "Release v{{ version }}"
|
|
git push origin "v{{ version }}"
|