- Fix commands.zig imports (logs.zig → log.zig, remove missing modules) - Fix manifest.writeManifest to accept allocator param - Add db.Stmt type alias for sqlite3_stmt - Fix rsync placeholder to be valid shell script (#!/bin/sh) |
||
|---|---|---|
| .. | ||
| rsync | ||
| sqlite | ||
| 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/rsync_release.bin- Static rsync binary for release builds (symlink to placeholder)rsync/rsync_release_<os>_<arch>.bin- Downloaded static binary (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/rsync_release_<os>_<arch>.bin(downloaded static binary) - Falls back to
rsync/rsync_release.bin(symlink to placeholder) if platform-specific not found - 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/rsync_release_linux_x86_64.bin
Option 3: Use System Rsync (Temporary)
For testing release builds without a static binary:
cd cli/src/assets/rsync
ln -sf rsync_placeholder.bin rsync_release.bin
This will still use the wrapper, but allows builds to complete.
Verification
After placing the appropriate rsync/rsync_release_<os>_<arch>.bin:
# Verify it's executable (example)
file cli/src/assets/rsync/rsync_release_linux_x86_64.bin
# Test it (example)
./cli/src/assets/rsync/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/rsync_release_<os>_<arch>.binis not tracked in git- 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_<os>_<arch>/- SQLite amalgamation for release builds (fetched, not in repo)sqlite3.c- Single-file SQLite implementationsqlite3.h- SQLite header file
Build Modes
Development/Debug Builds
- Links against system SQLite library (
libsqlite3) - Requires SQLite installed on system
- Faster builds, smaller binary
Release Builds (ReleaseSmall, ReleaseFast)
- Compiles SQLite from downloaded amalgamation
- Self-contained, no external dependencies
- Works on any system without SQLite installed
Preparing SQLite
Option 1: Fetch from Official Source (recommended)
cd cli
make build-sqlite SQLITE_VERSION=3480000
Option 2: Download Yourself
# Download official amalgamation
SQLITE_VERSION=3480000
SQLITE_YEAR=2025
cd cli
make build-sqlite
# Output: src/assets/sqlite_<os>_<arch>/
Verification
After fetching SQLite:
# Verify files exist (example for darwin/arm64)
ls -lh cli/src/assets/sqlite_darwin_arm64/sqlite3.c
ls -lh cli/src/assets/sqlite_darwin_arm64/sqlite3.h
# Build CLI
cd cli
zig build prod
# Check binary works with local mode
./zig-out/bin/ml init
Notes
sqlite_<os>_<arch>/directories are not tracked in git- Dev builds use system SQLite; release builds embed amalgamation
- WAL mode is enabled for concurrent CLI writes and TUI reads
- The amalgamation approach matches SQLite's recommended embedding pattern