~bigbes/sr-ht-compare

ref: 0b9a8233d3735b5c609c92af5f0ac16d95c5e261 sr-ht-compare/APKBUILD -rw-r--r-- 2.1 KiB
0b9a8233 — bigbes deps: sr-ht-ecore whose middleware reports panics through slog 9 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Maintainer: bigbes <bigbes@gmail.com>
#
# Built by builds.sr.ht (.build.yml) and published to our own apk repo at
# repo.bigb.es/alpine/v3.22/bigbes. The srht deployment installs it from there
# instead of cloning and compiling this repo inside its Dockerfile.
#
# pkgver is rewritten by CI to 0.0.<commit count> before abuild runs — a
# monotonic, unique-per-commit version that the deployment can pin. The literal
# below is only what a local `abuild` would use.
pkgname=compare.sr.ht
pkgver=0.0.0
pkgrel=0
pkgdesc="Stateless diff/compare viewer for a sourcehut instance"
url="https://sourcecraft.dev/bigbes/sr-ht-compare"
arch="x86_64"
license="MIT"
# !check      — the Go tests need a live git.sr.ht API, not available in the VM
# !tracedeps  — CGO_ENABLED=0, so there are no shared-object deps to trace
options="!check !tracedeps"

# No source= : CI builds the checkout it was handed, so abuild works in place
# rather than fetching a tarball. builddir points at the repo root, which is the
# directory holding this APKBUILD.
source=""
builddir="$startdir"

build() {
	cd "$builddir"
	# abuild redirects GOCACHE into $tmpdir (wiped after packaging), and an
	# upstream typo makes GOMODCACHE follow GOCACHE's value rather than its
	# own. Re-pin both to the stable home locations here — after abuild's own
	# exports — so CI's cache_restore/cache_save tasks see them survive.
	export GOCACHE="$HOME/.cache/go-build"
	export GOMODCACHE="$HOME/go/pkg/mod"
	# web/static (bundle.js + hashed CSS) is committed and go:embed-ed, so
	# there is no `make css` / `make bundle` step here — see README.
	# -modcacherw matters beyond convenience: without it the module cache is
	# extracted read-only, and the CI cache tarball made from it can't be
	# unpacked on the next build (mkdir into 0555 dirs fails).
	CGO_ENABLED=0 make build GOFLAGS="-trimpath -modcacherw"
}

package() {
	cd "$builddir"
	# The Makefile honours DESTDIR; ASSETS must stay the real runtime path so
	# the binary's static-dir glob resolves after install.
	make install DESTDIR="$pkgdir" PREFIX=/usr ASSETS=/usr/share/sourcehut
}