aboutsummaryrefslogtreecommitdiffstats
path: root/www/mysar/Makefile
blob: 547b577a46dc8d88b881c8255718d67de19a63d9 (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
# Created by: Edwin Groothuis <edwin@mavetju.org>
# $FreeBSD$

PORTNAME=   mySAR
PORTVERSION=    2.1.4
PORTREVISION=   3
CATEGORIES= www
MASTER_SITES=   SF
DISTNAME=   ${PORTNAME:L}-${PORTVERSION}

MAINTAINER= edwin@mavetju.org
COMMENT=    MySQL Squid Access Report

BUILD_DEPENDS=  bash:${PORTSDIR}/shells/bash

WRKROOT=    ${WRKDIR}/${PORTNAME:L}
WRKSRC=     ${WRKROOT}/bin/mysar-binary-importer/
GNU_CONFIGURE=  yes
USE_MYSQL=  yes
USE_PHP=    mysql pcre
USE_CSTD=   gnu89

CONFIGURE_ARGS= --with-mysql-lib=${LOCALBASE}

MYSARPREFIX=    mysar
MYSARDIR?=  ${PREFIX}/${MYSARPREFIX}
PLIST_SUB=  MYSAR=${MYSARPREFIX}

SUB_FILES=  pkg-message
SUB_LIST=   MYSARDIR=${MYSARDIR}
PKGMESSAGE= ${WRKDIR}/pkg-message

post-extract:
    ${CHMOD} +x ${WRKSRC}/config/*

post-patch:
    ${REINPLACE_CMD} \
        -e 's,/usr/local/mysar/,${MYSARDIR},g' \
        ${WRKROOT}/etc/mysar.cron
    ${REINPLACE_CMD} \
        -e 's,/usr/local/mysar/,${MYSARDIR},g' \
        ${WRKROOT}/etc/mysar.apache

    ${REINPLACE_CMD} \
        -e 's,/usr/bin/php,${LOCALBASE}/bin/php,g' \
        -e 's,\([=,. ]\)mktime(),\1time(),g' \
        `find ${WRKROOT}/bin -type f`
    ${REINPLACE_CMD} \
        -e 's,/bin/sh,${LOCALBASE}/bin/bash,g' \
        `find ${WRKROOT}/bin/mysar-binary-importer -type f`

    ${FIND} ${WRKROOT} -name *.orig -delete
    ${FIND} ${WRKROOT} -name *.bak -delete

do-install:
    ${MV} ${WRKSRC} ${WRKROOT}
    ${MKDIR} ${STAGEDIR}${MYSARDIR}
    ${CP} -R `find ${WRKROOT} -mindepth 1 -maxdepth 1 ! -name mysar-binary-importer` ${STAGEDIR}${MYSARDIR}
    ${INSTALL_PROGRAM} ${WRKROOT}/mysar-binary-importer/src/mysar ${STAGEDIR}${MYSARDIR}/bin
    ${INSTALL_DATA} ${WRKROOT}/mysar-binary-importer/mysar.conf ${STAGEDIR}${MYSARDIR}/etc
    ${CHOWN} -R ${WWWOWN} ${STAGEDIR}${MYSARDIR}/www-templates
    ${CHOWN} -R ${WWWOWN} ${STAGEDIR}${MYSARDIR}/smarty-tmp

.include <bsd.port.mk>