~bigbes/sr-ht-dolt

ref: 3b3d5b6a1437dff7ff9feae54f87667835b0371f sr-ht-dolt/APKBUILD -rw-r--r-- 3.0 KiB
3b3d5b6a — Eugene Blikh deps: bump sr-ht-ecore and auxilia to v0.7.0 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# 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.
pkgname=dolt.sr.ht
pkgver=0.0.0
pkgrel=0
pkgdesc="Dolt database hosting for a sourcehut instance"
url="https://sourcecraft.dev/bigbes/sr-ht-dolt"
arch="x86_64"
license="MIT"
# !check      — tests want a live Postgres and a chunk store
# !tracedeps  — CGO_ENABLED=0 with -tags gms_pure_go, so the binaries are
#               static: no ICU, no gozstd, nothing to trace
options="!check !tracedeps"
# The hook subpackage carries dolt-git-hook alone: it is installed into the
# git.sr.ht container (as its post-update-script), not the dolt one, and
# pulling the full service package in there would drag doltsrht along.
subpackages="$pkgname-hook:hook"

source=""
builddir="$startdir"

# The pure-Go build tag is what keeps this package free of cgo: it selects
# go-mysql-server's stdlib regexp instead of go-icu-regex (the SQL engine is
# never run here), and a replace directive backs gozstd with a klauspost shim.
# Dropping it would pull in libicu and make the package arch/libc-specific.
export GO_TAGS="gms_pure_go"

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"
	# `make all` is all-bin ONLY — this Makefile deliberately keeps the CSS off
	# the default path because sassc/minify aren't always on a dev machine. So
	# `css` has to be asked for by name; building `all` alone silently produces
	# a package with no stylesheet.
	CGO_ENABLED=0 make all-bin GO_TAGS="$GO_TAGS"
	# Needs the shared sourcehut scss partials pre-assembled at ASSETS/scss (no
	# apk ships them); CI does that before calling abuild.
	make css ASSETS=/usr/share/sourcehut

	# install-share copies static/*.css under `2>/dev/null || true`, so a
	# stylesheet that never got built would ship as an unstyled service without
	# failing anything. Assert it exists instead. The hashed copy is the one the
	# service finds by globbing its static dir at startup.
	ls static/main.min.*.css >/dev/null
}

package() {
	cd "$builddir"
	# This Makefile's install rules do not honour DESTDIR (they write to
	# $(BINDIR)/$(SHAREDIR) directly), so the staging dir is passed as PREFIX.
	# MIGRATIONDIR and STATICDIR are both derived from SHAREDIR, so they follow.
	make install PREFIX="$pkgdir/usr"
}

hook() {
	pkgdesc="post-update hook that provisions companion Dolt databases (for the git.sr.ht container)"
	amove usr/bin/dolt-git-hook
}