- Add progress.zig for sync progress display - Add rsync placeholder and release binaries to assets/rsync/ |
||
|---|---|---|
| .. | ||
| rsync | ||
| README.md | ||
Rsync Binary Setup for Release Builds
Overview
This directory contains rsync binaries for the ML CLI:
rsync_placeholder.bin- Wrapper script for dev builds (calls system rsync)rsync_release_<os>_<arch>.bin- Static rsync binary for release builds (not in repo)
Build Modes
Development/Debug Builds
- Uses
rsync_placeholder.bin(98 bytes) - Calls system rsync via wrapper script
- Results in ~152KB CLI binary
- Requires rsync installed on the system
Release Builds (ReleaseSmall, ReleaseFast)
- Uses
rsync_release_<os>_<arch>.bin(static binary) - Fully self-contained, no dependencies
- Results in ~450-650KB CLI binary
- Works on any system without rsync installed
Preparing Release Binaries
Option 1: Build from Official Rsync Source (recommended)
On Linux:
cd cli
make build-rsync RSYNC_VERSION=3.3.0
Option 2: Build Rsync Yourself
# Download official source
curl -fsSL https://download.samba.org/pub/rsync/src/rsync-3.3.0.tar.gz -o rsync.tar.gz
tar -xzf rsync.tar.gz
cd rsync-3.3.0
# Configure & build
./configure --disable-xxhash --disable-zstd --disable-lz4
make
# Copy to assets (example)
cp rsync ../fetch_ml/cli/src/assets/rsync_release_linux_x86_64.bin
Option 3: Use System Rsync (Temporary)
For testing release builds without a static binary:
cd cli/src/assets
cp rsync_placeholder.bin rsync_release_linux_x86_64.bin
This will still use the wrapper, but allows builds to complete.
Verification
After placing the appropriate rsync_release_<os>_<arch>.bin:
# Verify it's executable (example)
file cli/src/assets/rsync_release_linux_x86_64.bin
# Test it (example)
./cli/src/assets/rsync_release_linux_x86_64.bin --version
# Build release
cd cli
zig build prod
# Check binary size
ls -lh zig-out/prod/ml
Notes
rsync_release.binis not tracked in git (add to .gitignore if needed)- Different platforms need different static binaries
- For cross-compilation, provide platform-specific binaries
- The wrapper approach for dev builds is intentional for fast iteration
SQLite Amalgamation Setup for Local Mode
Overview
This directory contains SQLite source for FetchML local mode:
sqlite_release_<os>_<arch>/- SQLite amalgamation for local mode (fetched, not in repo)sqlite3.c- Single-file SQLite implementationsqlite3.h- SQLite header file
Build Modes
Development/Debug Builds
- SQLite is compiled from source into the binary
- No system SQLite library required
- Results in ~500KB larger binary (includes SQLite)
- Zero external dependencies
Release Builds (ReleaseSmall, ReleaseFast)
- Same SQLite compilation, optimized with release flags
- Fully self-contained, no dependencies
- Works on any system without SQLite installed
Preparing SQLite
Option 1: Fetch from Official Source (recommended)
cd cli
make build-sqlite SQLITE_VERSION=3450000
Option 2: Download Yourself
# Download official amalgamation
SQLITE_VERSION=3450000
SQLITE_YEAR=2024
curl -fsSL "https://www.sqlite.org/${SQLITE_YEAR}/sqlite-amalgamation-${SQLITE_VERSION}.zip" -o sqlite.zip
unzip sqlite.zip
# Copy to assets (example)
os=$(uname -s | tr '[:upper:]' '[:lower:]')
arch=$(uname -m)
mkdir -p cli/src/assets/sqlite_release_${os}_${arch}
cp sqlite-amalgamation-${SQLITE_VERSION}/sqlite3.c cli/src/assets/sqlite_release_${os}_${arch}/
cp sqlite-amalgamation-${SQLITE_VERSION}/sqlite3.h cli/src/assets/sqlite_release_${os}_${arch}/
Verification
After fetching SQLite:
# Verify files exist
ls -lh cli/src/assets/sqlite_release_*/sqlite3.c
ls -lh cli/src/assets/sqlite_release_*/sqlite3.h
# Build CLI
cd cli
zig build prod
# Check binary works with local mode
./zig-out/bin/ml init
Notes
sqlite_release_*/directories are not tracked in git- SQLite is compiled directly into the binary (not linked)
- WAL mode is enabled for concurrent CLI writes and TUI reads
- The amalgamation approach matches SQLite's recommended embedding pattern