COMMENT =	command line tool for sr.ht

MODGO_MODNAME =	git.sr.ht/~xenrox/hut
MODGO_VERSION =	v0.9.0

DISTNAME =	hut-${MODGO_VERSION}

CATEGORIES =	devel

HOMEPAGE =	https://sr.ht/~xenrox/hut/

MAINTAINER =	Murilo Ijanc <murilo@ijanc.org>

# AGPLv3
PERMIT_PACKAGE =	Yes

WANTLIB +=	c pthread

MODULES =	lang/go

BUILD_DEPENDS =	textproc/scdoc

# the tagged sources still say 0.9.0-dev
MODGO_LDFLAGS +=	-X main.version=${MODGO_VERSION:S/^v//}

post-build:
	scdoc <${WRKSRC}/doc/hut.1.scd >${WRKBUILD}/hut.1
.for _s in bash fish zsh
	${MODGO_WORKSPACE}/bin/hut completion ${_s} >${WRKBUILD}/hut.${_s}
.endfor

post-install:
	${INSTALL_MAN} ${WRKBUILD}/hut.1 ${PREFIX}/man/man1
	${INSTALL_DATA_DIR} ${PREFIX}/share/bash-completion/completions \
		${PREFIX}/share/fish/vendor_completions.d \
		${PREFIX}/share/zsh/site-functions
	${INSTALL_DATA} ${WRKBUILD}/hut.bash \
		${PREFIX}/share/bash-completion/completions/hut
	${INSTALL_DATA} ${WRKBUILD}/hut.fish \
		${PREFIX}/share/fish/vendor_completions.d/hut.fish
	${INSTALL_DATA} ${WRKBUILD}/hut.zsh \
		${PREFIX}/share/zsh/site-functions/_hut

.include "modules.inc"

.include <bsd.port.mk>
