summaryrefslogtreecommitdiff
path: root/net/asterisk/Makefile
blob: fc05a4aaaf1b099004aae02564e49f8324cb2691 (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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# Created by: Maxim Sobolev <sobomax@portaone.com>
# $FreeBSD$

PORTNAME=	asterisk
PORTVERSION=	1.8.23.1
CATEGORIES=	net
MASTER_SITES=	http://downloads.asterisk.org/pub/telephony/asterisk/ \
		http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/
PKGNAMESUFFIX=	18

MAINTAINER=	flo@FreeBSD.org
COMMENT=	An Open Source PBX and telephony toolkit

LICENSE=	GPLv2
LICENSE_FILE=	${WRKSRC}/LICENSE

LIB_DEPENDS=	speex.1:${PORTSDIR}/audio/speex \
		newt.52:${PORTSDIR}/devel/newt \
		execinfo:${PORTSDIR}/devel/libexecinfo
RUN_DEPENDS=	mpg123:${PORTSDIR}/audio/mpg123

ONLY_FOR_ARCHS=	i386 amd64 powerpc sparc64

GNU_CONFIGURE=	yes
CONFIGURE_ARGS=	--with-gsm=${LOCALBASE}
LDFLAGS+=	-L${LOCALBASE}/lib
CPPFLAGS+=	-I${LOCALBASE}/include -I${LOCALBASE}/include/openh323
USE_CSTD=	gnu89
USE_GMAKE=	yes
USE_GNOME=	libxml2
USES=		bison
USE_RC_SUBR=	asterisk
MAKE_ENV=	PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" \
		PTHREAD_LIBS="${PTHREAD_LIBS}" \
		MKDIR="${MKDIR}" \
		PWLIBDIR=${LOCALBASE}/share/pwlib \
		OPENH323DIR=${LOCALBASE}/share/openh323 \
		OSVERSION=${OSVERSION} \
		NOISY_BUILD=YES \
		DOCSDIR=${DOCSDIR} \
		ASTCFLAGS="${CFLAGS}"

MAN8=		asterisk.8 astgenkey.8 autosupport.8 safe_asterisk.8

CONFLICTS_BUILD=	linuxthreads-*
CONFLICTS_INSTALL=	asterisk*-1.4* asterisk*-1.6* asterisk*-10*

OPTIONS_DEFINE=	VORBIS PGSQL MYSQL RADIUS SNMP H323 FREETDS JABBER SQLITE GSM \
		CURL SPANDSP EXCHANGE NEWG711 SRTP LUA LDAP OOH323
OPTIONS_DEFAULT=	VORBIS UNIXODBC PGSQL RADIUS SNMP H323 FREETDS JABBER GSM \
		SQLITE CURL

OPTIONS_RADIO=	ODBC
OPTIONS_RADIO_ODBC=	IODBC UNIXODBC

OPTIONS_DEFINE_i386=	DAHDI
OPTIONS_DEFINE_amd64=	DAHDI
OPTIONS_DEFINE_sparc64=	DAHDI

OPTIONS_DEFAULT_i386=	DAHDI
OPTIONS_DEFAULT_amd64=	DAHDI
OPTIONS_DEFAULT_sparc64=	DAHDI

EXCHANGE_DESC?=	Exchange calendar support
NEWG711_DESC?=	New G711 Codec
SRTP_DESC?=	SecureRTP support
OOH323_DESC?=	ooh323 support
DAHDI_DESC?=	DAHDI support

PORTSCOUT=	limit:^1\.8\.

ASTERISK_USER?=		asterisk
ASTERISK_GROUP?=	asterisk

USERS=	${ASTERISK_USER}
GROUPS=	${ASTERISK_GROUP} dahdi

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

.if ${PREFIX} == ${LOCALBASE}
VARDIR=/var
.else
VARDIR=${PREFIX}/var
.endif

SUB_LIST+=	ASTERISK_USER=${ASTERISK_USER}
PLIST_SUB+=	ASTERISK_USER=${ASTERISK_USER}
PLIST_SUB+=	ASTERISK_GROUP=${ASTERISK_GROUP}
PLIST_SUB+=	VARDIR=${VARDIR}

.if ${PORT_OPTIONS:MH323}
PLIST_SUB+=	WITH_H323=""
CONFIGURE_ARGS+=	--with-h323=${LOCALBASE}
LIB_DEPENDS+=	pt_r.1:${PORTSDIR}/devel/pwlib \
		h323_r.1:${PORTSDIR}/net/openh323
.else
PLIST_SUB+=	WITH_H323="@comment "
CONFIGURE_ARGS+=	--without-h323
.endif

.if ${PORT_OPTIONS:MDAHDI}
PLIST_SUB+=	WITH_DAHDI=""
CONFIGURE_ARGS+=	--with-dahdi --with-openr2
BUILD_DEPENDS+=	libpri>=1.4.10:${PORTSDIR}/misc/libpri \
		${LOCALBASE}/include/dahdi/user.h:${PORTSDIR}/misc/dahdi
LIB_DEPENDS+=	pri.1:${PORTSDIR}/misc/libpri\
		openr2.4:${PORTSDIR}/misc/openr2
.else
PLIST_SUB+=	WITH_DAHDI="@comment "
CONFIGURE_ARGS+=	--without-dahdi --without-openr2
.endif

#
# WITH_FREETDS, WITH_PGSQL and WITH_SQLITE can also be added to MAKE_ENV
# similarly
.if empty(PORT_OPTIONS:MUNIXODBC)
CONFIGURE_ARGS+=	--without-unixodbc
.endif
.if empty(PORT_OPTIONS:MIODBC)
CONFIGURE_ARGS+=	--without-iodbc
.endif
.if empty(PORT_OPTIONS:MUNIXODBC) && empty(PORT_OPTIONS:MIODBC)
PLIST_SUB+=	WITH_ODBC="@comment "
.endif
.if ${PORT_OPTIONS:MUNIXODBC} || ${PORT_OPTIONS:MIODBC}
PLIST_SUB+=	WITH_ODBC=""
USE_AUTOTOOLS=	libltdl
.if ${PORT_OPTIONS:MUNIXODBC}
CONFIGURE_ARGS+=	--with-unixodbc --with-ltdl
LIB_DEPENDS+=	odbc.2:${PORTSDIR}/databases/unixODBC
.elif ${PORT_OPTIONS:MIODBC}
CONFIGURE_ARGS+=	--with-iodbc --with-ltdl
LIB_DEPENDS+=	iodbc.3:${PORTSDIR}/databases/libiodbc
.endif
.endif

.if ${PORT_OPTIONS:MFREETDS}
PLIST_SUB+=	WITH_FREETDS=""
CONFIGURE_ARGS+=	--with-tds=${LOCALBASE}
LIB_DEPENDS+=	tds.5:${PORTSDIR}/databases/freetds
.else
PLIST_SUB+=	WITH_FREETDS="@comment "
CONFIGURE_ARGS+=	--without-tds
.endif

.if ${PORT_OPTIONS:MPGSQL}
PLIST_SUB+=	WITH_PGSQL=""
USE_PGSQL=	yes
CONFIGURE_ARGS+=	--with-postgres
.else
PLIST_SUB+=	WITH_PGSQL="@comment "
CONFIGURE_ARGS+=	--without-postgres
.endif

.if ${PORT_OPTIONS:MMYSQL}
PLIST_SUB+=	WITH_MYSQL=""
USE_MYSQL=	yes
CONFIGURE_ARGS+=	--with-mysqlclient
.else
PLIST_SUB+=	WITH_MYSQL="@comment "
CONFIGURE_ARGS+=	--without-mysqlclient
.endif

.if ${PORT_OPTIONS:MVORBIS}
PLIST_SUB+=	WITH_VORBIS=""
CONFIGURE_ARGS+=	--with-ogg
LIB_DEPENDS+=	vorbis.4:${PORTSDIR}/audio/libvorbis
.else
PLIST_SUB+=	WITH_VORBIS="@comment "
CONFIGURE_ARGS+=	--without-ogg
.endif

.if ${PORT_OPTIONS:MRADIUS}
PLIST_SUB+=	WITH_RADIUS=""
CONFIGURE_ARGS+=	--with-radius
LIB_DEPENDS+=	radiusclient-ng.2:${PORTSDIR}/net/radiusclient
.else
PLIST_SUB+=	WITH_RADIUS="@comment "
CONFIGURE_ARGS+=	--without-radius
.endif

.if ${PORT_OPTIONS:MSNMP}
PLIST_SUB+=	WITH_SNMP=""
CONFIGURE_ARGS+=	--with-netsnmp
LIB_DEPENDS+=	netsnmp:${PORTSDIR}/net-mgmt/net-snmp
.else
PLIST_SUB+=	WITH_SNMP="@comment "
CONFIGURE_ARGS+=	--without-netsnmp
.endif

.if ${PORT_OPTIONS:MJABBER}
PLIST_SUB+=	WITH_JABBER=""
CONFIGURE_ARGS+=	--with-iksemel
LIB_DEPENDS+=	iksemel.4:${PORTSDIR}/textproc/iksemel
.else
PLIST_SUB+=	WITH_JABBER="@comment "
CONFIGURE_ARGS+=	--without-iksemel
.endif

.if ${PORT_OPTIONS:MSQLITE}
PLIST_SUB+=	WITH_SQLITE=""
CONFIGURE_ARGS+=	--with-sqlite
LIB_DEPENDS+=	sqlite:${PORTSDIR}/databases/sqlite2 \
		sqlite3:${PORTSDIR}/databases/sqlite3
.else
PLIST_SUB+=	WITH_SQLITE="@comment "
CONFIGURE_ARGS+=	--without-sqlite \
			--with-sqlite3=no
.endif

.if ${PORT_OPTIONS:MGSM}
PLIST_SUB+=	WITH_GSM=""
CONFIGURE_ARGS+=	--with-gsm
LIB_DEPENDS+=	gsm.1:${PORTSDIR}/audio/gsm
.else
PLIST_SUB+=	WITH_GSM="@comment "
CONFIGURE_ARGS+=	--without-gsm
.endif

.if ${PORT_OPTIONS:MCURL}
PLIST_SUB+=	WITH_CURL=""
CONFIGURE_ARGS+=	--with-libcurl
LIB_DEPENDS+=	curl:${PORTSDIR}/ftp/curl
.else
PLIST_SUB+=	WITH_CURL="@comment "
CONFIGURE_ARGS+=	--with-libcurl=no
.endif

.if ${PORT_OPTIONS:MSPANDSP}
PLIST_SUB+=	WITH_SPANDSP=""
CONFIGURE_ARGS+=	--with-spandsp
LIB_DEPENDS+=	spandsp.2:${PORTSDIR}/comms/spandsp-devel
.else
PLIST_SUB+=	WITH_SPANDSP="@comment "
CONFIGURE_ARGS+=	--without-spandsp
.endif

.if ${PORT_OPTIONS:MEXCHANGE}
LIB_DEPENDS+=	neon.27:${PORTSDIR}/www/neon29
PLIST_SUB+=	WITH_EXCHANGE=""
.else
CONFIGURE_ARGS+=	--without-neon --without-neon29
PLIST_SUB+=	WITH_EXCHANGE="@comment "
.endif

.if ${PORT_OPTIONS:MSRTP}
PLIST_SUB+=	WITH_SRTP=""
BUILD_DEPENDS+=	libsrtp>=1.4.4:${PORTSDIR}/net/libsrtp
CONFIGURE_ARGS+=	--with-srtp
.else
PLIST_SUB+=	WITH_SRTP="@comment "
CONFIGURE_ARGS+=	--without-srtp
.endif

.if ${PORT_OPTIONS:MLUA}
CONFIGURE_ARGS+=	--with-lua
CFLAGS+=	-I${LUA_INCDIR}
USE_LUA=	yes
LDFLAGS+=	-L${LUA_LIBDIR}
PLIST_SUB+=	WITH_LUA=""
.else
CONFIGURE_ARGS+=	--without-lua
PLIST_SUB+=	WITH_LUA="@comment "
.endif

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

.if ${PORT_OPTIONS:MOOH323}
PLIST_SUB+=	WITH_OOH323=""
.else
PLIST_SUB+=	WITH_OOH323="@comment "
.endif

post-extract:
	${FIND} ${WRKSRC} -name '*.d' -delete

post-patch:
	${REINPLACE_CMD} -e 's|/var/lib|${PREFIX}/share|g' ${WRKSRC}/configs/musiconhold.conf.sample

post-configure:
	@cd ${WRKSRC} && ${GMAKE} menuselect.makeopts
	@cd ${WRKSRC} && ./menuselect/menuselect --disable res_timing_kqueue menuselect.makeopts
.if ${PORT_OPTIONS:MMYSQL}
	@cd ${WRKSRC} && ./menuselect/menuselect --enable res_config_mysql menuselect.makeopts
	@cd ${WRKSRC} && ./menuselect/menuselect --enable app_mysql menuselect.makeopts
	@cd ${WRKSRC} && ./menuselect/menuselect --enable cdr_mysql menuselect.makeopts
.endif
.if ${PORT_OPTIONS:MOOH323}
	@cd ${WRKSRC} && ./menuselect/menuselect --enable chan_ooh323 menuselect.makeopts
.endif
.if ${PORT_OPTIONS:MNEWG711}
	@cd ${WRKSRC} && ./menuselect/menuselect --enable  G711_NEW_ALGORITHM menuselect.makeopts
.endif

post-install:
	@${MKDIR} ${VARDIR}/db/asterisk ${VARDIR}/log/asterisk ${VARDIR}/spool/asterisk
	@${CHOWN} -R ${ASTERISK_USER}:${ASTERISK_GROUP} ${VARDIR}/db/asterisk ${VARDIR}/log/asterisk ${VARDIR}/spool/asterisk

.include <bsd.port.post.mk>