summaryrefslogtreecommitdiff
path: root/sysutils/ganglia-monitor-core/Makefile
blob: 06f8882505e567be6e5e090cd7d78afcdeca714f (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112

PORTNAME=	monitor-core
PORTVERSION=	3.7.2
CATEGORIES=	sysutils net
MASTER_SITES=	SF/ganglia/ganglia%20monitoring%20core/${PORTVERSION}
PKGNAMEPREFIX=	ganglia-
.if defined(CLUSTER)
PKGNAMESUFFIX=	-${CLUSTER}
.endif
DISTNAME=	ganglia-${PORTVERSION}

MAINTAINER=	jwb@FreeBSD.org
COMMENT=	Ganglia cluster monitor, monitoring daemon

LICENSE=	BSD3CLAUSE
LICENSE_FILE=	${WRKSRC}/COPYING

LIB_DEPENDS=	libapr-1.so:devel/apr1 \
		libconfuse.so:devel/libconfuse \
		libpcre.so:devel/pcre \
		libexpat.so:textproc/expat2

USES=		libtool pkgconfig

GNU_CONFIGURE=	yes
CONFIGURE_ARGS=	--enable-setuid=ganglia --enable-setgid=ganglia \
		--disable-python
CONFIGURE_ENV=	GANGLIA_ACK_SYSCONFDIR=1
CFLAGS+=	-I${LOCALBASE}/include
LDFLAGS+=	-L${LOCALBASE}/lib

USERS=		ganglia
GROUPS=		ganglia

OPTIONS_DEFINE=	GMETAD
OPTIONS_DEFAULT=	GMETAD
GMETAD_DESC=	include gmetad

PLIST_SUB+=	PORTVERSION=${PORTVERSION}

SUB_FILES+=	pkg-message

INSTALL_TARGET=	install-strip

USE_RC_SUBR=	gmond

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MGMETAD}
USE_RC_SUBR+=	gmetad

LIB_DEPENDS+=	librrd.so:databases/rrdtool
CONFIGURE_ARGS+=	--with-gmetad
PLIST_SUB+=	GMETAD=""
SUB_LIST+=	GMETAD=""
.else
PLIST_SUB+=	GMETAD="@comment "
SUB_LIST+=	GMETAD="\#"
.endif

USE_LDCONFIG=	yes

CONF_DIR=	${PREFIX}/etc

MODULES=	modcpu.so \
		moddisk.so \
		modload.so \
		modmem.so \
		modmulticpu.so \
		modnet.so \
		modproc.so \
		modsys.so

# gmond.conf.5 and gmond.conf.html can be generated from conf.pod, but
# doing so requires perl installed in the build stage.
pre-configure:
	@${REINPLACE_CMD} \
		-e "s|/etc/ganglia/\(gm[a-z]*d.conf\)|${PREFIX}/etc/\1|g" \
		${WRKSRC}/README \
		${WRKSRC}/mans/gmetad.1 \
		${WRKSRC}/mans/gmond.1
	@${REINPLACE_CMD} -e "s|nobody|ganglia|g" \
		${WRKSRC}/gmetad/gmetad.conf.in \
		${WRKSRC}/gmond/conf.pod \
		${WRKSRC}/gmond/gmond.conf.5 \
		${WRKSRC}/gmond/gmond.conf.html

post-build:
	@${WRKSRC}/gmond/gmond -t > ${WRKDIR}/gmond.conf

post-install:
	${INSTALL_DATA} ${WRKDIR}/gmond.conf \
		${STAGEDIR}${PREFIX}/etc/gmond.conf.sample
.if ${PORT_OPTIONS:MGMETAD}
	${INSTALL_SCRIPT} ${FILESDIR}/gmetasnap.sh \
		${STAGEDIR}${PREFIX}/sbin/gmetasnap
	${INSTALL_DATA} ${WRKSRC}/gmetad/gmetad.conf \
		${STAGEDIR}${PREFIX}/etc/gmetad.conf.sample
	${INSTALL_MAN} ${WRKSRC}/mans/gmetad.1 \
		${STAGEDIR}${MANPREFIX}/man/man1
.endif
	${INSTALL_MAN} \
		${WRKSRC}/mans/gmetric.1 \
		${WRKSRC}/mans/gmond.1 \
		${WRKSRC}/mans/gstat.1 \
		${STAGEDIR}${MANPREFIX}/man/man1
	${INSTALL_MAN} ${WRKSRC}/gmond/gmond.conf.5 \
		${STAGEDIR}${MANPREFIX}/man/man5
	${MKDIR} ${STAGEDIR}/var/db/ganglia/rrds
	@${CHMOD} -R a+rX ${STAGEDIR}/var/db/ganglia

.include <bsd.port.mk>