summaryrefslogtreecommitdiff
path: root/sysutils/beats/Makefile
blob: 28f66b7da6b8d65b273bb3d919a748cc34446cdf (plain)
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
# $NetBSD: Makefile,v 1.27 2018/03/30 11:56:25 bsiegert Exp $

DISTNAME=		beats-6.2.2
PKGREVISION=		2
CATEGORIES=		sysutils
MASTER_SITES=		${MASTER_SITE_GITHUB:=elastic/}
GITHUB_PROJECT=		beats
GITHUB_TAG=		v${PKGVERSION_NOREV}

MAINTAINER=		filip@joyent.com
HOMEPAGE=		https://www.elastic.co/products/beats
COMMENT=		Data Shippers for Elasticsearch
LICENSE=		apache-2.0

EXTRACT_USING=		bsdtar
USE_TOOLS+=		gmake

GO_DIST_BASE=		${PKGBASE}-${GITHUB_TAG:S/v//}
GO_SRCPATH=		github.com/elastic/beats

# Components to build/install
BEATS=			filebeat heartbeat metricbeat packetbeat

.for beat in ${BEATS}
CHECK_RELRO_SKIP+=	bin/${beat}
CONF_FILES+=		share/examples/beats/${beat}.yml			\
				${PKG_SYSCONFDIR}/${beat}.yml
.endfor

BEATS_DIR?=		${VARBASE}/db/beats
BEATS_LOGDIR?=		${VARBASE}/log/beats

FILES_SUBST+=		BEATS_DIR=${BEATS_DIR}
FILES_SUBST+=		BEATS_LOGDIR=${BEATS_LOGDIR}

PKG_SYSCONFSUBDIR=	beats

SMF_INSTANCES+=		${BEATS}

OWN_DIRS+=		${BEATS_DIR} ${BEATS_LOGDIR}

MAKE_ENV+=		GOPATH=${WRKDIR}:${PREFIX}/gopkg
MAKE_ENV+=		CGO_LDFLAGS="-L${BUILDLINK_PREFIX.libpcap}/lib ${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.libpcap}/lib"
BUILD_TARGET=		#

INSTALLATION_DIRS+=	bin share/examples/beats

do-build:
.for beat in ${BEATS}
	cd ${WRKSRC}/${beat} && ${BUILD_MAKE_CMD}
.endfor

do-install:
.for beat in ${BEATS}
	${INSTALL_PROGRAM} ${WRKSRC}/${beat}/${beat} ${DESTDIR}${PREFIX}/bin
	${INSTALL_DATA} ${WRKSRC}/${beat}/${beat}.reference.yml			\
		${DESTDIR}${PREFIX}/share/examples/beats
	${INSTALL_DATA} ${WRKSRC}/${beat}/${beat}.yml				\
		${DESTDIR}${PREFIX}/share/examples/beats
.endfor

.include "../../lang/go/go-package.mk"
.include "../../net/libpcap/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"