Skip to content

Building from Source

Alejandro Quintanar edited this page Nov 30, 2025 · 1 revision

Building from Source

Guide for building TERM39 from source code.


Prerequisites

Rust Toolchain

Install Rust via rustup:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Minimum version: Rust 1.70+

Platform-Specific Dependencies

Linux (Debian/Ubuntu)

# For clipboard support
sudo apt install libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev

# For framebuffer fonts
sudo apt install kbd unifont

Linux (Fedora/RHEL)

sudo dnf install libxcb-devel

macOS

No additional dependencies required. Xcode Command Line Tools recommended:

xcode-select --install

Windows

No additional dependencies required. Visual Studio Build Tools recommended.


Clone Repository

git clone https://github.com/alejandroqh/term39.git
cd term39

Build Commands

Standard Build

# Debug build (faster compile, slower runtime)
cargo build

# Release build (optimized)
cargo build --release

Feature-Specific Builds

# Full features (default on Linux)
cargo build --release

# Without framebuffer (smaller binary)
cargo build --release --no-default-features --features clipboard,battery

# Without clipboard (for servers/containers)
cargo build --release --no-default-features --features battery

# Minimal build
cargo build --release --no-default-features

Cross-Compilation

# Add target
rustup target add x86_64-unknown-linux-musl

# Build for target
cargo build --release --target x86_64-unknown-linux-musl

Run

# Debug build
cargo run

# Release build
cargo run --release

# With arguments
cargo run --release -- --ascii --theme dark

Testing

# Run all tests
cargo test

# Run specific test
cargo test test_name

# Run tests with output
cargo test -- --nocapture

Code Quality

# Lint with Clippy
cargo clippy

# Format code
cargo fmt

# Check formatting
cargo fmt -- --check

# Full check (compile without building)
cargo check

Documentation

# Generate docs
cargo doc

# Generate and open docs
cargo doc --open

Build Artifacts

After building, the binary is located at:

Build Type Location
Debug target/debug/term39
Release target/release/term39
Cross-compile target/<target>/release/term39

Installation from Build

# Install to ~/.cargo/bin
cargo install --path .

# Or copy manually
sudo cp target/release/term39 /usr/local/bin/

Cargo Features

Feature Default Description
clipboard ON System clipboard via arboard
framebuffer-backend ON (Linux) Linux framebuffer rendering
battery ON Battery status indicator

Feature Combinations

# All features
cargo build --release --all-features

# Specific features
cargo build --release --features "clipboard,battery"

# No default features
cargo build --release --no-default-features

# No defaults + specific
cargo build --release --no-default-features --features clipboard

Troubleshooting

"linker cc not found"

Install build essentials:

# Debian/Ubuntu
sudo apt install build-essential

# Fedora
sudo dnf install gcc

"xcb" errors on Linux

Install X11 development libraries:

sudo apt install libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev

Slow builds

Use incremental compilation (default) and consider:

# Use mold linker (faster linking)
cargo install mold
RUSTFLAGS="-C link-arg=-fuse-ld=mold" cargo build --release

Build cache issues

cargo clean
cargo build --release

CI/CD

The project uses GitHub Actions for CI. See .github/workflows/ for:

  • ci.yml - Continuous integration (test, lint, format)
  • release.yml - Release builds for all platforms

See Also

Clone this wiki locally