aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/bsd.zenoss.mk
blob: 26d57cc3c4f61222be18eeb62199c3e53cf821a3 (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
#-*- mode: makefile; tab-width: 4; -*-
# ex:ts=4
#
# $FreeBSD$
#
# bsd.zenoss.mk - Support for Zenoss ports and Zenpacks.
#
# For FreeBSD committers:
# Please send all suggested changes to the maintainer instead of committing
# them to CVS yourself.

bsd_zenoss_mk_MAINTAINER=   zenoss@experts-exchange.com

BUILD_DEPENDS+= zenoss>=3.1.0:${PORTSDIR}/net-mgmt/zenoss
RUN_DEPENDS+=   zenoss>=3.1.0:${PORTSDIR}/net-mgmt/zenoss

FETCH_ARGS?=    -o - > ${DISTDIR}/${DISTFILES}

PKGNAMEPREFIX:= zenpack-${ZPACKGROUP}-

.if !defined(ZPACKGROUP)
IGNORE=         will not work with undefined ZPACKGROUP (ex: core,community,etc)
.endif
ZENHOME=        ${LOCALBASE}/zenoss
ZPACKHOME=      ${LOCALBASE}/zenoss/ZenPack
ZPACKPREFIX?=   ZenPacks.zenoss.
ZPACK?= ${ZPACKPREFIX}${PORTNAME}-${PORTVERSION}-${PYTHON_VERSION:S/thon//}.egg
PLIST_SUB+=     ZPACK=${ZPACK}
SUB_LIST+=      ZENHOME=${ZENHOME} \
                ZPACK=${ZPACK} \
                ZPACKHOME=${ZPACKHOME} \
                ZPACKPREFIX=${ZPACKPREFIX} \
                PORTNAME=${PORTNAME}
SUB_FILES+=     pkg-message pkg-deinstall

SHAREOWN=       zenoss
SHAREGRP=       zenoss

# zenoss provides its own python 2.6 - we build against that for
# application compatibility
PYTHON_VERSION= python2.6
PYTHON_CMD=     ${ZENHOME}/bin/python
PYSETUP=        ./setup.py

MAKE_ENV+=      ZENHOME=${ZENHOME} \
                INSTANCE_HOME=${ZENHOME} \
                PYTHONPATH=${ZENHOME}/lib/python \
                PATH=${ZENHOME}/bin:${PATH}

.if !defined(UID)
UID!=       /usr/bin/id -u
.endif

.if !target(do-build)
do-build:
. if ${UID} != 0 && !defined(INSTALL_AS_USER)
    @${ECHO_MSG} "===>  Switching to root credentials for '${.TARGET}' target"
    @cd ${.CURDIR} && \
        ${SU_CMD} "${MAKE} ${__softMAKEFLAGS} ${.TARGET}"
    @${ECHO_MSG} "===>  Returning to user credentials"
. else
    cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYSETUP} bdist_egg
. endif
.endif

.if !target(do-install)
do-install:
    ${MKDIR} ${ZPACKHOME}
    ${INSTALL_DATA} ${WRKSRC}/dist/${ZPACK} ${ZPACKHOME}
    @${CAT} ${PKGMESSAGE}
.endif