summaryrefslogtreecommitdiffstats
path: root/net/asterisk11/Makefile
blob: 0cf392bbf59cd3f066d28396011b917625664389 (plain)
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
# $FreeBSD$

PORTNAME=	asterisk
PORTVERSION=	11.25.2
CATEGORIES=	net
MASTER_SITES=	http://downloads.asterisk.org/pub/telephony/%SUBDIR%/:DEFAULT,g729
MASTER_SITE_SUBDIR=	asterisk/ \
			asterisk/old-releases/ \
			sounds/releases/:g729
PKGNAMESUFFIX=	11
DISTFILES=	${DISTNAME}${EXTRACT_SUFX}

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

LICENSE=	GPLv2
LICENSE_FILE=	${WRKSRC}/LICENSE

EXTRACT_ONLY:=	${DISTNAME}${EXTRACT_SUFX}

BROKEN_armv6=		fails to configure: the SPANDSP installation appears to be missing or broken
ONLY_FOR_ARCHS=		amd64 armv6 i386 powerpc sparc64

USES=		bison cpe gmake iconv localbase ncurses shebangfix \
		sqlite ssl
USE_CSTD=	gnu89
USE_GNOME=	libxml2
USE_LDCONFIG=	yes
USE_RC_SUBR=	asterisk

GNU_CONFIGURE=	yes
CONFIGURE_ARGS+=	--with-ilbc=internal \
			--with-crypto=${OPENSSLBASE} \
			--with-ssl=${OPENSSLBASE} \
			--with-libedit=internal

CPE_VENDOR=	digium

SHEBANG_FILES=	agi/agi-test.agi \
		agi/jukebox.agi

MAKE_ENV=	PTHREAD_LIBS="-lpthread" \
		MKDIR="${MKDIR}" \
		PWLIBDIR=${LOCALBASE}/share/pwlib \
		OSVERSION=${OSVERSION} \
		DOCSDIR=${DOCSDIR} \
		ASTCFLAGS="${CFLAGS}" \
		ASTLDFLAGS="${LDFLAGS}"
MAKE_ARGS+=	NOISY_BUILD=yes \
		ASTDATADIR=${DATADIR}

CONFLICTS_BUILD=	linuxthreads-* pjsip-*
CONFLICTS_INSTALL=	asterisk*-13*

OPTIONS_DEFINE=			BACKTRACE CURL EXCHANGE FREETDS LDAP LUA \
				MP3PLAYER OOH323 OPTIMIZED_CFLAGS RADIUS SNMP SPANDSP SRTP \
				SYSINFO UUID XMPP
OPTIONS_DEFAULT=		BACKTRACE CURL FREETDS GSM LUA MP3PLAYER \
				NEWT MYSQL ODBC PGSQL RADIUS SNMP SPANDSP SPEEX \
				SQLITE2 UUID VORBIS

OPTIONS_DEFINE_i386=		DAHDI
OPTIONS_DEFINE_amd64=		DAHDI
OPTIONS_DEFINE_sparc64=		DAHDI

OPTIONS_DEFAULT_i386=		DAHDI GCC XMPP
OPTIONS_DEFAULT_amd64=		DAHDI GCC XMPP
OPTIONS_DEFAULT_sparc64=	DAHDI GCC XMPP
OPTIONS_DEFAULT_powerpc=	GCC XMPP
OPTIONS_DEFAULT_armv6=		BASE

OPTIONS_GROUP=			CODECS
OPTIONS_GROUP_CODECS=		GSM NEWG711 SPEEX VORBIS
CODECS_DESC=			Encoder/Decoder (Codec) Support

OPTIONS_SINGLE=			COMPILER
OPTIONS_SINGLE_COMPILER=	BASE GCC
COMPILER_DESC=			Compiler to use

OPTIONS_GROUP+=			DATABASE
OPTIONS_GROUP_DATABASE=		MYSQL ODBC PGSQL SQLITE2
DATABASE_DESC=			Database Support

OPTIONS_MULTI=			MENU
OPTIONS_MULTI_MENU=		NCURSES NEWT
MENU_DESC=			Menuselect Interface Backend
NEWT_DESC=			Newt User Interface

OPTIONS_GROUP+=			SOUNDS
OPTIONS_GROUP_SOUNDS=		G729
SOUNDS_DESC=			Core and Music-on-Hold (MoH) Sound Files
ASTERISK_CORE_G729_SOUNDS=	asterisk-core-sounds-en-g729-1.5.tar.gz
ASTERISK_MOH_G729_SOUNDS=	asterisk-moh-opsound-g729-2.03.tar.gz

