Skip to content

Commit

Permalink
docs(README): differentiate build instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
synackd committed Dec 30, 2024
1 parent 1c055bf commit 2a54540
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,33 +112,36 @@ null

## Building

### Bare Metal
### Goreleaser

Linker flags are used to embed build metadata into the binary. Building can
simply be done via:
Goreleaser is the way ochami gets built for releases, and is the officially
supported build method for troubleshooting.

```bash
make
export GOVERSION=$(go env GOVERSION)
export BUILD_HOST=$(hostname)
export BUILD_USER=$(whoami)
goreleaser build --clean --snapshot --single-target
```

If you need to build without `make`, populating the build metadata and building
can be done manually via:
Remove `--single-target` to build for all targets.

### Make

Make provides convenient and quick building for fast iteration and development.

Linker flags are used to embed build metadata into the binary. Building can
simply be done via:

```bash
IMPORT=github.com/OpenCHAMI/ochami/
VERSION="$(git describe --tags --always --abbrev=0)"
BUILD="$(git rev-parse --short HEAD)"
LDFLAGS="-s -X=${IMPORT}internal/version.Version=${VERSION} -X=${IMPORT}internal/version.Commit=${BUILD} -X=${IMPORT}internal/version.Date=$(date -Iseconds)"
go build -v -ldflags="${LDFLAGS}"
make
```

It can be verified if the build info got embedded by running the `version`
subcommand. If the output is all zeros (like in the below incantation), then the
build info did *not* get embedded.
On Unix-like systems, one can also install the binary, man pages, and
completions:

```bash
$ ochami version --all
v0.0.0 0000000 @ 0000-00-00:00:00:00
sudo make install
```

## Container
Expand Down

0 comments on commit 2a54540

Please sign in to comment.