summaryrefslogtreecommitdiff
path: root/comms/asterisk16/Makefile
blob: 36c700544464749b8fd9d2b8a9d7db7b7aabe129 (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
# $NetBSD: Makefile,v 1.29 2011/01/21 05:13:12 jnemeth Exp $
#
# NOTE: when updating this package, there are two places that sound
#       tarballs need to be checked

DISTNAME=	asterisk-1.6.2.16.1
DIST_SUBDIR=	${PKGNAME_NOREV}
DISTFILES=	${DEFAULT_DISTFILES}
EXTRACT_ONLY=	${DISTNAME}.tar.gz
CATEGORIES=	comms net audio
MASTER_SITES=	http://downloads.asterisk.org/pub/telephony/asterisk/ \
		http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/ \
		http://downloads.asterisk.org/pub/telephony/sounds/releases/

OWNER=		jnemeth@NetBSD.org
HOMEPAGE=	http://www.asterisk.org/
COMMENT=	The Asterisk Software PBX
LICENSE=	gnu-gpl-v2

CONFLICTS+=	asterisk-sounds-extra-[0-9]*

PKG_DESTDIR_SUPPORT=	user-destdir

.include "../../mk/bsd.prefs.mk"

USE_TOOLS+=		bison gmake perl:run pkg-config tar
USE_LANGUAGES=		c c++
REPLACE_PERL+=		agi/DialAnMp3.agi agi/agi-test.agi
REPLACE_PERL+=		agi/fastagi-test agi/jukebox.agi agi/numeralize
REPLACE_PERL+=		contrib/scripts/vmail.cgi

GNU_CONFIGURE=		yes
CONFIGURE_ARGS+=	--datarootdir=${PREFIX}/libdata
CONFIGURE_ARGS+=	--sysconfdir=${PKG_SYSCONFDIR}
CONFIGURE_ARGS+=	--without-gtk2
# XXX remove when lang/lua gets builtin.mk
CONFIGURE_ARGS+=	--without-lua

INSTALL_TARGET=		install samples
INSTALLATION_DIRS+=	lib/pkgconfig share/doc/${PKGBASE}
INSTALLATION_DIRS+=	share/examples/asterisk share/examples/rc.d
INSTALLATION_DIRS+=	${ASTDATADIR}/sounds/en ${ASTDATADIR}/moh

BUILD_DEFS+=		VARBASE

# Running as non-root will come later
ASTERISK_USER?=		asterisk
ASTERISK_GROUP?=	asterisk
PKG_GROUPS=		${ASTERISK_GROUP}
PKG_USERS=		${ASTERISK_USER}:${ASTERISK_GROUP}
PKG_GECOS.${ASTERISK_USER}=	Asterisk PBX
PKG_GROUPS_VARS=	ASTERISK_GROUP
PKG_USERS_VARS=		ASTERISK_USER
FILES_SUBST+=		ASTERISK_USER=${ASTERISK_USER}
FILES_SUBST+=		ASTERISK_GROUP=${ASTERISK_GROUP}
MESSAGE_SUBST+=		ASTERISK_USER=${ASTERISK_USER}
MESSAGE_SUBST+=		ASTERISK_GROUP=${ASTERISK_GROUP}

# Various path settings for Asterisk
PKG_SYSCONFSUBDIR=	asterisk
PKG_SYSCONFDIR_PERMS=	${ASTERISK_USER} ${ASTERISK_GROUP} 0755
ASTETCDIR=		${PKG_SYSCONFDIR}
ASTEXAMPLEDIR=		${PREFIX}/share/examples/asterisk
ASTDBDIR=		${VARBASE}/db/asterisk
ASTSPOOLDIR=		${VARBASE}/spool/asterisk
ASTLOGDIR=		${VARBASE}/log/asterisk
MESSAGE_SUBST+=		ASTDBDIR=${ASTDBDIR}
MESSAGE_SUBST+=		ASTSPOOLDIR=${ASTSPOOLDIR}
MESSAGE_SUBST+=		ASTLOGDIR=${ASTLOGDIR}
ASTVARRUNDIR=		${VARBASE}/run/asterisk
FILES_SUBST+=		ASTVARRUNDIR=${ASTVARRUNDIR}
ASTDATADIR=		${PREFIX}/libdata/asterisk
MAKE_FLAGS+=		ASTLIBDIR=${PREFIX}/lib/asterisk
MAKE_FLAGS+=		ASTVARLIBDIR=${ASTDATADIR}
MAKE_FLAGS+=		ASTKEYDIR=${ASTDATADIR}
MAKE_FLAGS+=		ASTDATADIR=${ASTDATADIR}
MAKE_FLAGS+=		ASTSPOOLDIR=${ASTSPOOLDIR}
MAKE_FLAGS+=		ASTLOGDIR=${ASTLOGDIR}
MAKE_FLAGS+=		ASTHEADERDIR=${PREFIX}/include/asterisk
MAKE_FLAGS+=		ASTCONFPATH=${ASTETCDIR}/asterisk.conf
MAKE_FLAGS+=		ASTBINDIR=${PREFIX}/bin
MAKE_FLAGS+=		ASTSBINDIR=${PREFIX}/sbin
MAKE_FLAGS+=		ASTVARRUNDIR=${ASTVARRUNDIR}
MAKE_FLAGS+=		ASTMANDIR=${PREFIX}/${PKGMANDIR}
MAKE_FLAGS+=		ASTETCDIR=${ASTETCDIR}
MAKE_FLAGS+=		ASTDBDIR=${ASTDBDIR}
MAKE_FLAGS+=		AGI_DIR=${PREFIX}/libexec/agi-bin
MAKE_FLAGS+=		ASTEXAMPLEDIR=${ASTEXAMPLEDIR}
MAKE_FLAGS+=		WRKSRC=${WRKSRC}
MAKE_FLAGS+=		LDOPTS=${LDFLAGS:M*:Q}
MAKE_FLAGS+=		HTTP_DOCSDIR=${PREFIX}/share/httpd/htdocs
MAKE_FLAGS+=		HTTP_CGIDIR=${PREFIX}/libexec/cgi-bin

.include "options.mk"

# check sounds/Makefile for current version when upgrading package
DISTFILES+=	asterisk-extra-sounds-en-gsm-1.4.11.tar.gz

# Override default paths in config files
SUBST_CLASSES+=		configs
SUBST_STAGE.configs=	pre-configure
SUBST_FILES.configs=	configs/festival.conf.sample
SUBST_FILES.configs+=	configs/http.conf.sample
SUBST_FILES.configs+=	configs/musiconhold.conf.sample
SUBST_FILES.configs+=	configs/osp.conf.sample
SUBST_FILES.configs+=	configs/phoneprov.conf.sample
SUBST_FILES.configs+=	configs/res_config_sqlite.conf.sample
SUBST_SED.configs+=	-e 's|/var/lib/asterisk|${ASTVARLIBDIR}|'
SUBST_SED.configs+=	-e "s|/usr/local/man|${ASTMANDIR}|"
SUBST_SED.configs+=	-e "s|/usr/local|${PREFIX}|"
SUBST_SED.configs+=	-e "s|/var|${VARBASE}|"

# XXX gross hack, remove when atomics properly implemented
.if (${OPSYS} == "NetBSD")
SUBST_CLASSES+=		atomics
SUBST_STAGE.atomics=	post-configure
SUBST_FILES.atomics=	include/asterisk/autoconfig.h
SUBST_SED.atomics=	-e "s|^\#define HAVE_GCC_ATOMICS 1|\#undef HAVE_GCC_ATOMICS|"
.endif

RCD_SCRIPTS=		asterisk
OWN_DIRS_PERMS+=	${ASTDBDIR} ${ASTERISK_USER} ${ASTERISK_GROUP} 0755
OWN_DIRS_PERMS+=	${ASTSPOOLDIR} ${ASTERISK_USER} ${ASTERISK_GROUP} 0755
OWN_DIRS_PERMS+=	${ASTSPOOLDIR}/dictate ${ASTERISK_USER} ${ASTERISK_GROUP} 0755
OWN_DIRS_PERMS+=	${ASTSPOOLDIR}/meetme ${ASTERISK_USER} ${ASTERISK_GROUP} 0755
OWN_DIRS_PERMS+=	${ASTSPOOLDIR}/monitor ${ASTERISK_USER} ${ASTERISK_GROUP} 0755
OWN_DIRS_PERMS+=	${ASTSPOOLDIR}/system ${ASTERISK_USER} ${ASTERISK_GROUP} 0755
OWN_DIRS_PERMS+=	${ASTSPOOLDIR}/tmp ${ASTERISK_USER} ${ASTERISK_GROUP} 0755
OWN_DIRS_PERMS+=	${ASTSPOOLDIR}/voicemail ${ASTERISK_USER} ${ASTERISK_GROUP} 0755
OWN_DIRS_PERMS+=	${ASTSPOOLDIR}/voicemail/default ${ASTERISK_USER} ${ASTERISK_GROUP} 0755
OWN_DIRS_PERMS+=	${ASTSPOOLDIR}/voicemail/default/1234 ${ASTERISK_USER} ${ASTERISK_GROUP} 0755
OWN_DIRS_PERMS+=	${ASTSPOOLDIR}/voicemail/default/1234/INBOX ${ASTERISK_USER} ${ASTERISK_GROUP} 0755
OWN_DIRS_PERMS+=	${ASTSPOOLDIR}/voicemail/default/1234/en ${ASTERISK_USER} ${ASTERISK_GROUP} 0755
SPECIAL_PERMS+=		${ASTSPOOLDIR}/voicemail/default/1234/en/busy.gsm ${ASTERISK_USER} ${ASTERISK_GROUP} 0644
SPECIAL_PERMS+=		${ASTSPOOLDIR}/voicemail/default/1234/en/unavail.gsm ${ASTERISK_USER} ${ASTERISK_GROUP} 0644
OWN_DIRS_PERMS+=	${ASTSPOOLDIR}/voicemail/default/INBOX ${ASTERISK_USER} ${ASTERISK_GROUP} 0755
OWN_DIRS_PERMS+=	${ASTSPOOLDIR}/voicemail/default/en ${ASTERISK_USER} ${ASTERISK_GROUP} 0755
OWN_DIRS_PERMS+=	${ASTLOGDIR} ${ASTERISK_USER} ${ASTERISK_GROUP} 0755
OWN_DIRS_PERMS+=	${ASTLOGDIR}/cdr-csv ${ASTERISK_USER} ${ASTERISK_GROUP} 0755
OWN_DIRS_PERMS+=	${ASTLOGDIR}/cdr-custom ${ASTERISK_USER} ${ASTERISK_GROUP} 0755

CONF_FILES_PERMS=	# empty
.for f in asterisk.conf extensions.conf
CONF_FILES_PERMS+=	${ASTEXAMPLEDIR}/${f:Q} ${PKG_SYSCONFDIR}/${f:Q} ${ASTERISK_USER} ${ASTERISK_GROUP} 0644
.endfor

# if we put all the files in $CONF_FILES, the message is _way_ too long.
.for f in adsi.conf adtranvofr.conf agents.conf alarmreceiver.conf	\
	alsa.conf amd.conf asterisk.adsi cdr.conf 			\
	cdr_adaptive_odbc.conf cdr_custom.conf cdr_manager.conf		\
	cdr_odbc.conf cdr_pgsql.conf cdr_sqlite3_custom.conf		\
	cdr_tds.conf chan_dahdi.conf cli.conf cli_aliases.conf		\
	cli_permissions.conf codecs.conf console.conf			\
	dnsmgr.conf dundi.conf enum.conf extensions.ael extconfig.conf	\
	extensions.conf	extensions.lua extensions_minivm.conf		\
	features.conf festival.conf followme.conf func_odbc.conf	\
	gtalk.conf h323.conf http.conf iax.conf iaxprov.conf		\
	indications.conf jabber.conf jingle.conf logger.conf		\
	manager.conf meetme.conf mgcp.conf minivm.conf misdn.conf	\
	modules.conf musiconhold.conf muted.conf osp.conf oss.conf	\
	phone.conf phoneprov.conf queuerules.conf queues.conf		\
	res_config_sqlite.conf res_ldap.conf res_odbc.conf		\
	res_pgsql.conf res_snmp.conf	\
	rpt.conf rtp.conf say.conf sip.conf sip_notify.conf skinny.conf	\
	sla.conf smdi.conf telcordia-1.adsi udptl.conf unistim.conf	\
	usbradio.conf users.conf voicemail.conf vpb.conf
CONF_FILES_PERMS+=		${ASTEXAMPLEDIR}/${f:Q} ${PKG_SYSCONFDIR}/${f:Q} ${ASTERISK_USER} ${ASTERISK_GROUP} 0644
.endfor

PTHREAD_OPTS+=	require native

.if (${OPSYS} == "Darwin" && exists(/usr/include/sys/poll.h))
post-patch:
	${ECHO} "#include <sys/poll.h>" > ${WRKSRC}/include/asterisk/poll-compat.h
.endif

post-install:
# check sounds directory for current versions when upgrading package
	${TAR} xzf ${WRKSRC}/sounds/asterisk-core-sounds-en-gsm-1.4.20.tar.gz -C ${DESTDIR}${ASTDATADIR}/sounds/en
	${TAR} xzf ${WRKSRC}/sounds/asterisk-moh-opsound-wav-2.03.tar.gz -C ${DESTDIR}${ASTDATADIR}/moh
	${TAR} xzf ${DISTDIR}/${DIST_SUBDIR}/asterisk-extra-sounds-en-gsm-1.4.11.tar.gz -C ${DESTDIR}${ASTDATADIR}/sounds/en
	${INSTALL_DATA} ${WRKSRC}/BUGS ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/CHANGES ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/COPYING ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/CREDITS ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/ChangeLog ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/LICENSE ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/README ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/README-SERIOUSLY.bestpractices.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/UPGRADE-1.2.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/UPGRADE-1.4.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/UPGRADE-1.6.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/UPGRADE.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/Zaptel-to-DAHDI.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/HOWTO_collect_debug_information.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/IAX2-security.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/India-CID.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/PEERING ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/api-1.6.2-changes.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/asterisk-mib.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/backtrace.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/building_queues.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/callfiles.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/chan_sip-perf-testing.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/cli.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/database_transactions.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/datastores.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/digium-mib.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/distributed_devstate.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/externalivr.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/followme.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/jabber.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/janitor-projects.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/jingle.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/ldap.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/macroexclusive.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/manager_1_1.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/modules.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/osp.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/queue.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/realtimetext.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/res_config_sqlite.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/rtp-packetization.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/sip-retransmit.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/siptls.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/smdi.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/sms.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/snmp.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/speechrec.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/ss7.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/timing.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/unistim.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/valgrind.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/video.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/video_console.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/voicemail_odbc_postgresql.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/doc/tex/asterisk.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}

.include "../../devel/zlib/buildlink3.mk"
.include "../../security/openssl/buildlink3.mk"
.include "../../textproc/libxml2/buildlink3.mk"
.include "../../www/curl/buildlink3.mk"
.include "../../mk/curses.buildlink3.mk"
.include "../../mk/pthread.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"