G729_DESC=			Install G.729 format sounds
G729_DISTFILES=			${ASTERISK_CORE_G729_SOUNDS}:g729 \
				${ASTERISK_MOH_G729_SOUNDS}:g729

BACKTRACE_DESC= Stack backtrace support via (lib)execinfo
BASE_DESC=	Use base compiler (experimental)
DAHDI_DESC=	DAHDI support
EXCHANGE_DESC=	Exchange calendar support
MP3PLAYER_DESC=	Install MP3 Player for Music-On-Hold (mpg123)
NEWG711_DESC=	New G711 codec
OOH323_DESC=	ooh323 support
SRTP_DESC=	SecureRTP support
SYSINFO_DESC=	Use devel/libsysinfo to get system information
UUID_DESC=	libuuid support (required for ICE and TURN in RTP)
XMPP_DESC=	XMPP/GTALK support

OPTIONS_SUB=		yes

BACKTRACE_CONFIGURE_WITH=	execinfo
BACKTRACE_USES=			execinfo

CURL_CONFIGURE_ON=	--with-libcurl
CURL_CONFIGURE_OFF=	--with-libcurl=no
CURL_LIB_DEPENDS=	libcurl.so:ftp/curl

DAHDI_CONFIGURE_ON=	--with-dahdi --with-openr2
DAHDI_CONFIGURE_OFF=	--without-dahdi --without-openr2
DAHDI_LIB_DEPENDS=	libpri.so:misc/libpri \
			libopenr2.so:misc/openr2 \
			libtonezone.so:misc/dahdi

EXCHANGE_CONFIGURE_OFF=	--without-neon --without-neon29
EXCHANGE_LIB_DEPENDS=	libneon.so:www/neon

FREETDS_CONFIGURE_ON=	--with-tds=${LOCALBASE}
FREETDS_CONFIGURE_OFF=	--without-tds
FREETDS_LIB_DEPENDS=	libsybdb.so:databases/freetds

GCC_USE=		GCC=yes

GSM_CONFIGURE_WITH=	gsm
GSM_LIB_DEPENDS=	libgsm.so:audio/gsm

LDAP_CONFIGURE_WITH=	ldap
LDAP_USE=		OPENLDAP=yes

LUA_CONFIGURE_WITH=	lua
LUA_USES=		lua:51
LUA_CFLAGS=		-I${LUA_INCDIR}
LUA_LDFLAGS=		-L${LUA_LIBDIR}

MYSQL_CONFIGURE_WITH=	mysqlclient
MYSQL_USES=		mysql

MP3PLAYER_RUN_DEPENDS=	mpg123:audio/mpg123

NCURSES_USES=		ncurses
NEWT_LIB_DEPENDS=	libnewt.so:devel/newt

ODBC_CONFIGURE_WITH=	unixodbc
ODBC_CONFIGURE_ON=	--with-ltdl
ODBC_LIB_DEPENDS=	libodbc.so:databases/unixODBC \
			libltdl.so:devel/libltdl

OOH323_CPPFLAGS=	-I${LOCALBASE}/include/openh323
OOH323_LIB_DEPENDS=	libpt_r.so:devel/pwlib \
			libh323_r.so:net/openh323
OOH323_MAKE_ENV=	OPENH323DIR=${LOCALBASE}/share/openh323

PGSQL_CONFIGURE_WITH=	postgres
PGSQL_USES=		pgsql

RADIUS_CONFIGURE_WITH=	radius
RADIUS_LIB_DEPENDS=	libradiusclient-ng.so:net/radiusclient

SNMP_CONFIGURE_WITH=	netsnmp
SNMP_LIB_DEPENDS=	libnetsnmp.so:net-mgmt/net-snmp

SPANDSP_CONFIGURE_WITH=	spandsp
SPANDSP_LIB_DEPENDS=	libspandsp.so:comms/spandsp

SPEEX_CONFIGURE_WITH=	speex
SPEEX_LIB_DEPENDS=	libspeex.so:audio/speex

SQLITE2_CONFIGURE_WITH=	sqlite
SQLITE2_LIB_DEPENDS=	libsqlite.so:databases/sqlite2

SRTP_CONFIGURE_WITH=	srtp
SRTP_BUILD_DEPENDS=	libsrtp>=1.4.4:net/libsrtp

SYSINFO_LIB_DEPENDS=	libsysinfo.so:devel/libsysinfo

UUID_LIB_DEPENDS=	libuuid.so:misc/e2fsprogs-libuuid
UUID_CONFIGURE_ON=	--with-uuid=${LOCALBASE}
UUID_CONFIGURE_OFF=	--disable-uuid
UUID_CONFLICTS=		ossp-uuid-[0-9]*

