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 Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· 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 | |
| 2 | 2 | ||
| 3 | 3 | GOBIN_DIR := $(or $(shell go env GOBIN),$(firstword $(subst :, ,$(shell go env GOPATH)))/bin) | |
| 4 | 4 | MOCKERY ?= $(GOBIN_DIR)/mockery | |
| @@ -60,3 +60,23 @@ perf-check: | |||
| 60 | 60 | done | |
| 61 | 61 | NEFERCAP_REQUIRE_WAYLAND=1 CGO_ENABLED=0 go test $(PERF_PKGS) -run '$(PERF_RE)' -count=1 | |
| 62 | 62 | 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 check | 1 | + | .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)/mockery | 4 | MOCKERY ?= $(GOBIN_DIR)/mockery | ||
| @@ -60,3 +60,23 @@ perf-check: | |||||
| 60 | done | 60 | done | ||
| 61 | NEFERCAP_REQUIRE_WAYLAND=1 CGO_ENABLED=0 go test $(PERF_PKGS) -run '$(PERF_RE)' -count=1 | 61 | 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-check | 62 | 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 | |||
| 117 | 117 | ||
| 118 | 118 | ## 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 | 129 | ```sh | |
| 121 | 130 | 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 | 136 | ## Development | |
| 127 | 137 | ||
| @@ -117,11 +117,21 @@ Output is SDR, and video is silent H.264 in fragmented MP4. Audio, pause and cur | |||||
| 117 | 117 | ||||
| 118 | ## Install | 118 | ## 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 | ```sh | 129 | ```sh | ||
| 121 | make bin # builds bin/nefercap | 130 | 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 | ## Development | 136 | ## 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 | + | } | |||