aboutsummaryrefslogtreecommitdiffstats
path: root/net/vnstat/Makefile
blob: 5c1be7d11a05a9d1100e3db358973fb83d7abd5c (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
# Created by: Dennis Herrmann <adox@mcx2.org>
# $FreeBSD$

PORTNAME=   vnstat
PORTVERSION=    1.11
PORTREVISION=   5
CATEGORIES= net
MASTER_SITES=   http://humdi.net/vnstat/ \
        http://mirror.mcx2.org/

MAINTAINER= dhn@FreeBSD.org
COMMENT=    A console-based network traffic monitor

MAKE_ARGS=  CC="${CC}" CFLAGS="-I${LOCALBASE}/include" \
        LDFLAGS="-L${LOCALBASE}/lib"
INSTALL_TARGET= bsdinstall

USE_RC_SUBR=    vnstat

USERS=  vnstat
GROUPS= vnstat

MAN1=   vnstat.1 vnstatd.1
MAN5=   vnstat.conf.5
MANCOMPRESSED=  yes
PORTDOCS=   README INSTALL_BSD UPGRADE vnstat-cron
SUB_FILES=  pkg-message
SUB_LIST=   USERS=${USERS} \
        GROUPS=${GROUPS}

# will compile with image output
OPTIONS_DEFINE= GUI DOCS
OPTIONS_DEFAULT=    GUI
GUI_DESC=   Build with graphics/gd dependency

.include <bsd.port.options.mk>

PLIST_FILES=    bin/vnstat \
        sbin/vnstatd \
        %%GUI%%bin/vnstati \
        etc/vnstat.conf.sample

.if ${PORT_OPTIONS:MGUI}
LIB_DEPENDS+=   gd:${PORTSDIR}/graphics/gd
PLIST_SUB+= GUI=""
MAN1+=  vnstati.1
.else
ALL_TARGET="vnstat"
PLIST_SUB+= GUI="@comment "
.endif

post-extract:
    @cd ${WRKSRC} && ${CP} examples/vnstat.cron vnstat-cron
    @cd ${WRKSRC} && ${CP} cfg/vnstat.conf cfg/vnstat.conf.sample
    @${REINPLACE_CMD} -e 's|/usr/bin|/usr/local/bin|g' \
        -e 's|ls /var/lib|ls -l /var/db|g' ${WRKSRC}/vnstat-cron

post-patch:
    @${REINPLACE_CMD} -e 's|$$(DESTDIR)|${PREFIX}|g' \
        -e 's|cfg/vnstat.conf|cfg/vnstat.conf.sample|g' \
        -e 's|etc/vnstat.conf|etc/vnstat.conf.sample|g' \
        -e 's|install -D|install|g' ${WRKSRC}/Makefile
    @${REINPLACE_CMD} -e 's|/etc/|${PREFIX}/etc/|g' \
        ${WRKSRC}/src/cfg.c

post-install:
.if ${PORT_OPTIONS:MDOCS}
    @${ECHO_MSG} "installing additional documentation to ${DOCSDIR}"
    @${MKDIR} ${DOCSDIR}
    @cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR}
.endif

    @${ECHO_MSG} ""
    @${CAT} ${PKGMESSAGE}
    @${ECHO_MSG} ""

.include <bsd.port.mk>