6440eb79751a4dff9008ca0f2a68f84805c41fba
[public/netxms.git] / packages / freebsd / Makefile
1 # Ports collection makefile for: netxms
2 # Date created: Jul 9 2007
3 # Whom: Vladimir Ermakov <samflanker@gmail.com>
4 #
5 # $FreeBSD$
6 #
7
8 PORTNAME= netxms
9 PORTVERSION= 0.2.18
10 CATEGORIES= net-mgmt
11 MASTER_SITES= http://www.netxms.org/download/
12
13 MAINTAINER= samflanker@gmail.com
14 COMMENT= NetXMS - network monitoring system
15
16 NO_PACKAGE= yes
17 GNU_CONFIGURE= yes
18 CONFIGURE_TARGET= --build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
19
20 CC= gcc
21 CXX= g++
22
23 USE_LDCONFIG= yes
24 USE_OPENSSL= yes
25
26 CFLAGS+= -I${LOCALBASE}/include
27 LDFLAGS+= -L${LOCALBASE}/lib
28 LDFLAGS+= -L${OPENSSLLIB} -lcrypto -lssl
29
30 OPTIONS= 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
37 NETXMS_OWN= netxms
38 NETXMS_GRP= netxms
39
40 .include <bsd.port.pre.mk>
41
42 .if !defined(WITH_SERVER)
43 .if defined(WITH_MYSQL) || !defined(WITHOUT_PGSQL)
44 IGNORE= 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)
50 IGNORE= is useless without a database. Please (re)run 'make config' and choose one of PGSQL and MYSQL
51 .endif
52 USE_RC_SUBR+= netxmsd nxagentd
53 CONFIGURE_ARGS+= --with-server
54 PLIST_SUB+= SERVER=""
55 .else
56 PLIST_SUB+= SERVER="@comment " AGENT="@comment "
57 .endif
58
59 .if defined(WITH_CLIENT)
60 CONFIGURE_ARGS+= --with-client
61 PLIST_SUB+= CLIENT=""
62 .else
63 PLIST_SUB+= CLIENT="@comment "
64 .endif
65
66 .if defined(WITH_AGENT)
67 .if defined(WITH_SERVER)
68 IGNORE= is useles AGENT or SERVER. Please (re)run 'make config' and choose one of AGENT and SERVER
69 .endif
70 USE_RC_SUBR+= nxagentd
71 CONFIGURE_ARGS+= --with-agent
72 PLIST_SUB+= AGENT=""
73 .else
74 PLIST_SUB+= AGENT="@comment "
75 .endif
76
77 .if defined(WITH_NXHTTPD)
78 USE_RC_SUBR+= nxhttpd
79 CONFIGURE_ARGS+= --with-nxhttpd
80 PLIST_SUB+= NXHTTPD=""
81 LIB_DEPENDS= gd.4:${PORTSDIR}/graphics/gd
82 .else
83 PLIST_SUB+= NXHTTPD="@comment "
84 .endif
85
86 .if defined(WITH_MYSQL)
87 CONFIGURE_ARGS+= --with-mysql
88 PLIST_SUB+= MYSQL=""
89 USE_MYSQL= yes
90 .else
91 PLIST_SUB+= MYSQL="@comment "
92 .endif
93
94 .if defined(WITH_PGSQL)
95 CONFIGURE_ARGS+= --with-pgsql
96 PLIST_SUB+= PGSQL=""
97 USE_PGSQL= yes
98 .else
99 PLIST_SUB+= PGSQL="@comment "
100 .endif
101
102 pre-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
121 post-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
135 post-deinstall:
136 @${SETENV} PKG_PREFIX=${PREFIX} \
137 ${SH} ${PKGDEINSTALL} ${PORTNAME} POST-DEINSTALL
138
139 .include <bsd.port.post.mk>