VORBIS_CONFIGURE_WITH=	ogg
VORBIS_LIB_DEPENDS=	libvorbis.so:audio/libvorbis

XMPP_CONFIGURE_WITH=	iksemel
XMPP_LIB_DEPENDS=	libiksemel.so:textproc/iksemel

ASTERISK_USER?=		asterisk
ASTERISK_GROUP?=	asterisk

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

.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} \
		ASTERISK_GROUP=${ASTERISK_GROUP} \
		VARDIR=${VARDIR}

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

post-extract-G729-on:
	${CP} ${DISTDIR}/${ASTERISK_CORE_G729_SOUNDS} ${WRKSRC}/sounds
	${CP} ${DISTDIR}/${ASTERISK_MOH_G729_SOUNDS} ${WRKSRC}/sounds

post-patch:
	@${REINPLACE_CMD} -e 's|/var/lib|${PREFIX}/share|g' ${WRKSRC}/configs/musiconhold.conf.sample
	@${REINPLACE_CMD} -e 's/-liconv/${ICONV_LIB}/' ${WRKSRC}/configure
.if exists(${FILESDIR}/.asterisk.makeopts)
	${CP} ${FILESDIR}/.asterisk.makeopts ${WRKSRC}/menuselect.makeopts
.endif

post-patch-SYSINFO-on:
	@${REINPLACE_CMD} -e 's/%%LIBSYSINFO%%/-lsysinfo/' ${WRKSRC}/main/Makefile

post-patch-SYSINFO-off:
	@${REINPLACE_CMD} -e '/#define HAVE_SYSINFO 1/d' ${WRKSRC}/configure
	@${REINPLACE_CMD} -e '/%%LIBSYSINFO%%/d' ${WRKSRC}/main/Makefile

post-configure:
	@cd ${WRKSRC} && ${MAKE_CMD} menuselect.makeopts
	@cd ${WRKSRC} && ./menuselect/menuselect --disable res_timing_kqueue menuselect.makeopts
	@cd ${WRKSRC} && ./menuselect/menuselect --enable chan_mgcp menuselect.makeopts
	@cd ${WRKSRC} && ./menuselect/menuselect --enable res_pktccops menuselect.makeopts

post-configure-MYSQL-on:
	@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

post-configure-OOH323-on:
	@cd ${WRKSRC} && ./menuselect/menuselect --enable chan_ooh323 menuselect.makeopts

post-configure-NEWG711-on:
	@cd ${WRKSRC} && ./menuselect/menuselect --enable G711_NEW_ALGORITHM menuselect.makeopts

post-configure-OPTIMIZED_CFLAGS-off:
	@cd ${WRKSRC} && ./menuselect/menuselect --disable BUILD_NATIVE menuselect.makeopts

pre-build:
	@${MKDIR} ${WRKSRC}/res/pjproject/pjnath/lib ${WRKSRC}/res/pjproject/pjlib-util/lib \
		${WRKSRC}/res/pjproject/pjlib/lib

post-install:
	@${RM} ${STAGEDIR}${ETCDIR}/*.conf ${STAGEDIR}${ETCDIR}/extensions.ael ${STAGEDIR}${ETCDIR}/extensions.lua
	${FIND} ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/modules -type f -name '*.so' | ${SED} "s,^${STAGEDIR}${PREFIX}/,," >> ${TMPPLIST}
	${FIND} ${STAGEDIR}${DATADIR}/sounds -type f | ${SED} "s,^${STAGEDIR}${DATADIR},${DATADIR}," >> ${TMPPLIST}
	${FIND} ${STAGEDIR}${DATADIR}/moh -type f | ${SED} "s,^${STAGEDIR}${DATADIR},${DATADIR}," >> ${TMPPLIST}

	(cd ${STAGEDIR} && \
		${ECHO} "@owner ${ASTERISK_USER}" >> ${TMPPLIST} && \
		${ECHO} "@group ${ASTERISK_GROUP}" >> ${TMPPLIST} && \
		${FIND} var/spool/${PORTNAME}/voicemail/default -type f | ${SED} "s,^,/," >> ${TMPPLIST} && \
		${FIND} var/spool/${PORTNAME}/voicemail/ -type d | ${SED} "s,^,@dir /," >> ${TMPPLIST} && \
		${ECHO} "@owner" >> ${TMPPLIST} && \
		${ECHO} "@group" >> ${TMPPLIST});

.include <bsd.port.post.mk>
OpenPOWER on IntegriCloud