Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .agents/resume
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# Fast reconnect/repair after orb pause. Do not install packages here.
set -euo pipefail

export CARGO_HOME="${CARGO_HOME:-$HOME/.cargo}"
export RUSTUP_HOME="${RUSTUP_HOME:-$HOME/.rustup}"
export PATH="${CARGO_HOME}/bin:${PATH}"

if [ -f "${CARGO_HOME}/env" ]; then
# shellcheck disable=SC1091
source "${CARGO_HOME}/env"
fi

if ! command -v rustc >/dev/null 2>&1; then
echo "[resume] rustc missing from PATH; run .agents/setup" >&2
exit 1
fi

if ! command -v cc >/dev/null 2>&1 && ! command -v gcc >/dev/null 2>&1; then
echo "[resume] C compiler missing; run .agents/setup" >&2
exit 1
fi
72 changes: 72 additions & 0 deletions .agents/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env bash
# Fresh-orb bootstrap for equilibrium-ffi (Rust library + optional eq CLI).
set -euo pipefail

log() { printf '[setup] %s\n' "$*"; }
step() {
local label="$1"
shift
local start
start="$(date +%s)"
log "start: ${label}"
"$@"
log "done: ${label} ($(( $(date +%s) - start ))s)"
}

need_apt() {
local pkg
for pkg in "$@"; do
if ! dpkg -s "$pkg" >/dev/null 2>&1; then
return 0
fi
done
return 1
}

if need_apt build-essential ca-certificates curl pkg-config; then
step "apt-get update" sudo apt-get update -qq
step "apt install build tools" sudo apt-get install -y --no-install-recommends \
build-essential ca-certificates curl pkg-config
else
log "apt packages already present"
fi

export CARGO_HOME="${CARGO_HOME:-$HOME/.cargo}"
export RUSTUP_HOME="${RUSTUP_HOME:-$HOME/.rustup}"
export PATH="${CARGO_HOME}/bin:${PATH}"

if ! command -v rustup >/dev/null 2>&1; then
step "install rustup" bash -c 'curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal'
else
log "rustup already installed"
fi
# shellcheck disable=SC1091
source "${CARGO_HOME}/env"

step "ensure stable toolchain" rustup toolchain install stable --profile minimal --no-self-update
step "ensure rustfmt+clippy" rustup component add rustfmt clippy --toolchain stable

# Persist PATH for later non-interactive login shells (Amp / services).
profile_marker="# equilibrium-ffi rustup PATH"
if ! grep -Fqx "$profile_marker" "$HOME/.bash_profile" 2>/dev/null; then
cat >> "$HOME/.bash_profile" <<EOF

$profile_marker
if [ -f "\$HOME/.cargo/env" ]; then
# shellcheck disable=SC1091
. "\$HOME/.cargo/env"
fi
EOF
log "appended rustup env to ~/.bash_profile"
else
log "rustup PATH already in ~/.bash_profile"
fi

if [ -f Cargo.toml ]; then
# This crate gitignores Cargo.lock (library crate); fetch latest resolved graph.
step "cargo fetch" cargo fetch
fi

log "rustc=$(command -v rustc) $(rustc --version)"
log "cargo=$(command -v cargo) $(cargo --version)"
log "cc=$(command -v cc || true)"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/target
Cargo.lock
.DS_Store
.amp/portals/*
equilibrium-rust/target
examples/*/target
examples/*/native
examples/*/build
examples/c-ffi/build
examples/c-ffi/*.so
examples/c-ffi/*.dylib
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
description = "Automatic C FFI generation for C-compiling languages (V, Zig, C++, C#, Rust, D, Nim, Odin) (unstable and in development)"
license = "ISC"
repository = "https://github.com/tschk/equilibrium"
exclude = ["AGENTS.md"]
exclude = ["AGENTS.md", ".agents", ".amp"]

[dependencies]
which = "6"
Expand Down
20 changes: 0 additions & 20 deletions examples/demo-app/build/math.c

This file was deleted.

Loading