# $OpenBSD: Makefile,v 1.65 2021/12/17 13:59:13 ajacoutot Exp $

# XXX no i386 equivalent to mem_openbsd_amd64.go
ONLY_FOR_ARCHS=		amd64

COMMENT=		service discovery and configuration tool

VERSION=		1.11.1
# consul-vendored distfile generated by fetching archive from
# https://github.com/hashicorp/consul/archive/v$VERSION/consul-$VERSION.tar.gz
# and running "go mod tidy" + "go mod vendor"
DISTNAME=		consul-vendored-${VERSION}
PKGNAME=		consul-${VERSION}

CATEGORIES=		sysutils net

HOMEPAGE=		https://www.consul.io/

MAINTAINER=		Antoine Jacoutot <ajacoutot@openbsd.org>

# MPLv2.0
PERMIT_PACKAGE=		Yes

MASTER_SITES=		https://distfiles.bsdfrog.org/

WANTLIB += c pthread

MODULES=		lang/go

ALL_TARGET=		github.com/hashicorp/consul

# go/src/github.com/hashicorp/consul/scripts/build.sh
# go/src/github.com/hashicorp/consul/version/version.go
MODGO_LDFLAGS +=	-X github.com/hashicorp/consul/version.GitDescribe=${GH_TAGNAME}
MODGO_LDFLAGS +=	-X github.com/hashicorp/consul/version.Version=${GH_TAGNAME:S/v//}
MODGO_LDFLAGS +=	-X github.com/hashicorp/consul/version.VersionPrerelease="" # empty

post-install:
	${INSTALL_DATA_DIR} ${PREFIX}/share/examples/consul
	${SUBST_CMD} -c -m 0640 ${FILESDIR}/config.json.in \
		${PREFIX}/share/examples/consul/config.json

.include <bsd.port.mk>
