aboutsummaryrefslogtreecommitdiffstats
path: root/net/haproxy-devel/Makefile
blob: 76d0fbdf5a0c338b19808f05a12694daa7797835 (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
# New ports collection Makefile for:    haproxy
# Date created:             Apr 30, 2003
# Whom:                 Clement Laforet
#
# $FreeBSD$
#

PORTNAME=   haproxy
PORTVERSION=    1.1.28
CATEGORIES= net www
MASTER_SITES=   http://w.ods.org/tools/haproxy/src/ \
        http://w.ods.org/tools/haproxy/src/old/

MAINTAINER= clement@FreeBSD.org
COMMENT=    High-performance and highly-robust TCP/HTTP load balancer

USE_REINPLACE=  yes
USE_RC_SUBR=    yes
RC_SCRIPTS_SUB= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR}

STATS_INTERVAL?=    0
CFLAGS+=    -DSTATTIME=${STATS_INTERVAL}

.if defined(WITH_TPROXY)
CFLAGS+=    -DTPROXY
.endif

.if defined(WITH_PCRE)
PKGNAMESUFFIX=  -pcre
LIB_DEPENDS+=   pcre.0:${PORTSDIR}/devel/pcre
CFLAGS+=    -DUSE_PCRE -I${LOCALBASE}/include
LDFLAGS+=   -L${LOCALBASE}/lib -lpcreposix -lpcre
.endif

pre-fetch:
    @${ECHO_MSG} ""
    @${ECHO_MSG} "Available options:"
    @${ECHO_MSG} "WITH_PCRE:            Use pcre regex engine"
    @${ECHO_MSG} "WITH_DTPROXY:         Enable Transparent proxy support"
    @${ECHO_MSG} "STATS_INTERVAL=###:   Statistics interval in milliseconds,"
    @${ECHO_MSG} "                         (default to 0, disabled)"
    @${ECHO_MSG} ""

post-patch:
    @${REINPLACE_CMD} -e 's!localtime(!localtime((time_t *)!' ${WRKSRC}/haproxy.c
    @${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
        ${FILESDIR}/haproxy.sh > ${WRKDIR}/haproxy.sh

do-build:
    @cd ${WRKSRC} && \
        ${CC} ${CFLAGS} ${LDFLAGS} ${PORTNAME}.c -o ${PORTNAME}

do-install:
    @${INSTALL_PROGRAM} ${WRKSRC}/haproxy ${PREFIX}/sbin
    @${INSTALL_SCRIPT} ${WRKDIR}/haproxy.sh \
            ${PREFIX}/etc/rc.d/haproxy.sh

.if !defined(NOPORTDOCS)
    @${MKDIR} ${DOCSDIR}
    @${MKDIR} ${EXAMPLESDIR}
    @${INSTALL_DATA} ${WRKSRC}/doc/* ${DOCSDIR}
    @${INSTALL_DATA} ${WRKSRC}/examples/haproxy.cfg \
            ${EXAMPLESDIR}/haproxy.cfg
.endif

post-install:
    @${CAT} ${PKGMESSAGE}

.include <bsd.port.mk>