# Maintainer: bigbes # # 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. 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 }