commit 09b2213e78a95a05fec42efa8e334ded8d32b7ef
parent c7adf6fb145b50d5e016235d8f8c92b138465526
Author: Jack Mordaunt <jackmordaunt.dev@gmail.com>
Date: Wed, 23 Sep 2026 14:58:59 -0300
nativeaudio: add standard justfile
Same build, release, clean, test, install recipes as every other repository.
Diffstat:
2 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1 +1,2 @@
test.log
+/nativeaudio
diff --git a/justfile b/justfile
@@ -0,0 +1,47 @@
+# Standard recipes: build (debug), release, clean, test, install.
+
+bin := "nativeaudio"
+
+# `just` alone lists the recipes.
+default:
+ @just --list --unsorted
+
+# Debug build: symbols kept, for delve and stack traces.
+build:
+ go build -o {{bin}} ./cmd/nativeaudio
+
+# Optimised build: stripped, reproducible paths.
+release:
+ go build -trimpath -ldflags='-s -w' -o {{bin}} ./cmd/nativeaudio
+
+# Vet and run the tests.
+test:
+ go vet ./...
+ go test ./...
+
+# Remove build output and the Go build cache for this module.
+clean:
+ rm -f {{bin}}
+ go clean
+
+# Copy the release binary to a directory on PATH. An installed copy is replaced in
+# place; otherwise ~/.local/bin, ~/bin, GOBIN, GOPATH/bin, /usr/local/bin, else the
+# first writable PATH entry.
+install: release
+ #!/usr/bin/env bash
+ set -euo pipefail
+ dest=""
+ if existing=$(command -v {{bin}} 2>/dev/null) && [[ -w ${existing%/*} ]]; then
+ dest=${existing%/*}
+ fi
+ gopath=$(go env GOPATH 2>/dev/null || true); gobin=$(go env GOBIN 2>/dev/null || true)
+ for d in "$HOME/.local/bin" "$HOME/bin" "$gobin" "${gopath:+$gopath/bin}" /usr/local/bin; do
+ [[ -z $dest && -n $d && -d $d && -w $d && ":$PATH:" == *":$d:"* ]] && dest=$d
+ done
+ if [[ -z $dest ]]; then
+ IFS=: read -ra dirs <<<"$PATH"
+ for d in "${dirs[@]}"; do [[ -d $d && -w $d ]] && { dest=$d; break; }; done
+ fi
+ [[ -n $dest ]] || { echo "install: no writable directory on PATH" >&2; exit 1; }
+ install -m 755 {{bin}} "$dest/{{bin}}"
+ echo "installed $dest/{{bin}}"