just install: put the static binary on PATH
Installs ./freeqsay-static as freeqsay in ~/.local/bin, overridable by argument or PREFIX, with uninstall alongside. The recipe checks whether the target directory is actually on PATH and prints the export line when it is not — an install nobody can run is not an install. Also gives every recipe a single-line doc comment: just --list shows only the last line of a comment block, which had been mangling static and shot. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
b248dcf parent: ed15d1f modified
README.md +5 -0 | @@ -52,6 +52,7 @@ of them. | ||
| 52 | 52 | ```bash |
| 53 | 53 | just build # optimized binary → ./freeqsay |
| 54 | 54 | just static # fully static binary → ./freeqsay-static |
| 55 | +just install # static binary → ~/.local/bin/freeqsay | |
| 55 | 56 | just test # test suite |
| 56 | 57 | just run <handle> <message> # run from source, no build |
| 57 | 58 | just shot <handle> <message> # gapless termshot png |
| @@ -66,6 +67,10 @@ fetches that exact release asset, checks its hash and caches it. A static binary | ||
| 66 | 67 | `SSL_CERT_FILE` when resolving handles on a host without one at the default |
| 67 | 68 | path. |
| 68 | 69 | |
| 70 | +`just install` puts the static build on your PATH as `freeqsay`; it takes a | |
| 71 | +directory (`just install ~/bin`) or `PREFIX`, and says so when the target is | |
| 72 | +not actually on your PATH. `just uninstall` removes it again. | |
| 73 | + | |
| 69 | 74 | `nimble build` and `nimble test` work too. `-d:ssl` is set in `config.nims`, |
| 70 | 75 | since handle resolution goes over HTTPS through the stdlib client. |
| 71 | 76 | |
| @@ -52,6 +52,7 @@ of them. | |||
| 52 | ```bash | 52 | ```bash |
| 53 | just build # optimized binary → ./freeqsay | 53 | just build # optimized binary → ./freeqsay |
| 54 | just static # fully static binary → ./freeqsay-static | 54 | just static # fully static binary → ./freeqsay-static |
| 55 | +just install # static binary → ~/.local/bin/freeqsay | ||
| 55 | just test # test suite | 56 | just test # test suite |
| 56 | just run <handle> <message> # run from source, no build | 57 | just run <handle> <message> # run from source, no build |
| 57 | just shot <handle> <message> # gapless termshot png | 58 | just shot <handle> <message> # gapless termshot png |
| @@ -66,6 +67,10 @@ fetches that exact release asset, checks its hash and caches it. A static binary | |||
| 66 | `SSL_CERT_FILE` when resolving handles on a host without one at the default | 67 | `SSL_CERT_FILE` when resolving handles on a host without one at the default |
| 67 | path. | 68 | path. |
| 68 | 69 | ||
| 70 | +`just install` puts the static build on your PATH as `freeqsay`; it takes a | ||
| 71 | +directory (`just install ~/bin`) or `PREFIX`, and says so when the target is | ||
| 72 | +not actually on your PATH. `just uninstall` removes it again. | ||
| 73 | + | ||
| 69 | `nimble build` and `nimble test` work too. `-d:ssl` is set in `config.nims`, | 74 | `nimble build` and `nimble test` work too. `-d:ssl` is set in `config.nims`, |
| 70 | since handle resolution goes over HTTPS through the stdlib client. | 75 | since handle resolution goes over HTTPS through the stdlib client. |
| 71 | 76 | ||
modified
justfile +27 -6 | @@ -1,5 +1,7 @@ | ||
| 1 | 1 | # freeqsay recipes. Everything here assumes nim on PATH. |
| 2 | 2 | |
| 3 | +bindir := env_var_or_default("PREFIX", env_var("HOME") / ".local/bin") | |
| 4 | + | |
| 3 | 5 | # Show the recipes. |
| 4 | 6 | default: |
| 5 | 7 | @just --list |
| @@ -8,12 +10,32 @@ default: | ||
| 8 | 10 | build: |
| 9 | 11 | nim c -d:release -d:ssl --hints:off -o:freeqsay src/freeqsay.nim |
| 10 | 12 | |
| 11 | -# Fully static binary → ./freeqsay-static. No glibc, no dlopen'd OpenSSL, so it | |
| 12 | -# runs on any Linux. tools/nimstatic is a DotSlash file: the first run fetches | |
| 13 | -# the pinned nimstatic build, verifies its hash and caches it. | |
| 13 | +# Compile a fully static binary → ./freeqsay-static (no glibc, no dlopen'd TLS). | |
| 14 | 14 | static: |
| 15 | + # tools/nimstatic is a DotSlash file: the first run fetches the pinned | |
| 16 | + # nimstatic release, verifies its hash and caches it. | |
| 15 | 17 | ./tools/nimstatic src/freeqsay.nim -o freeqsay-static -- -d:ssl |
| 16 | 18 | |
| 19 | +# Install the static binary as `freeqsay` (default ~/.local/bin, or `just install ~/bin`). | |
| 20 | +install dir=bindir: static | |
| 21 | + #!/usr/bin/env bash | |
| 22 | + set -euo pipefail | |
| 23 | + mkdir -p "{{dir}}" | |
| 24 | + install -m755 freeqsay-static "{{dir}}/freeqsay" | |
| 25 | + echo "installed {{dir}}/freeqsay" | |
| 26 | + # An install nobody can run is not an install: say so now rather than let | |
| 27 | + # it be discovered later. | |
| 28 | + case ":$PATH:" in | |
| 29 | + *":{{dir}}:"*) "{{dir}}/freeqsay" did:plc:ewvi7nmzuoqusbcablsm7c4h "on your PATH" ;; | |
| 30 | + *) echo "note: {{dir}} is not on your PATH. Add to your shell profile:" | |
| 31 | + echo " export PATH=\"{{dir}}:\$PATH\"" ;; | |
| 32 | + esac | |
| 33 | + | |
| 34 | +# Remove an installed freeqsay. | |
| 35 | +uninstall dir=bindir: | |
| 36 | + rm -f "{{dir}}/freeqsay" | |
| 37 | + @echo "removed {{dir}}/freeqsay" | |
| 38 | + | |
| 17 | 39 | # Run the test suite. |
| 18 | 40 | test: |
| 19 | 41 | nim c -d:ssl --hints:off -r tests/test_avatar.nim |
| @@ -22,11 +44,10 @@ test: | ||
| 22 | 44 | run *args: |
| 23 | 45 | nim r -d:ssl --hints:off src/freeqsay.nim {{args}} |
| 24 | 46 | |
| 25 | -# Screenshot the output, gapless (termshot-tight sets lineSpacing 1.0): | |
| 26 | -# `just shot jay.bsky.team hello`. Writes freeqsay.png. | |
| 47 | +# Screenshot the output, gapless: `just shot jay.bsky.team hello`. | |
| 27 | 48 | shot *args: |
| 28 | 49 | termshot -c -C 80 -f freeqsay.png -- nim r -d:ssl --hints:off src/freeqsay.nim {{args}} |
| 29 | 50 | |
| 30 | 51 | # Remove build output and caches. |
| 31 | 52 | clean: |
| 32 | - rm -rf freeqsay tests/test_avatar nimcache tests/nimcache | |
| 53 | + rm -rf freeqsay freeqsay-static tests/test_avatar nimcache tests/nimcache | |
| @@ -1,5 +1,7 @@ | |||
| 1 | # freeqsay recipes. Everything here assumes nim on PATH. | 1 | # freeqsay recipes. Everything here assumes nim on PATH. |
| 2 | 2 | ||
| 3 | +bindir := env_var_or_default("PREFIX", env_var("HOME") / ".local/bin") | ||
| 4 | + | ||
| 3 | # Show the recipes. | 5 | # Show the recipes. |
| 4 | default: | 6 | default: |
| 5 | @just --list | 7 | @just --list |
| @@ -8,12 +10,32 @@ default: | |||
| 8 | build: | 10 | build: |
| 9 | nim c -d:release -d:ssl --hints:off -o:freeqsay src/freeqsay.nim | 11 | nim c -d:release -d:ssl --hints:off -o:freeqsay src/freeqsay.nim |
| 10 | 12 | ||
| 11 | -# Fully static binary → ./freeqsay-static. No glibc, no dlopen'd OpenSSL, so it | 13 | +# Compile a fully static binary → ./freeqsay-static (no glibc, no dlopen'd TLS). |
| 12 | -# runs on any Linux. tools/nimstatic is a DotSlash file: the first run fetches | ||
| 13 | -# the pinned nimstatic build, verifies its hash and caches it. | ||
| 14 | static: | 14 | static: |
| 15 | + # tools/nimstatic is a DotSlash file: the first run fetches the pinned | ||
| 16 | + # nimstatic release, verifies its hash and caches it. | ||
| 15 | ./tools/nimstatic src/freeqsay.nim -o freeqsay-static -- -d:ssl | 17 | ./tools/nimstatic src/freeqsay.nim -o freeqsay-static -- -d:ssl |
| 16 | 18 | ||
| 19 | +# Install the static binary as `freeqsay` (default ~/.local/bin, or `just install ~/bin`). | ||
| 20 | +install dir=bindir: static | ||
| 21 | + #!/usr/bin/env bash | ||
| 22 | + set -euo pipefail | ||
| 23 | + mkdir -p "{{dir}}" | ||
| 24 | + install -m755 freeqsay-static "{{dir}}/freeqsay" | ||
| 25 | + echo "installed {{dir}}/freeqsay" | ||
| 26 | + # An install nobody can run is not an install: say so now rather than let | ||
| 27 | + # it be discovered later. | ||
| 28 | + case ":$PATH:" in | ||
| 29 | + *":{{dir}}:"*) "{{dir}}/freeqsay" did:plc:ewvi7nmzuoqusbcablsm7c4h "on your PATH" ;; | ||
| 30 | + *) echo "note: {{dir}} is not on your PATH. Add to your shell profile:" | ||
| 31 | + echo " export PATH=\"{{dir}}:\$PATH\"" ;; | ||
| 32 | + esac | ||
| 33 | + | ||
| 34 | +# Remove an installed freeqsay. | ||
| 35 | +uninstall dir=bindir: | ||
| 36 | + rm -f "{{dir}}/freeqsay" | ||
| 37 | + @echo "removed {{dir}}/freeqsay" | ||
| 38 | + | ||
| 17 | # Run the test suite. | 39 | # Run the test suite. |
| 18 | test: | 40 | test: |
| 19 | nim c -d:ssl --hints:off -r tests/test_avatar.nim | 41 | nim c -d:ssl --hints:off -r tests/test_avatar.nim |
| @@ -22,11 +44,10 @@ test: | |||
| 22 | run *args: | 44 | run *args: |
| 23 | nim r -d:ssl --hints:off src/freeqsay.nim {{args}} | 45 | nim r -d:ssl --hints:off src/freeqsay.nim {{args}} |
| 24 | 46 | ||
| 25 | -# Screenshot the output, gapless (termshot-tight sets lineSpacing 1.0): | 47 | +# Screenshot the output, gapless: `just shot jay.bsky.team hello`. |
| 26 | -# `just shot jay.bsky.team hello`. Writes freeqsay.png. | ||
| 27 | shot *args: | 48 | shot *args: |
| 28 | termshot -c -C 80 -f freeqsay.png -- nim r -d:ssl --hints:off src/freeqsay.nim {{args}} | 49 | termshot -c -C 80 -f freeqsay.png -- nim r -d:ssl --hints:off src/freeqsay.nim {{args}} |
| 29 | 50 | ||
| 30 | # Remove build output and caches. | 51 | # Remove build output and caches. |
| 31 | clean: | 52 | clean: |
| 32 | - rm -rf freeqsay tests/test_avatar nimcache tests/nimcache | 53 | + rm -rf freeqsay freeqsay-static tests/test_avatar nimcache tests/nimcache |