2026-05-23 21:03:54 +02:00
|
|
|
# gbuild
|
2026-05-21 14:27:40 +02:00
|
|
|
|
2026-05-23 21:03:54 +02:00
|
|
|
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.
|
2026-05-21 14:27:40 +02:00
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
2026-05-23 21:03:54 +02:00
|
|
|
## What it does
|
2026-05-21 14:27:40 +02:00
|
|
|
|
2026-05-23 21:03:54 +02:00
|
|
|
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.
|
2026-05-21 14:27:40 +02:00
|
|
|
|
2026-05-23 21:03:54 +02:00
|
|
|
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.
|
2026-05-21 14:27:40 +02:00
|
|
|
|
2026-05-23 21:03:54 +02:00
|
|
|
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.
|
2026-05-21 14:27:40 +02:00
|
|
|
|
2026-05-23 21:03:54 +02:00
|
|
|
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.
|
2026-05-21 14:27:40 +02:00
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
2026-05-23 21:03:54 +02:00
|
|
|
## Dependencies
|
2026-05-21 14:27:40 +02:00
|
|
|
|
2026-05-23 21:03:54 +02:00
|
|
|
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.
|
2026-05-21 14:31:05 +02:00
|
|
|
|
2026-05-23 21:03:54 +02:00
|
|
|
---
|
2026-05-21 14:31:05 +02:00
|
|
|
|
2026-05-23 21:03:54 +02:00
|
|
|
## Building
|
2026-05-21 14:27:40 +02:00
|
|
|
|
2026-05-23 21:03:54 +02:00
|
|
|
```sh
|
2026-05-21 14:27:40 +02:00
|
|
|
make
|
|
|
|
|
sudo make install
|
|
|
|
|
```
|
|
|
|
|
|
2026-05-23 21:03:54 +02:00
|
|
|
That puts `gbuild` and `gconfig` in `/usr/local/bin`. If you want them
|
|
|
|
|
somewhere else, `sudo make install PREFIX=/your/path`.
|
2026-05-21 14:27:40 +02:00
|
|
|
|
2026-05-23 21:03:54 +02:00
|
|
|
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/`.
|
2026-05-21 14:27:40 +02:00
|
|
|
|
2026-05-23 21:03:54 +02:00
|
|
|
---
|
2026-05-21 14:27:40 +02:00
|
|
|
|
2026-05-23 21:03:54 +02:00
|
|
|
## Setup
|
2026-05-21 14:27:40 +02:00
|
|
|
|
2026-05-23 21:03:54 +02:00
|
|
|
```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
|
2026-05-21 14:27:40 +02:00
|
|
|
```
|
|
|
|
|
|
2026-05-23 21:03:54 +02:00
|
|
|
Your `~/.gconfig` looks like this:
|
2026-05-21 14:27:40 +02:00
|
|
|
|
|
|
|
|
```ini
|
|
|
|
|
[git]
|
|
|
|
|
GIT_URL = http://localhost:3000
|
2026-05-23 21:03:54 +02:00
|
|
|
GIT_USER = myuser
|
2026-05-21 14:27:40 +02:00
|
|
|
|
|
|
|
|
[auth]
|
2026-05-23 21:03:54 +02:00
|
|
|
# token or password, leave the other blank
|
2026-05-21 14:27:40 +02:00
|
|
|
GIT_TOKEN =
|
|
|
|
|
GIT_PASSWORD =
|
|
|
|
|
|
|
|
|
|
[build]
|
|
|
|
|
DEFAULT_TARGET =
|
|
|
|
|
CLONE_DIR = ~/projects
|
|
|
|
|
|
|
|
|
|
[log]
|
|
|
|
|
LOG_ENABLED = true
|
|
|
|
|
LOG_DIR = ~/.local/log/gbuild
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
```
|
2026-05-23 21:03:54 +02:00
|
|
|
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
|
2026-05-21 14:27:40 +02:00
|
|
|
```
|
|
|
|
|
---
|
|
|
|
|
|
2026-05-23 21:03:54 +02:00
|
|
|
## 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
|
|
|
|
|
```
|
2026-05-21 14:27:40 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Project layout
|
|
|
|
|
```
|
|
|
|
|
gbuild/
|
|
|
|
|
├── Makefile
|
|
|
|
|
├── README.md
|
|
|
|
|
├── include/
|
2026-05-23 21:03:54 +02:00
|
|
|
│ ├── 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
|
2026-05-21 14:27:40 +02:00
|
|
|
└── src/
|
2026-05-23 21:03:54 +02:00
|
|
|
├── gbuild.c
|
|
|
|
|
├── gconfig.c
|
|
|
|
|
├── config.c
|
|
|
|
|
├── git_ops.c
|
|
|
|
|
├── index.c
|
|
|
|
|
├── logger.c
|
|
|
|
|
├── make_ops.c
|
|
|
|
|
└── tui.c
|
2026-05-21 14:27:40 +02:00
|
|
|
```
|
|
|
|
|
---
|
|
|
|
|
|
2026-05-23 21:03:54 +02:00
|
|
|
MIT Copyright (c) Schmidt Peter Daniel 2026
|