Index | Thread | Search

From:
Christoph Liebender <christoph@liebender.dev>
Subject:
[fix] www/anubis v1.17.1p0
To:
ports@openbsd.org
Date:
Fri, 2 May 2025 17:51:14 +0200

Download raw body.

Thread
Hi @ports,

I recently submitted a patch to update www/anubis to v1.17.0 that also 
got applied to 7.7-stable. Turns out that the build produces an 
executable that does not work correctly. Cause being upstream deciding 
to complicate the build process, such that just go.port.mk is not enough 
to build the package. Upstream provides a Makefile that includes the 
required steps to produce a working binary. However, this involves more 
build dependencies, and most notably, npm packages, for which the ports 
system doesn't have a module... (right?)

In any case, by submitting the initial faulty patch I feel responsible 
for the port's breakage, which is why attached you will find another 
patch for v1.17.0p0 that, at least, produces a working binary. However, 
I am not sure if the way I'm calling npm is the proper way, so the 
"comments?" really applies this time :)

In any case, go-away [1] might be worth to check out for a less 
opinionated, simpler setup alternative to anubis.

comments, ok?

- Christoph

[1] https://git.gammaspectra.live/git/go-away
diff --git a/www/anubis/Makefile b/www/anubis/Makefile
index fe090f96c21..a0a27d55781 100644
--- a/www/anubis/Makefile
+++ b/www/anubis/Makefile
@@ -4,6 +4,7 @@ MODGO_MODNAME=	github.com/TecharoHQ/anubis
 MODGO_VERSION=	v1.17.1
 
 DISTNAME=	anubis-${MODGO_VERSION}
+REVISION=	0
 
 CATEGORIES=	www
 
@@ -14,10 +15,22 @@ PERMIT_PACKAGE=	Yes
 
 WANTLIB=	c pthread
 
+BUILD_DEPENDS=	devel/esbuild archivers/zstd archivers/brotli shells/bash \
+		lang/node
+
 MODULES=	lang/go
 
 MODGO_LDFLAGS=	-X github.com/TecharoHQ/anubis.Version=${MODGO_VERSION:S/v//}
 
+pre-build:
+	sh -c "cd ${WRKSRC}; npm ci --cache ${WRKSRC}/npm-cache"
+
+	bash ${WRKSRC}/web/build.sh
+
+	# contents of ${WRKSRC}/xess/build.sh
+	node ${WRKSRC}/node_modules/.bin/postcss ${WRKSRC}/xess/xess.css \
+		-o ${WRKSRC}/xess/xess.min.css
+
 post-install:
 	rm ${PREFIX}/bin/containerbuild
 	${INSTALL_DATA_DIR} ${PREFIX}/share/examples/anubis