FreeBSD port added to CVS
[public/netxms.git] / packages / freebsd / Makefile
CommitLineData
5125b6f7
VK
1# Ports collection makefile for: netxms
2# Date created: Jul 9 2007
3# Whom: Vladimir Ermakov <samflanker@gmail.com>
4#
5# $FreeBSD$
6#
7
8PORTNAME= netxms
9PORTVERSION= 0.2.18
10CATEGORIES= net-mgmt
11MASTER_SITES= http://www.netxms.org/download/
12
13MAINTAINER= samflanker@gmail.com
14COMMENT= NetXMS - network monitoring system
15
16NO_PACKAGE= yes
17GNU_CONFIGURE= yes
18CONFIGURE_TARGET= --build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
19
20CC= gcc
21CXX= g++
22
23USE_LDCONFIG= yes
24USE_OPENSSL= yes
25
26CFLAGS+= -I${LOCALBASE}/include
27LDFLAGS+= -L${LOCALBASE}/lib
28LDFLAGS+= -L${OPENSSLLIB} -lcrypto -lssl
29
30OPTIONS= SERVER "Install NetXMS server & agent" off\
31 CLIENT "Install NetXMS client" off \
32 AGENT "Install NetXMS agent" off \
33 NXHTTPD "Install web-interface" off \
34 MYSQL "Enable MySQL support" off \
35 PGSQL "Enable PostgreSQL support" off
36
37NETXMS_OWN= netxms
38NETXMS_GRP= netxms
39
40.include <bsd.port.pre.mk>
41
42.if !defined(WITH_SERVER)
43.if defined(WITH_MYSQL) || !defined(WITHOUT_PGSQL)
44IGNORE= is useless database support without a SERVER. Please (re)run 'make config' and choose SERVER with database
45.endif
46.endif
47
48.if defined(WITH_SERVER)
49.if defined(WITHOUT_MYSQL) && !defined(WITH_PGSQL)
50IGNORE= is useless without a database. Please (re)run 'make config' and choose one of PGSQL and MYSQL
51.endif
52USE_RC_SUBR+= netxmsd nxagentd
53CONFIGURE_ARGS+= --with-server
54PLIST_SUB+= SERVER=""
55.else
56PLIST_SUB+= SERVER="@comment " AGENT="@comment "
57.endif
58
59.if defined(WITH_CLIENT)
60CONFIGURE_ARGS+= --with-client
61PLIST_SUB+= CLIENT=""
62.else
63PLIST_SUB+= CLIENT="@comment "
64.endif
65
66.if defined(WITH_AGENT)
67.if defined(WITH_SERVER)
68IGNORE= is useles AGENT or SERVER. Please (re)run 'make config' and choose one of AGENT and SERVER
69.endif
70USE_RC_SUBR+= nxagentd
71CONFIGURE_ARGS+= --with-agent
72PLIST_SUB+= AGENT=""
73.else
74PLIST_SUB+= AGENT="@comment "
75.endif
76
77.if defined(WITH_NXHTTPD)
78USE_RC_SUBR+= nxhttpd
79CONFIGURE_ARGS+= --with-nxhttpd
80PLIST_SUB+= NXHTTPD=""
81LIB_DEPENDS= gd.4:${PORTSDIR}/graphics/gd
82.else
83PLIST_SUB+= NXHTTPD="@comment "
84.endif
85
86.if defined(WITH_MYSQL)
87CONFIGURE_ARGS+= --with-mysql
88PLIST_SUB+= MYSQL=""
89USE_MYSQL= yes
90.else
91PLIST_SUB+= MYSQL="@comment "
92.endif
93
94.if defined(WITH_PGSQL)
95CONFIGURE_ARGS+= --with-pgsql
96PLIST_SUB+= PGSQL=""
97USE_PGSQL= yes
98.else
99PLIST_SUB+= PGSQL="@comment "
100.endif
101
102pre-install:
103 @${SETENV} PKG_PREFIX=${PREFIX} \
104 ${SH} ${PKGINSTALL} ${PORTNAME} PRE-INSTALL
105.if defined(WITH_SERVER)
106 @if [ ! -f ${PREFIX}/etc/netxmsd.conf-dist ]; then \
107 ${CP} -p ${WRKSRC}/contrib/netxmsd.conf-dist ${PREFIX}/etc/netxmsd.conf-dist ; \
108 fi
109.endif
110.if defined(WITH_SERVER) || !defined(WITHOUT_AGENT)
111 @if [ ! -f ${PREFIX}/etc/nxagentd.conf-dist ]; then \
112 ${CP} -p ${WRKSRC}/contrib/nxagentd.conf-dist ${PREFIX}/etc/nxagentd.conf-dist ; \
113 fi
114.endif
115.if defined(WITH_NXHTTPD)
116 @if [ ! -f ${PREFIX}/etc/nxhttpd.conf-dist ]; then \
117 ${CP} -p ${WRKSRC}/contrib/nxhttpd.conf-dist ${PREFIX}/etc/nxhttpd.conf-dist ; \
118 fi
119.endif
120
121post-install:
122 @${SETENV} PKG_PREFIX=${PREFIX} \
123 ${SH} ${PKGINSTALL} ${PORTNAME} POST-INSTALL
124.if defined(WITH_SERVER)
125 ${CHOWN} ${NETXMS_OWN}:${NETXMS_GRP} ${PREFIX}/etc/netxmsd.conf-dist
126 ${CHOWN} ${NETXMS_OWN}:${NETXMS_GRP} ${PREFIX}/etc/nxagentd.conf-dist
127.endif
128.if defined(WITH_AGENT)
129 ${CHOWN} ${NETXMS_OWN}:${NETXMS_GRP} ${PREFIX}/etc/nxagentd.conf-dist
130.endif
131.if defined(WITH_NXHTTPD)
132 ${CHOWN} ${NETXMS_OWN}:${NETXMS_GRP} ${PREFIX}/etc/nxhttpd.conf-dist
133.endif
134
135post-deinstall:
136 @${SETENV} PKG_PREFIX=${PREFIX} \
137 ${SH} ${PKGDEINSTALL} ${PORTNAME} POST-DEINSTALL
138
139.include <bsd.port.post.mk>