Building Baboon¶
Instructions for building Baboon from source.
Prerequisites¶
Required¶
- Go 1.21+: Download
- Git: For cloning the repository
Optional¶
- Nix: For reproducible builds
- Node.js 18+: For web frontend
- Make: For convenience targets
Quick Build¶
Clone and Build¶
Run¶
Using Nix¶
Nix provides the most reproducible build environment.
Enter Development Shell¶
This provides:
- Go compiler
- All Go dependencies
- Node.js and npm
- Development tools
Build with Nix¶
Run Directly¶
Using Make¶
The Makefile provides convenient targets:
Build Targets¶
Test Targets¶
Format Targets¶
Web Frontend¶
# Install npm dependencies
make web-install
# Start development server
make web-dev
# Build for production
make web-build
# Start backend + web together
make web-start
Cross-Compilation¶
Build for multiple platforms:
Linux¶
# AMD64
GOOS=linux GOARCH=amd64 go build -o baboon-linux-amd64 .
# ARM64
GOOS=linux GOARCH=arm64 go build -o baboon-linux-arm64 .
macOS¶
# Intel
GOOS=darwin GOARCH=amd64 go build -o baboon-darwin-amd64 .
# Apple Silicon
GOOS=darwin GOARCH=arm64 go build -o baboon-darwin-arm64 .
Windows¶
Package Building¶
DEB Package (Debian/Ubuntu)¶
# Create package structure
mkdir -p dist/baboon_1.0.0_amd64/DEBIAN
mkdir -p dist/baboon_1.0.0_amd64/usr/bin
# Copy binary
cp baboon dist/baboon_1.0.0_amd64/usr/bin/
# Create control file
cat > dist/baboon_1.0.0_amd64/DEBIAN/control << EOF
Package: baboon
Version: 1.0.0
Architecture: amd64
Maintainer: Tim Sutton <tim@example.com>
Description: Typing practice application
EOF
# Build package
dpkg-deb --build dist/baboon_1.0.0_amd64
RPM Package (Fedora/RHEL)¶
Create baboon.spec:
Name: baboon
Version: 1.0.0
Release: 1%{?dist}
Summary: Typing practice application
License: MIT
URL: https://github.com/timlinux/baboon
%description
A cross-platform typing practice application.
%install
mkdir -p %{buildroot}/usr/bin
install -m 755 baboon %{buildroot}/usr/bin/
%files
/usr/bin/baboon
Build with rpmbuild.
Build Optimisations¶
Smaller Binary¶
Static Binary¶
Version Information¶
Web Frontend Build¶
Development¶
Opens http://localhost:3000 with hot reload.
Production¶
Creates optimised build in web/build/.
Serving Production Build¶
# Using npx serve
npx serve -s web/build -l 3000
# Or copy to a web server
cp -r web/build/* /var/www/baboon/
Testing the Build¶
Verify Binary¶
Expected output:
Baboon - Typing Practice Application
Usage:
baboon [flags]
Flags:
-p Enable punctuation mode
-port int Server port (default 8787)
-server Run in server-only mode
-client Run in client-only mode
Run Tests¶
Check for Race Conditions¶
Continuous Integration¶
GitHub Actions¶
The repository includes CI workflows:
- test.yml: Runs tests on push/PR
- build.yml: Cross-platform build verification
- release.yml: Automated releases on tag push
Local CI Simulation¶
Troubleshooting¶
Missing Dependencies¶
Build Errors¶
Web Build Issues¶
Release Process¶
- Update version in code
- Update SPECIFICATION.md
- Update CHANGELOG
- Create git tag:
git tag v1.0.0 - Push tag:
git push origin v1.0.0 - GitHub Actions builds and publishes release
Next Steps¶
- Architecture - System design
- API Reference - REST API docs
- Contributing - How to contribute