aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/ganglia-webfrontend/Makefile
blob: 414619e8b09096a5506c9f87d9462bf94b72ee32 (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
# Ports collection makefile for:    ganglia-webfrontend
# Date created:             Thu Fed 20, 2003
# Whom:                 Brooks Davis <brooks@freebsd.org>
#
# $FreeBSD$
#

PORTNAME=   webfrontend
PORTVERSION=    3.0.1
PORTREVISION=   1
CATEGORIES= sysutils net parallel www
MASTER_SITES=   ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ganglia
PKGNAMEPREFIX=  ganglia-
DISTNAME=   ganglia-${PORTVERSION}

MAINTAINER= brooks@FreeBSD.org
COMMENT=    "Ganglia cluster monitor, web frontend"

RUN_DEPENDS+=   ${LOCALBASE}/sbin/gmetad:${PORTSDIR}/sysutils/ganglia-monitor-core

PKGINSTALL= ${WRKDIR}/pkg-install
PKGMESSAGE= ${WRKDIR}/pkg-message

SUB_FILES+= pkg-install pkg-message
SUB_LIST+=  WEBFRONTDIR="${WEBFRONTDIR}"

PLIST_SUB+= WEBFRONTDIR="${WEBFRONTDIR}"

USE_REINPLACE=  yes
USE_PHP=    gd pcre xml
USE_BZIP2=  yes
WANT_PHP_MOD=   yes
WRKSRC=     ${WRKDIR}/${DISTNAME}/web

# The Ganglia Web Frontend port supports a number of options that may be
# tweaked at buildtime.  Perform a "make options" to see more
# information on these variables.
WEBFRONTDIR?=   www/ganglia
WWWOWN?=    www
WWWGRP?=    www

# Set custom variables:
#
PKGOPTS=    ${FILESDIR}/pkg-opts
EXCEPTFILES=    AUTHORS \
        ChangeLog \
        COPYING \
        Makefile.am \
        addons \
        version.php.in \
        webfrontend.spec
CPIOARGS=   --quiet -pdum -R
TMP_WEBFRONTDIR=    ${WRKDIR}/webfrontend

options:
    @ ${ECHO_MSG} "===>  Build options for ${PKGNAME}:"
    @ ${CAT} ${PKGOPTS}

post-extract:
.if !defined(BATCH)
    @ ${TEST} -r ${PKGOPTS} && \
        (${ECHO_MSG} '-------------------------------------------------------------------------'; \
         ${ECHO_MSG} 'Perform a "make options" to see a list of available installation options.'; \
         ${ECHO_MSG} '-------------------------------------------------------------------------')
.endif

post-patch:
    @ ${REINPLACE_CMD} -e "s|%%LOCALBASE%%|${LOCALBASE}|g" ${WRKSRC}/conf.php

do-build:
    @${MKDIR} -m 0755 ${TMP_WEBFRONTDIR}
    @cd ${WRKSRC} && ${FIND} * \( -name conf.php\* \
        ${EXCEPTFILES:S/^/-o -name /} -o -name \*.orig \) \
        -a -prune -o -print \
        | ${TAR} cTf - - | ${TAR} xUCf ${TMP_WEBFRONTDIR} -
    @${CP} ${WRKSRC}/conf.php ${TMP_WEBFRONTDIR}/conf.php.sample

do-install:
    @${MKDIR} -m 0755 ${PREFIX}/${WEBFRONTDIR}
    @${CHOWN} ${WWWOWN}:${WWWGRP} ${PREFIX}/${WEBFRONTDIR}
    @cd ${TMP_WEBFRONTDIR} && \
        ${FIND} . | \
        ${CPIO} ${CPIOARGS} ${WWWOWN}:${WWWGRP} ${PREFIX}/${WEBFRONTDIR}

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

build-plist:
    @${FIND} ${TMP_WEBFRONTDIR}/* -type f | \
        ${SED} -e 's|${TMP_WEBFRONTDIR}|%%WEBFRONTDIR%%|' | \
        ${SORT} > ${PLIST}
    @${FIND} ${TMP_WEBFRONTDIR}/* -type d | \
        ${SED} -e 's|${TMP_WEBFRONTDIR}|@dirrm %%WEBFRONTDIR%%|' | \
        ${SORT} -r >> ${PLIST}
    @${ECHO} '@unexec if cmp -s %D/%%WEBFRONTDIR%%/conf.php %D/%%WEBFRONTDIR%%/conf.php.sample ; then rm -f %D/%%WEBFRONTDIR%%/conf.php; fi' >> ${PLIST}
    @${ECHO} '@unexec rmdir %D/%%WEBFRONTDIR%% 2>/dev/null || (echo "Configuration information saved.  If you will *NOT* use this package anymore," && echo "please remove %D/%%WEBFRONTDIR%% and its contents manually.")' >> ${PLIST}

.include <bsd.port.mk>