detached a40c85a

build: add an Arch package of HEAD and document installation

commit
a40c85a4e031fd34aa293a0473c31916f3896033
author
brice · · 2026-10-01 02:58 UTC
committer
brice · · 2026-10-01 03:03 UTC
parent
bde06e7
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
3 files · +73 -2
M Makefile +21 -1
@@ -1,4 +1,4 @@
1-.PHONY: bin build test vet race fmt-check mod-check mocks mocks-check fakes-check arch perf-check check
1+.PHONY: bin build test vet race fmt-check mod-check mocks mocks-check fakes-check arch perf-check check pkg install
22
33 GOBIN_DIR := $(or $(shell go env GOBIN),$(firstword $(subst :, ,$(shell go env GOPATH)))/bin)
44 MOCKERY ?= $(GOBIN_DIR)/mockery
@@ -60,3 +60,23 @@ perf-check:
6060 done
6161 NEFERCAP_REQUIRE_WAYLAND=1 CGO_ENABLED=0 go test $(PERF_PKGS) -run '$(PERF_RE)' -count=1
6262 check: fmt-check mod-check vet test arch fakes-check perf-check
63+
64+# Arch package of the committed HEAD (packaging/arch/PKGBUILD). Go modules
65+# come from the module proxy in prepare(); the build itself runs offline.
66+# pacman-ordered version: 0.0.0.r<commits>.g<hash>; a tag replaces 0.0.0.
67+pkg: SHELL := bash
68+pkg: .SHELLFLAGS := -eo pipefail -c
69+pkg:
70+ @test -z "$$(git status --porcelain)" || echo "warning: uncommitted changes are not packaged" >&2
71+ v=$$(t=$$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//; s/-/_/g'); \
72+ echo "$${t:-0.0.0}.r$$(git rev-list --count HEAD).g$$(git rev-parse --short HEAD)"); \
73+ d=$$(mktemp -d /tmp/nefercap-pkg.XXXXXX); trap 'rm -rf "$$d"' EXIT; \
74+ git archive --prefix=nefercap-$$v/ -o "$$d/nefercap-$$v.tar.gz" HEAD; \
75+ cp packaging/arch/PKGBUILD "$$d/"; \
76+ cd "$$d" && sed -i "s/^pkgver=.*/pkgver=$$v/; s/^sha256sums=.*/sha256sums=('$$(sha256sum *.tar.gz | cut -d' ' -f1)')/" PKGBUILD; \
77+ makepkg -f --noconfirm; mkdir -p $(CURDIR)/dist; rm -f $(CURDIR)/dist/nefercap-*.pkg.tar.zst; mv *.pkg.tar.zst $(CURDIR)/dist/
78+ @ls dist/*.pkg.tar.zst
79+
80+# Build the package, then install it with pacman (asks for sudo).
81+install: pkg
82+ sudo pacman -U dist/nefercap-*.pkg.tar.zst
@@ -1,4 +1,4 @@
1-.PHONY: bin build test vet race fmt-check mod-check mocks mocks-check fakes-check arch perf-check check1+.PHONY: bin build test vet race fmt-check mod-check mocks mocks-check fakes-check arch perf-check check pkg install
2 2
3 GOBIN_DIR := $(or $(shell go env GOBIN),$(firstword $(subst :, ,$(shell go env GOPATH)))/bin)3 GOBIN_DIR := $(or $(shell go env GOBIN),$(firstword $(subst :, ,$(shell go env GOPATH)))/bin)
4 MOCKERY ?= $(GOBIN_DIR)/mockery4 MOCKERY ?= $(GOBIN_DIR)/mockery
@@ -60,3 +60,23 @@ perf-check:
60 done60 done
61 NEFERCAP_REQUIRE_WAYLAND=1 CGO_ENABLED=0 go test $(PERF_PKGS) -run '$(PERF_RE)' -count=161 NEFERCAP_REQUIRE_WAYLAND=1 CGO_ENABLED=0 go test $(PERF_PKGS) -run '$(PERF_RE)' -count=1
62 check: fmt-check mod-check vet test arch fakes-check perf-check62 check: fmt-check mod-check vet test arch fakes-check perf-check
63+
64+# Arch package of the committed HEAD (packaging/arch/PKGBUILD). Go modules
65+# come from the module proxy in prepare(); the build itself runs offline.
66+# pacman-ordered version: 0.0.0.r<commits>.g<hash>; a tag replaces 0.0.0.
67+pkg: SHELL := bash
68+pkg: .SHELLFLAGS := -eo pipefail -c
69+pkg:
70+ @test -z "$$(git status --porcelain)" || echo "warning: uncommitted changes are not packaged" >&2
71+ v=$$(t=$$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//; s/-/_/g'); \
72+ echo "$${t:-0.0.0}.r$$(git rev-list --count HEAD).g$$(git rev-parse --short HEAD)"); \
73+ d=$$(mktemp -d /tmp/nefercap-pkg.XXXXXX); trap 'rm -rf "$$d"' EXIT; \
74+ git archive --prefix=nefercap-$$v/ -o "$$d/nefercap-$$v.tar.gz" HEAD; \
75+ cp packaging/arch/PKGBUILD "$$d/"; \
76+ cd "$$d" && sed -i "s/^pkgver=.*/pkgver=$$v/; s/^sha256sums=.*/sha256sums=('$$(sha256sum *.tar.gz | cut -d' ' -f1)')/" PKGBUILD; \
77+ makepkg -f --noconfirm; mkdir -p $(CURDIR)/dist; rm -f $(CURDIR)/dist/nefercap-*.pkg.tar.zst; mv *.pkg.tar.zst $(CURDIR)/dist/
78+ @ls dist/*.pkg.tar.zst
79+
80+# Build the package, then install it with pacman (asks for sudo).
81+install: pkg
82+ sudo pacman -U dist/nefercap-*.pkg.tar.zst
M README.md +11 -1
@@ -117,11 +117,21 @@ Output is SDR, and video is silent H.264 in fragmented MP4. Audio, pause and cur
117117
118118 ## Install
119119
120+On Arch Linux, install from the AUR:
121+
122+```sh
123+paru -S nefercap-bin # latest release, pre-built
124+paru -S nefercap-git # latest main, built from source
125+```
126+
127+Pre-built archives are on the [releases page](https://github.com/bnema/nefercap/releases). To build from a checkout:
128+
120129 ```sh
121130 make bin # builds bin/nefercap
131+make pkg # builds an Arch package of HEAD into dist/
122132 ```
123133
124-Install it as `/usr/bin/nefercap`: NeferWL allows that path to capture by default. Elsewhere (for example `~/.local/bin`, or `go run`), NeferWL refuses capture until root lists the path in `/etc/neferwl/capture-allow`.
134+The packages install `/usr/bin/nefercap`: NeferWL allows that path to capture by default. Elsewhere (for example `~/.local/bin`, or `go run`), NeferWL refuses capture until root lists the path in `/etc/neferwl/capture-allow`.
125135
126136 ## Development
127137
@@ -117,11 +117,21 @@ Output is SDR, and video is silent H.264 in fragmented MP4. Audio, pause and cur
117 117
118 ## Install118 ## Install
119 119
120+On Arch Linux, install from the AUR:
121+
122+```sh
123+paru -S nefercap-bin # latest release, pre-built
124+paru -S nefercap-git # latest main, built from source
125+```
126+
127+Pre-built archives are on the [releases page](https://github.com/bnema/nefercap/releases). To build from a checkout:
128+
120 ```sh129 ```sh
121 make bin # builds bin/nefercap130 make bin # builds bin/nefercap
131+make pkg # builds an Arch package of HEAD into dist/
122 ```132 ```
123 133
124-Install it as `/usr/bin/nefercap`: NeferWL allows that path to capture by default. Elsewhere (for example `~/.local/bin`, or `go run`), NeferWL refuses capture until root lists the path in `/etc/neferwl/capture-allow`.134+The packages install `/usr/bin/nefercap`: NeferWL allows that path to capture by default. Elsewhere (for example `~/.local/bin`, or `go run`), NeferWL refuses capture until root lists the path in `/etc/neferwl/capture-allow`.
125 135
126 ## Development136 ## Development
127 137
A packaging/arch/PKGBUILD +41 -0
@@ -0,0 +1,41 @@
1+# Built by `make pkg` at the repo root, from `git archive HEAD`.
2+pkgname=nefercap
3+pkgver=0.0.0
4+pkgrel=1
5+pkgdesc='Screenshots and silent screen recording for Wayland, from one shortcut'
6+arch=('x86_64' 'aarch64')
7+url='https://github.com/bnema/nefercap'
8+license=('GPL-3.0-only')
9+# Loaded at runtime (purego, no cgo): not seen by makepkg's library scan.
10+depends=('glibc' 'wayland' 'libxkbcommon' 'vulkan-icd-loader' 'vulkan-driver')
11+makedepends=('go>=2:1.27')
12+optdepends=('ffmpeg: screen recording (libx264)'
13+ 'wl-clipboard: copy screenshots to the clipboard'
14+ 'neferwl: hidden-workspace capture, HUD exclusion and capture indicator')
15+source=("$pkgname-$pkgver.tar.gz")
16+sha256sums=('SKIP')
17+
18+prepare() {
19+ cd "$pkgname-$pkgver"
20+ export GOPATH="$srcdir/gopath" GOFLAGS='-mod=readonly -modcacherw' GOWORK=off GOTOOLCHAIN=local
21+ go mod download
22+ go mod vendor
23+}
24+
25+build() {
26+ cd "$pkgname-$pkgver"
27+ export CGO_ENABLED=0 GOFLAGS='-mod=vendor -trimpath -buildvcs=false -buildmode=pie' GOPROXY=off GOWORK=off GOTOOLCHAIN=local
28+ go build -ldflags "-X main.version=$pkgver" -o nefercap ./cmd/nefercap
29+}
30+
31+check() {
32+ cd "$pkgname-$pkgver"
33+ ./nefercap version
34+}
35+
36+package() {
37+ cd "$pkgname-$pkgver"
38+ install -Dm755 nefercap "$pkgdir/usr/bin/nefercap"
39+ install -Dm644 README.md "$pkgdir/usr/share/doc/nefercap/README.md"
40+ install -Dm644 LICENSE "$pkgdir/usr/share/licenses/nefercap/LICENSE"
41+}
@@ -0,0 +1,41 @@
1+# Built by `make pkg` at the repo root, from `git archive HEAD`.
2+pkgname=nefercap
3+pkgver=0.0.0
4+pkgrel=1
5+pkgdesc='Screenshots and silent screen recording for Wayland, from one shortcut'
6+arch=('x86_64' 'aarch64')
7+url='https://github.com/bnema/nefercap'
8+license=('GPL-3.0-only')
9+# Loaded at runtime (purego, no cgo): not seen by makepkg's library scan.
10+depends=('glibc' 'wayland' 'libxkbcommon' 'vulkan-icd-loader' 'vulkan-driver')
11+makedepends=('go>=2:1.27')
12+optdepends=('ffmpeg: screen recording (libx264)'
13+ 'wl-clipboard: copy screenshots to the clipboard'
14+ 'neferwl: hidden-workspace capture, HUD exclusion and capture indicator')
15+source=("$pkgname-$pkgver.tar.gz")
16+sha256sums=('SKIP')
17+
18+prepare() {
19+ cd "$pkgname-$pkgver"
20+ export GOPATH="$srcdir/gopath" GOFLAGS='-mod=readonly -modcacherw' GOWORK=off GOTOOLCHAIN=local
21+ go mod download
22+ go mod vendor
23+}
24+
25+build() {
26+ cd "$pkgname-$pkgver"
27+ export CGO_ENABLED=0 GOFLAGS='-mod=vendor -trimpath -buildvcs=false -buildmode=pie' GOPROXY=off GOWORK=off GOTOOLCHAIN=local
28+ go build -ldflags "-X main.version=$pkgver" -o nefercap ./cmd/nefercap
29+}
30+
31+check() {
32+ cd "$pkgname-$pkgver"
33+ ./nefercap version
34+}
35+
36+package() {
37+ cd "$pkgname-$pkgver"
38+ install -Dm755 nefercap "$pkgdir/usr/bin/nefercap"
39+ install -Dm644 README.md "$pkgdir/usr/share/doc/nefercap/README.md"
40+ install -Dm644 LICENSE "$pkgdir/usr/share/licenses/nefercap/LICENSE"
41+}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 2

Tags 9

↑↓ moveenter openesc close