aboutsummaryrefslogtreecommitdiffstats
path: root/www/c-icap/Makefile
blob: a5ac417153bcefb59c2bf4559db14758b78429fd (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Created by: Elisey Savateev <b3k@mail.ru>
# $FreeBSD$

PORTNAME=   c-icap
PORTVERSION=    0.2.5
PORTEPOCH=  2
CATEGORIES= www
MASTER_SITES=   SF/${PORTNAME}/${PORTNAME}/0.2.x/
DISTNAME=   c_icap-${PORTVERSION}

MAINTAINER= mm@FreeBSD.org
COMMENT=    ICAP server implementation

LICENSE=    LGPL21

GNU_CONFIGURE=  yes
USE_LDCONFIG=   yes
USE_RC_SUBR=    c-icap

SUB_FILES=  pkg-install pkg-deinstall

OPTIONS_DEFINE= BDB IPV6 LDAP PERL POSIXSEM LARGE_FILES
OPTIONS_DEFAULT=    IPV6
LARGE_FILES_DESC=   Enable large files support
POSIXSEM_DESC=      Use POSIX Semaphores instead of SYSV IPC

CICAP_USER= c_icap
CICAP_GROUP=    c_icap

USERS=      ${CICAP_USER}
GROUPS=     ${CICAP_GROUP}

MAN8=       c-icap-client.8 \
        c-icap-config.8 \
        c-icap-libicapapi-config.8 \
        c-icap-mkbdb.8 \
        c-icap-stretch.8 \
        c-icap.8

CONFIGURE_ARGS+=    --enable-static \
            --sysconfdir="${PREFIX}/etc/c-icap"

NO_STAGE=   yes
.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MBDB}
USE_BDB=    yes
.endif

.if ${PORT_OPTIONS:MIPV6}
CONFIGURE_ARGS+=    --enable-ipv6
.else
CONFIGURE_ARGS+=    --disable-ipv6
.endif

.if ${PORT_OPTIONS:MLARGE_FILES}
CONFIGURE_ARGS+=    --enable-large-files
.else
CONFIGURE_ARGS+=    --disable-large-files
.endif

.if ${PORT_OPTIONS:MLDAP}
USE_OPENLDAP=   YES
.endif

.if ${PORT_OPTIONS:MPERL}
USES+=      perl5
.endif

.include <bsd.port.pre.mk>

.if ${PORT_OPTIONS:MBDB}
CFLAGS+=    -I${BDB_INCLUDE_DIR}
LDFLAGS+=   -L${BDB_LIB_DIR}
CONFIGURE_ARGS+=    --with-bdb=yes
PLIST_SUB+= BDB=""
.else
CONFIGURE_ARGS+=    --with-bdb=no
PLIST_SUB+= BDB="@comment "
.endif

.if ${PORT_OPTIONS:MLDAP}
CONFIGURE_ARGS+=    --with-ldap=yes
PLIST_SUB+= LDAP=""
.else
CONFIGURE_ARGS+=    --with-ldap=no
PLIST_SUB+= LDAP="@comment "
.endif

.if ${PORT_OPTIONS:MPERL}
PLIST_SUB+= PERL=""
CONFIGURE_ARGS+=    --with-perl=${PERL}
.else
PLIST_SUB+= PERL="@comment "
CONFIGURE_ARGS+=    --without-perl
.endif

CFLAGS+=    -I${LOCALBASE}/include
LDFLAGS+=   -L${LOCALBASE}/lib

LOG_DIR=    /var/log/c-icap
RUN_DIR=    /var/run/c-icap
PLIST_SUB+= LOG_DIR=${LOG_DIR} RUN_DIR=${RUN_DIR}

SUB_FILES=  pkg-install pkg-deinstall
SUB_LIST=   CICAP_USER=${CICAP_USER} CICAP_GROUP=${CICAP_GROUP} \
        LOG_DIR=${LOG_DIR} RUN_DIR=${RUN_DIR}

post-patch:
    @${REINPLACE_CMD} \
        -e 's|@prefix@/var/log|/var/log/c-icap|g' \
        -e 's|@prefix@/etc/|@sysconfdir@/|g' \
        ${WRKSRC}/c-icap.conf.in
.if ${PORT_OPTIONS:MPOSIXSEM}
    @${REINPLACE_CMD} \
        -e 's|@SYSV_IPC@|0|g' \
        ${WRKSRC}/include/c-icap-conf.h.in
.endif

post-install:
    @${CP} -np ${PREFIX}/etc/c-icap/c-icap.conf.default \
        ${PREFIX}/etc/c-icap/c-icap.conf || ${TRUE}
    @${CP} -np ${PREFIX}/etc/c-icap/c-icap.magic.default \
        ${PREFIX}/etc/c-icap/c-icap.magic || ${TRUE}
    @${SH} ${PKGINSTALL} ${PREFIX} POST-INSTALL

.include <bsd.port.post.mk>