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

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

MAINTAINER= feld@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

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>

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

post-extract:
    @cd ${WRKSRC} && ${CP} examples/vnstat.cron vnstat-cron
    @${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|/etc/|${PREFIX}/etc/|g' \
        ${WRKSRC}/src/cfg.c

do-install:
    ${INSTALL_PROGRAM} ${WRKSRC}/src/vnstat ${STAGEDIR}/${PREFIX}/bin/vnstat
    ${INSTALL_PROGRAM} ${WRKSRC}/src/vnstatd ${STAGEDIR}/${PREFIX}/sbin/vnstatd
    ${INSTALL_DATA} ${WRKSRC}/cfg/vnstat.conf ${STAGEDIR}/${PREFIX}/etc/vnstat.conf.sample
    ${INSTALL_MAN} ${WRKSRC}/man/vnstat.1 ${STAGEDIR}/${MANPREFIX}/man/man1/vnstat.1
    ${INSTALL_MAN} ${WRKSRC}/man/vnstatd.1 ${STAGEDIR}/${MANPREFIX}/man/man1/vnstatd.1
    ${INSTALL_MAN} ${WRKSRC}/man/vnstat.conf.5 ${STAGEDIR}/${MANPREFIX}/man/man5/vnstat.conf.5
.if ${PORT_OPTIONS:MGUI}
    ${INSTALL_PROGRAM} ${WRKSRC}/src/vnstati ${STAGEDIR}/${PREFIX}/bin/vnstati
    ${INSTALL_MAN} ${WRKSRC}/man/vnstati.1 ${STAGEDIR}/${MANPREFIX}/man/man1/vnstati.1
.endif

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

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

.include <bsd.port.mk>