Files
gbuild/README.md
T
Schmidt Peter 939232e72e Added features
Added: 
Project Overview TUI 
Build Cache / Dirty Detection
Post-Build Hooks
gbuild status
2026-05-23 21:03:54 +02:00

135 lines
3.6 KiB
Markdown

# gbuild
gbuild started as a bash script to stop me from typing the same git-clone,
cd, make sequence over and over. It's since been rewritten in C and grown a
few useful features — but the idea is still the same: one command to get
the latest code and build it.
---
## What it does
Run `gbuild` with no arguments and you get a project overview — every repo
you've built before, when you last built it, whether it passed or failed,
and the HEAD hash it was on. Pick one with J/K and hit Enter.
Run `gbuild myproject` to go straight to a specific project. If it hasn't
been cloned yet, gbuild clones it first. If it has, it pulls. Then it reads
your Makefile, shows you the targets, and you pick one. Pass `--target` if
you already know what you want and don't need the picker.
Every build gets logged to `~/.local/log/gbuild/`. Run `gbuild --logs` to
browse them — file list on the left, preview on the right, open anything in
`less` if you need the full output.
Configuration lives in `~/.gconfig`. Run `gconfig init` to create one, then
edit it with your git server URL and credentials. Token and password auth are
both supported.
---
## Dependencies
You'll need `gcc`, `make`, `git`, `less`, and the ncurses development headers.
Most systems have everything except the ncurses headers — the package is
usually called `libncurses-dev`, `ncurses-devel`, or just `ncurses` depending
on your distribution.
---
## Building
```sh
make
sudo make install
```
That puts `gbuild` and `gconfig` in `/usr/local/bin`. If you want them
somewhere else, `sudo make install PREFIX=/your/path`.
There's also `make release` which produces a source tarball, a stripped
binary tarball, a `.deb`, and an `.rpm` all in one go under `dist/`.
---
## Setup
```sh
gconfig init # creates ~/.gconfig with defaults
$EDITOR ~/.gconfig # fill in your server URL and credentials
gconfig show # check it looks right
gbuild # open the overview and pick something to build
```
Your `~/.gconfig` looks like this:
```ini
[git]
GIT_URL = http://localhost:3000
GIT_USER = myuser
[auth]
# token or password, leave the other blank
GIT_TOKEN =
GIT_PASSWORD =
[build]
DEFAULT_TARGET =
CLONE_DIR = ~/projects
[log]
LOG_ENABLED = true
LOG_DIR = ~/.local/log/gbuild
```
---
## Usage
```
gbuild open the project overview
gbuild <project> clone/pull and build
gbuild --target <t> <p> skip the picker, run target t
gbuild --logs open the log browser
gbuild --no-tui print usage (useful in scripts)
gbuild --url --user [username] [projectname] one-off config override
```
---
## gconfig
```
gconfig init create ~/.gconfig (won't overwrite)
gconfig init --force overwrite, backs up the old file first
gconfig show print config, masks auth fields
gconfig help
```
---
## Project layout
```
gbuild/
├── Makefile
├── README.md
├── include/
│ ├── config.h ~/.gconfig read/write
│ ├── git_ops.h clone, pull, HEAD hash
│ ├── index.h ~/.gbuild_index — persistent build history
│ ├── logger.h terminal output + log files
│ ├── make_ops.h Makefile parser and build runner
│ └── tui.h all three ncurses screens
├── pkg/
│ ├── deb/ .deb package templates
│ └── rpm/ .rpm spec template
└── src/
├── gbuild.c
├── gconfig.c
├── config.c
├── git_ops.c
├── index.c
├── logger.c
├── make_ops.c
└── tui.c
```
---
MIT Copyright (c) Schmidt Peter Daniel 2026