aboutsummaryrefslogtreecommitdiff
path: root/sysutils/ganglia-monitor-core/Makefile
blob: be090e25b5d8866a01a97cadfabfd6b79c67a50f (plain) (blame)
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Ports collection makefile for:	ganglia-monitor-core
# Date created:				Wed Jan 23, 2003
# Whom:					Brooks Davis <brooks@freebsd.org>
#
# $FreeBSD$
#

PORTNAME=	monitor-core
PORTVERSION=	3.0.1
PORTREVISION=	0
CATEGORIES=	sysutils net parallel
.if !defined(PORTDEV)
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
.else
MASTER_SITES=	http://matt-massie.com/%SUBDIR%/
.endif
MASTER_SITE_SUBDIR=	ganglia
PKGNAMEPREFIX=	ganglia-
.if defined(CLUSTER)
PKGNAMESUFFIX=	-${CLUSTER}
.endif
DISTNAME=	ganglia-${PORTVERSION}

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

PKGINSTALL=	${WRKSRC}/pkg-install

OPTIONS+=	GMETAD "include gmetad" on \
		LIBGANGLIA "include libganglia" off

GNU_CONFIGURE=	yes
CONFIGURE_ENV=	CFLAGS="${_CFLAGS}" LDFLAGS="${_LDFLAGS}"
_CFLAGS=	${CFLAGS} -I${LOCALBASE}/include ${PTHREAD_CFLAGS}
_LDFLAGS=	${LDFLAGS} -L${LOCALBASE}/lib

USE_REINPLACE=	yes
USE_BZIP2=	yes
USE_RC_SUBR=	ganglia.sh

SUB_FILES=	pkg-install

.if defined (GMETAD_CONF)
.if !exists (${GMETAD_CONF})
IGNORE=		 "GMETAD_CONF must point to an existing file when defined"
.endif
.else
GMETAD_CONF=	${WRKSRC}/gmetad/gmetad.conf
.endif

.if defined (GMOND_CONF)
.if !exists (${GMOND_CONF})
IGNORE=		"GMOND_CONF must point to an existing file when defined"
.endif
.else
GMOND_CONF=	${WRKDIR}/gmond.conf
.endif

.include <bsd.port.pre.mk>

.if defined (WITH_GMETAD)
LIB_DEPENDS=	rrd.0:${PORTSDIR}/net/rrdtool
CONFIGURE_ARGS+=	--with-gmetad
PLIST_SUB+=	GMETAD=
SUB_LIST+=	GMETAD=
.else
PLIST_SUB+=	GMETAD="@comment "
SUB_LIST+=	GMETAD="\#"
.endif

.if defined (WITH_LIBGANGLIA)
INSTALLS_SHLIB=	yes
PLIST_SUB+=	LIBGANGLIA=
.else
PLIST_SUB+=	LIBGANGLIA="@comment "
.endif

MAN1=		gmetric.1 gmond.1 gstat.1
.if defined (WITH_GMETAD)
MAN1+=		gmetad.1
.endif
MAN5=		gmond.conf.5

CONF_DIR=	${PREFIX}/etc

FIX_CONF_FILES=	ganglia.pod \
		mans/gmetad.1 \
		mans/gmond.1 \
		gmetad/cmdline.c \
		gmetad/cmdline.h \
		gmond/g25_config.h \
		gmetric/cmdline.c \
		gmetric/cmdline.h \
		gmond/cmdline.c \
		gmond/cmdline.h
FIX_DB_FILES=	ganglia.pod \
		gmetad/conf.c \
		gmetad/gmetad.conf

post-patch:
	${REINPLACE_CMD} -e "s|/etc/\(gm[a-z]*d.conf\)|${PREFIX}/etc/\1|g" \
	    ${FIX_CONF_FILES:S|^|${WRKSRC}/|}
	${REINPLACE_CMD} -e "s|/var/lib/ganglia|/var/db/ganglia|g" \
	    ${FIX_DB_FILES:S|^|${WRKSRC}/|}

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

do-install:
.if defined (WITH_GMETAD)
	cd ${WRKSRC}/gmetad && make install
	${INSTALL_MAN} ${WRKSRC}/mans/gmetad.1 ${MANPREFIX}/man/man1
	${INSTALL_DATA} ${GMETAD_CONF} ${PREFIX}/etc/gmetad.conf.sample
.endif
	cd ${WRKSRC}/gmetric && make install
	${INSTALL_MAN} ${WRKSRC}/mans/gmetric.1 ${MANPREFIX}/man/man1
	cd ${WRKSRC}/gmond && make install
	${INSTALL_MAN} ${WRKSRC}/mans/gmond.1 ${MANPREFIX}/man/man1
	${INSTALL_MAN} ${WRKSRC}/gmond/gmond.conf.5 ${MANPREFIX}/man/man5
	${INSTALL_MAN} ${WRKSRC}/mans/gstat.1 ${MANPREFIX}/man/man1
	${INSTALL_DATA} ${GMOND_CONF} ${PREFIX}/etc/gmond.conf.sample
.if defined (WITH_LIBGANGLIA)
	cd ${WRKSRC}/lib && make install
	${INSTALL_SCRIPT} ${WRKSRC}/ganglia-config ${PREFIX}/bin
.endif

post-install:
	${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL

.include <bsd.port.post.mk>