summaryrefslogtreecommitdiffstats
path: root/net-mgmt/netams/Makefile
blob: 462869026787b5b7b0e1ac15f62784e9671da53e (plain)
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
# New ports collection makefile for: NetAMS
# Date created:        24 December 2003
# Whom: 	       jura@netams.com
#
# $FreeBSD$
#

PORTNAME=	netams
PORTVERSION=	3.3.0
CATEGORIES=	net-mgmt
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE} \
		http://www.netams.com/files/
MASTER_SITE_SUBDIR=	${PORTNAME}
DISTNAME=	${PORTNAME}-${PORTVERSION}

MAINTAINER=	jura@netams.com
COMMENT=	Network Traffic Accounting and Monitoring Software

NO_PACKAGE=	Depends on kernel

USE_SUBMAKE=	yes
USE_REINPLACE=	yes
MANCOMPRESSED=	no

SCRIPTS_ENV=	WRKDIRPREFIX="${WRKDIRPREFIX}" \
		PREFIX="${PREFIX}" \
		TOUCH="${TOUCH}" \
		MKDIR="${MKDIR}" \
		REALCURDIR="${.CURDIR}"

ADMINCGI=	.htaccess index.cgi policy.cgi showusercard.cgi user.cgi  \
		access.cgi login.cgi quota.cgi showusercard.tmpl view.cgi \
		account.cgi netams.cgi radius.cgi subplan.cgi config.cgi  \
		plan.cgi russian.res unit.cgi
CGI=		.htaccess config.cgi netams_api.pl russian.res \
		netams_example.cgi usertool.cgi admintool.cgi login.cgi \
		netams_graph.cgi
IMAGES=		logo.gif logo-small.gif admintool-logo.gif showtable-logo.gif
MAN8=		netams.8 flowprobe.8 netamsctl.8

SYSDIR?=	/sys

OPTIONS=	DEBUG	"Build with debug symbols"			off \
		BW	"Build with bandwidth limitation functionality"	off \
		HASH	"Build with HASH support"			off

.include <bsd.port.pre.mk>

.if !exists(${SYSDIR})
IGNORE=		Could not find the kernel sources in ${SYSDIR}. Please define SYSDIR
.endif

post-patch:
	@${REINPLACE_CMD} -E 's/^(CC).*/\1=$$(CXX)/; s|^(INCLUDE=).*|\1 ${LOCALBASE}/include|; s|^(CFLAGS).*=|\1+=|; /^FLAGS/d' \
		${WRKSRC}/addon/Makefile.common
.if defined(WITHOUT_DEBUG)
	@${REINPLACE_CMD} -e 's|configure.sh|configure.sh -nodebug|' \
		${WRKSRC}/Makefile
.endif

.if defined(WITH_BW)
	@${REINPLACE_CMD} -e 's|#DEFINE += -DHAVE_BW|DEFINE += -DHAVE_BW|' \
		${WRKSRC}/addon/Makefile.common
.endif

.if defined(WITH_HASH)
	@${REINPLACE_CMD} -e 's|#DEFINE += -DUSE_HASH|DEFINE += -DUSE_HASH|' \
		${WRKSRC}/addon/Makefile.common
.endif

do-install:
	${INSTALL_PROGRAM} ${WRKSRC}/src/netams ${PREFIX}/libexec/netams
	${INSTALL_PROGRAM} ${WRKSRC}/src/flowprobe ${PREFIX}/sbin/flowprobe
	${INSTALL_PROGRAM} ${WRKSRC}/src/ipfw2netflow \
		${PREFIX}/sbin/ipfw2netflow
	${INSTALL_PROGRAM} ${WRKSRC}/src/netamsctl ${PREFIX}/bin/netamsctl
	${INSTALL_DATA} ${WRKSRC}/addon/netams.cfg \
		${PREFIX}/etc/netams.cfg.sample
.if !exists(${PREFIX}/etc/netams.cfg)
	${INSTALL_DATA} ${WRKSRC}/addon/netams.cfg \
		${PREFIX}/etc/netams.cfg
.endif
	${INSTALL_SCRIPT} ${WRKSRC}/addon/netams-startup.sh \
		${PREFIX}/etc/rc.d/netams-startup.sh.sample
	${MKDIR} ${DATADIR}/cgi-bin/admin ${DATADIR}/cgi-bin/images
	${INSTALL_DATA} ${WRKSRC}/addon/ru-networks.txt \
		${DATADIR}/ru-networks.txt.sample
	${INSTALL_DATA} ${WRKSRC}/addon/.netamsctl.rc ${DATADIR}
.for f in ${IMAGES}
	${INSTALL_DATA} ${WRKSRC}/cgi-bin/images/${f} ${DATADIR}/cgi-bin/images
.endfor
.for f in ${CGI}
	${INSTALL_DATA} ${WRKSRC}/cgi-bin/${f} ${DATADIR}/cgi-bin
.endfor
.for f in ${ADMINCGI}
	${INSTALL_DATA} ${WRKSRC}/cgi-bin/admin/${f} ${DATADIR}/cgi-bin/admin
.endfor
.for f in ${MAN8}
	${INSTALL_MAN} ${WRKSRC}/doc/${f} ${PREFIX}/man/man8
.endfor

post-install:
	@${SED} 's|%%PREFIX%%|${PREFIX}|g; s|%%DATADIR%%|${DATADIR}|g' \
		${PKGMESSAGE}

.include <bsd.port.post.mk>
OpenPOWER on IntegriCloud