aboutsummaryrefslogtreecommitdiffstats
path: root/net-im/jabberd/Makefile
blob: b22e633b4fe50483936bbd170d850cf7cffeca43 (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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# New ports collection makefile for:    jabberd
# Date created:             29 December 2003
# Whom:                 Dmitry Sivachenko <demon@FreeBSD.org>
#
# $FreeBSD$
#

PORTNAME=   jabberd
PORTVERSION=    2.2.16
PORTREVISION=   2
CATEGORIES= net-im
MASTER_SITES=   http://cloud.github.com/downloads/Jabberd2/jabberd2/
DIST_SUBDIR=    jabber

MAINTAINER= mm@FreeBSD.org
COMMENT=    Online presence and instant messaging server

LIB_DEPENDS=    expat.6:${PORTSDIR}/textproc/expat2 \
        idn.17:${PORTSDIR}/dns/libidn \
        udns.0:${PORTSDIR}/dns/udns

LICENSE=    GPLv2
LICENSE_FILE=   ${WRKSRC}/COPYING

OPTIONS=    MYSQL "Support MySQL (storage/auth/reg)" on \
        POSTGRESQL "Support PostgreSQL (storage/auth/reg)" off \
        LDAP "Support OpenLDAP (storage/auth/reg)" off \
        BDB "Support BerkeleyDB (storage/auth/reg)" off \
        SQLITE "Support SQLite3 (storage/auth/reg)" off \
        PAM "Enable PAM (auth/reg)" off \
        PIPE "Enable pipe (auth/reg)" off \
        ANON "Enable anonymous (auth/reg)" off \
        FS "Filesystem storage (only for testing)" off \
        DEBUG "Compile with debug messages" on \
        REQUIRES "Add backend requires to startup script" off \
        CYRUS "Use Cyrus SASL backend (not supported)" off

GNU_CONFIGURE=  yes
MAKE_JOBS_SAFE= yes
USE_PERL5_RUN=  yes
USE_OPENSSL=    yes
USE_ICONV=  yes
USE_RC_SUBR=    jabberd
USE_LDCONFIG=   ${PREFIX}/lib/jabberd
CONFIGURE_ARGS+=    --localstatedir=/var \
        --sysconfdir=${PREFIX}/etc/jabberd \
        --enable-ssl --enable-mio=poll \
        --disable-tests \
        --with-extra-include-path="${LOCALBASE}/include ${EIP}" \
        --with-extra-library-path="${LOCALBASE}/lib ${ELP}"

JABBER_USER=    jabber
JABBER_GROUP=   jabber

USERS=      ${JABBER_USER}
GROUPS=     ${JABBER_GROUP}

JABBER_ETCDIR=  "${PREFIX}/etc/jabberd"
JABBER_RUNDIR=  "/var/jabberd"

SUB_LIST+=  JABBER_USER=${JABBER_USER} \
        JABBER_GROUP=${JABBER_GROUP} \
        JABBER_ETCDIR="${JABBER_ETCDIR}" \
        JABBER_RUNDIR="${JABBER_RUNDIR}" \
        PERL="${PERL}"

SUB_FILES+= pkg-install pkg-deinstall

PORTDOCS=   *

DOCFILES=   AUTHORS COPYING ChangeLog INSTALL NEWS README \
        TODO UPGRADE

_REQUIRE=   LOGIN

.include <bsd.port.pre.mk>

ELP+=   ${OPENSSLLIB}
EIP+=   ${OPENSSLINC}

.if !defined(WITHOUT_DEBUG)
CONFIGURE_ARGS+=--enable-debug
.endif

.if defined(WITH_POSTGRESQL)
USE_PGSQL=  yes
CONFIGURE_ARGS+=--enable-pgsql
PLIST_SUB+= SUB_PGSQL=""
_REQUIRE+=  postgresql
.else
CONFIGURE_ARGS+=--disable-pgsql
PLIST_SUB+= SUB_PGSQL="@comment "
.endif

.if defined(WITH_SQLITE)
CONFIGURE_ARGS+=--enable-sqlite
LIB_DEPENDS+=   sqlite3.8:${PORTSDIR}/databases/sqlite3
CFLAGS+=    ${PTHREAD_CFLAGS}
PLIST_SUB+= SUB_SQLITE=""
.else
CONFIGURE_ARGS+=--disable-sqlite
PLIST_SUB+= SUB_SQLITE="@comment "
.endif

.if !defined(WITHOUT_MYSQL)
USE_MYSQL=  yes
CONFIGURE_ARGS+=--enable-mysql
EIP+=:${LOCALBASE}/include/mysql
ELP+=:${LOCALBASE}/lib/mysql
PLIST_SUB+= SUB_MYSQL=""
_REQUIRE+=  mysql
.else
CONFIGURE_ARGS+=--disable-mysql
PLIST_SUB+= SUB_MYSQL="@comment "
.endif

.if defined(WITH_BDB)
USE_BDB=    41+
CONFIGURE_ARGS+=--enable-db
CONFIGURE_ARGS+=--oldincludedir=/nonexistant
EIP+=:${BDB_INCLUDE_DIR}
ELP+=:${BDB_LIB_DIR}
PLIST_SUB+= SUB_BDB=""
.else
CONFIGURE_ARGS+=--disable-db
PLIST_SUB+= SUB_BDB="@comment "
.endif

.if defined(WITH_LDAP)
USE_OPENLDAP=   yes
CONFIGURE_ARGS+=--enable-ldap
PLIST_SUB+= SUB_LDAP=""
_REQUIRE+=  slapd
.else
CONFIGURE_ARGS+=--disable-ldap
PLIST_SUB+= SUB_LDAP="@comment "
.endif

.if defined(WITH_FS)
CONFIGURE_ARGS+=--enable-fs
PLIST_SUB+= SUB_FS=""
.else
CONFIGURE_ARGS+=--disable-fs
PLIST_SUB+= SUB_FS="@comment "
.endif

.if defined(WITH_PAM)
CONFIGURE_ARGS+=--enable-pam
PLIST_SUB+= SUB_PAM=""
.else
CONFIGURE_ARGS+=--disable-pam
PLIST_SUB+= SUB_PAM="@comment "
.endif

.if defined(WITH_PIPE)
CONFIGURE_ARGS+=--enable-pipe
PLIST_SUB+= SUB_PIPE=""
.else
PLIST_SUB+= SUB_PIPE="@comment "
.endif

.if defined(WITH_ANON)
CONFIGURE_ARGS+=--enable-anon
PLIST_SUB+= SUB_ANON=""
.else
PLIST_SUB+= SUB_ANON="@comment "
.endif

.if defined(WITH_REQUIRES)
SUB_LIST+=  REQUIRE="${_REQUIRE}"
.else
SUB_LIST+=  REQUIRE="LOGIN"
.endif

.if defined(WITH_CYRUS)
CONFIGURE_ARGS+=    --with-sasl=cyrus
LIB_DEPENDS+=   sasl2.2:${PORTSDIR}/security/cyrus-sasl2
.else
CONFIGURE_ARGS+=    --with-sasl=gsasl
LIB_DEPENDS+=   gsasl.16:${PORTSDIR}/security/gsasl
.endif

MAN8=       c2s.8 jabberd.8 router.8 s2s.8 sm.8

post-patch:
    @${REINPLACE_CMD} -e 's|"-lsqlite3|"-lsqlite3 ${PTHREAD_LIBS}|g' \
        ${WRKSRC}/configure
    @${REINPLACE_CMD} -e 's|%%PERL%%|${PERL}|g' \
        ${WRKSRC}/tools/jabberd.in
.if defined(WITH_CYRUS)
    @${REINPLACE_CMD} -e '/^#error /d' \
        ${WRKSRC}/sx/sasl_cyrus.c
.endif

post-install:
    @PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
    @${CHOWN} -R ${JABBER_USER}:${JABBER_GROUP} ${PREFIX}/etc/jabberd
    @${FIND} ${PREFIX}/etc/jabberd -type d | ${XARGS} ${CHMOD} 750
    @${FIND} ${PREFIX}/etc/jabberd -type f | ${XARGS} ${CHMOD} 660
.if !defined(NOPORTDOCS)
    @${MKDIR} ${DOCSDIR}
.for FILE in ${DOCFILES}
    @${INSTALL_DATA} ${WRKSRC}/${FILE} ${DOCSDIR}
.endfor
.for FILE in db-setup.mysql db-setup.pgsql db-setup.sqlite
    @${INSTALL_DATA} ${WRKSRC}/tools/${FILE} ${DOCSDIR}
.endfor
.endif

.include <bsd.port.post.mk>