aboutsummaryrefslogtreecommitdiffstats
path: root/www/asterisk-stat/Makefile
blob: 9b7005bcf6bbb9353eeb2099265a9312ff37ffac (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
# Created by: Fumihiko Kimura <jfkimura@yahoo.com>
# $FreeBSD$

PORTNAME=   asterisk-stat
PORTVERSION=    2.0.1
PORTREVISION=   13
CATEGORIES= www
MASTER_SITES=   http://www.areski.net/${SITE_SUBDIR}/
DISTNAME=   ${PORTNAME}-v${PORTVERSION:S/./_/g}

MAINTAINER= jfkimura@yahoo.co.jp
COMMENT=    ASTERISK call detail records analyzer

LIB_DEPENDS=    gd.[4-9]:${PORTSDIR}/graphics/gd

NO_BUILD=   yes
USE_PHP=    session gd pcre
WANT_PHP_WEB=   yes
ASTERISKDIR?=   ${WWWDIR}
SITE_SUBDIR=    asterisk-stat-v2
WRKSRC=     ${WRKDIR}/${SITE_SUBDIR}
SUB_FILES=  pkg-message
SUB_LIST+=  ASTERISKDIR=${ASTERISKDIR}

OPTIONS_DEFINE= PGSQL
PGSQL_DESC= Use PostgreSQL instead of MySQL

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MGSQL}
ASTERISKSTATDB= pgsql
EXTRA_PATCHES+= ${FILESDIR}/pgsql__patch-call.log.php
.else
ASTERISKSTATDB= mysql
.endif

USE_PHP+=   ${ASTERISKSTATDB}
EXTRA_PATCHES+= ${FILESDIR}/${ASTERISKSTATDB}__patch-cdr.php \
        ${FILESDIR}/${ASTERISKSTATDB}__patch-defines.php
PLIST_SUB+= ASTERISKDIR=${ASTERISKDIR:S,^${PREFIX}/,,} \
        ASTERISKSTATDB=${ASTERISKSTATDB}

post-patch:
    @${MV} ${WRKSRC}/images/print.css ${WRKSRC}/css
    @${CP} ${WRKSRC}/images/spacer.gif ${WRKSRC}/images/clear.gif
    @${CP} ${WRKSRC}/css/images/*png ${WRKSRC}/images
    @${RM} ${WRKSRC}/about.php \
        ${WRKSRC}/lib/defines.php.orig \
        ${WRKSRC}/cdr.php.orig \
        ${WRKSRC}/export_pdf.php.orig

do-install:
    @${MKDIR} ${ASTERISKDIR}
    @${MV} ${WRKSRC}/lib/defines.php ${WRKSRC}/lib/defines.php-dist
    (cd ${WRKSRC}/ && ${COPYTREE_SHARE} \* ${ASTERISKDIR})
    ${MKDIR} ${PREFIX}/etc/asterisk
    ${INSTALL_DATA} ${FILESDIR}/cdr_${ASTERISKSTATDB}.tbl ${PREFIX}/etc/asterisk
    ${CHOWN} -R ${WWWOWN}:${WWWGRP} ${ASTERISKDIR}

.include <bsd.port.mk>