1################################################################################ 2# 3# asterisk 4# 5################################################################################ 6 7ASTERISK_VERSION = 16.21.1 8# Use the github mirror: it's an official mirror maintained by Digium, and 9# provides tarballs, which the main Asterisk git tree (behind Gerrit) does not. 10ASTERISK_SITE = $(call github,asterisk,asterisk,$(ASTERISK_VERSION)) 11 12ASTERISK_SOUNDS_BASE_URL = http://downloads.asterisk.org/pub/telephony/sounds/releases 13ASTERISK_EXTRA_DOWNLOADS = \ 14 $(ASTERISK_SOUNDS_BASE_URL)/asterisk-core-sounds-en-gsm-1.6.1.tar.gz \ 15 $(ASTERISK_SOUNDS_BASE_URL)/asterisk-moh-opsound-wav-2.03.tar.gz 16 17ASTERISK_LICENSE = GPL-2.0, BSD-3-Clause (SHA1, resample), BSD-4-Clause (db1-ast) 18ASTERISK_LICENSE_FILES = \ 19 COPYING \ 20 main/sha1.c \ 21 codecs/speex/speex_resampler.h \ 22 utils/db1-ast/include/db.h 23 24ASTERISK_CPE_ID_VENDOR = asterisk 25ASTERISK_CPE_ID_PRODUCT = open_source 26ASTERISK_SELINUX_MODULES = asterisk 27 28# For patches 0002, 0003 and 0005 29ASTERISK_AUTORECONF = YES 30ASTERISK_AUTORECONF_OPTS = -Iautoconf -Ithird-party -Ithird-party/pjproject -Ithird-party/jansson 31 32ASTERISK_DEPENDENCIES = \ 33 host-asterisk \ 34 jansson \ 35 libcurl \ 36 libedit \ 37 libxml2 \ 38 sqlite \ 39 util-linux 40 41# Asterisk wants to run its menuselect tool (a highly tweaked derivative of 42# kconfig), but builds it using the target tools. So we build it in the host 43# variant (see below), and copy the full build tree of menuselect. 44define ASTERISK_COPY_MENUSELECT 45 rm -rf $(@D)/menuselect 46 cp -a $(HOST_ASTERISK_DIR)/menuselect $(@D)/menuselect 47endef 48ASTERISK_PRE_CONFIGURE_HOOKS += ASTERISK_COPY_MENUSELECT 49 50ASTERISK_CONF_OPTS = \ 51 --disable-xmldoc \ 52 --disable-internal-poll \ 53 --disable-asteriskssl \ 54 --disable-rpath \ 55 --without-bfd \ 56 --without-cap \ 57 --without-cpg \ 58 --without-curses \ 59 --without-gtk2 \ 60 --without-gmime \ 61 --without-hoard \ 62 --without-iconv \ 63 --without-iksemel \ 64 --without-imap \ 65 --without-inotify \ 66 --without-iodbc \ 67 --without-isdnnet \ 68 --without-jack \ 69 --without-uriparser \ 70 --without-kqueue \ 71 --without-libedit \ 72 --without-libxslt \ 73 --without-lua \ 74 --without-misdn \ 75 --without-mysqlclient \ 76 --without-nbs \ 77 --without-neon29 \ 78 --without-newt \ 79 --without-openr2 \ 80 --without-osptk \ 81 --without-oss \ 82 --without-postgres \ 83 --without-pjproject \ 84 --without-pjproject-bundled \ 85 --without-popt \ 86 --without-resample \ 87 --without-sdl \ 88 --without-SDL_image \ 89 --without-sqlite \ 90 --without-suppserv \ 91 --without-tds \ 92 --without-termcap \ 93 --without-timerfd \ 94 --without-tinfo \ 95 --without-unbound \ 96 --without-unixodbc \ 97 --without-vpb \ 98 --without-x11 \ 99 --with-crypt \ 100 --with-jansson \ 101 --with-libcurl \ 102 --with-ilbc \ 103 --with-libxml2 \ 104 --with-libedit="$(STAGING_DIR)/usr" \ 105 --with-sqlite3="$(STAGING_DIR)/usr" \ 106 --with-sounds-cache=$(ASTERISK_DL_DIR) 107 108# avcodec are from ffmpeg. There is virtually zero chance this could 109# even work; asterisk is looking for ffmpeg/avcodec.h which has not 110# been installed in this location since early 2007 (~10 years ago at 111# the time of this writing). 112ASTERISK_CONF_OPTS += --without-avcodec 113 114# asterisk is not compatible with freeswitch spandsp 115ASTERISK_CONF_OPTS += --without-spandsp 116 117ASTERISK_CONF_ENV = \ 118 ac_cv_file_bridges_bridge_softmix_include_hrirs_h=true \ 119 ac_cv_path_CONFIG_LIBXML2=$(STAGING_DIR)/usr/bin/xml2-config 120 121# Uses __atomic_fetch_add_4 122ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y) 123ASTERISK_CONF_ENV += LIBS="-latomic" 124endif 125 126ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y) 127ASTERISK_CONF_OPTS += --with-execinfo 128else 129ASTERISK_CONF_OPTS += --without-execinfo 130endif 131 132ifeq ($(BR2_PACKAGE_LIBGSM),y) 133ASTERISK_DEPENDENCIES += libgsm 134ASTERISK_CONF_OPTS += --with-gsm 135else 136ASTERISK_CONF_OPTS += --without-gsm 137endif 138 139ifeq ($(BR2_PACKAGE_ALSA_LIB),y) 140ASTERISK_DEPENDENCIES += alsa-lib 141ASTERISK_CONF_OPTS += --with-asound 142else 143ASTERISK_CONF_OPTS += --without-asound 144endif 145 146ifeq ($(BR2_PACKAGE_BLUEZ5_UTILS),y) 147ASTERISK_DEPENDENCIES += bluez5_utils 148ASTERISK_CONF_OPTS += --with-bluetooth 149else 150ASTERISK_CONF_OPTS += --without-bluetooth 151endif 152 153ifeq ($(BR2_PACKAGE_LIBICAL),y) 154ASTERISK_DEPENDENCIES += libical 155ASTERISK_CONF_OPTS += --with-ical 156else 157ASTERISK_CONF_OPTS += --without-ical 158endif 159 160ifeq ($(BR2_PACKAGE_OPENLDAP),y) 161ASTERISK_DEPENDENCIES += openldap 162ASTERISK_CONF_OPTS += --with-ldap 163else 164ASTERISK_CONF_OPTS += --without-ldap 165endif 166 167ifeq ($(BR2_PACKAGE_NEON),y) 168ASTERISK_DEPENDENCIES += neon 169ASTERISK_CONF_OPTS += --with-neon 170ASTERISK_CONF_ENV += \ 171 ac_cv_path_CONFIG_NEON=$(STAGING_DIR)/usr/bin/neon-config 172else 173ASTERISK_CONF_OPTS += --without-neon 174endif 175 176ifeq ($(BR2_PACKAGE_NETSNMP),y) 177ASTERISK_DEPENDENCIES += netsnmp 178ASTERISK_CONF_OPTS += --with-netsnmp=$(STAGING_DIR)/usr 179else 180ASTERISK_CONF_OPTS += --without-netsnmp 181endif 182 183ifeq ($(BR2_PACKAGE_LIBOGG),y) 184ASTERISK_DEPENDENCIES += libogg 185ASTERISK_CONF_OPTS += --with-ogg 186else 187ASTERISK_CONF_OPTS += --without-ogg 188endif 189 190ifeq ($(BR2_PACKAGE_OPUS),y) 191ASTERISK_DEPENDENCIES += opus 192ASTERISK_CONF_OPTS += --with-opus 193else 194ASTERISK_CONF_OPTS += --without-opus 195endif 196 197ifeq ($(BR2_PACKAGE_PORTAUDIO),y) 198ASTERISK_DEPENDENCIES += portaudio 199ASTERISK_CONF_OPTS += --with-portaudio 200else 201ASTERISK_CONF_OPTS += --without-portaudio 202endif 203 204ifeq ($(BR2_PACKAGE_FREERADIUS_CLIENT),y) 205ASTERISK_DEPENDENCIES += freeradius-client 206ASTERISK_CONF_OPTS += --with-radius 207else 208ASTERISK_CONF_OPTS += --without-radius 209endif 210 211ifeq ($(BR2_PACKAGE_DAHDI_LINUX)$(BR2_PACKAGE_DAHDI_TOOLS),yy) 212ASTERISK_DEPENDENCIES += dahdi-linux dahdi-tools 213ASTERISK_CONF_OPTS += --with-dahdi --with-tonezone 214 215ifeq ($(BR2_PACKAGE_LIBPRI),y) 216ASTERISK_DEPENDENCIES += libpri 217ASTERISK_CONF_OPTS += --with-pri 218else 219ASTERISK_CONF_OPTS += --without-pri 220endif # PRI 221 222ifeq ($(BR2_PACKAGE_LIBSS7),y) 223ASTERISK_DEPENDENCIES += libss7 224ASTERISK_CONF_OPTS += --with-ss7 225else 226ASTERISK_CONF_OPTS += --without-ss7 227endif # SS7 228 229else 230ASTERISK_CONF_OPTS += \ 231 --without-dahdi --without-tonezone \ 232 --without-pri --without-ss7 233endif # DAHDI 234 235ifeq ($(BR2_PACKAGE_OPENSSL),y) 236ASTERISK_DEPENDENCIES += openssl 237ASTERISK_CONF_OPTS += --with-ssl 238else 239ASTERISK_CONF_OPTS += --without-ssl 240endif 241 242ifeq ($(BR2_PACKAGE_SPEEX)$(BR2_PACKAGE_SPEEXDSP),yy) 243ASTERISK_DEPENDENCIES += speex 244ASTERISK_CONF_OPTS += --with-speex --with-speexdsp 245else 246ASTERISK_CONF_OPTS += --without-speex --without-speexdsp 247endif 248 249# asterisk needs an openssl-enabled libsrtp 250ifeq ($(BR2_PACKAGE_LIBSRTP)$(BR2_PACKAGE_OPENSSL)x$(BR2_STATIC_LIBS),yyx) 251ASTERISK_DEPENDENCIES += libsrtp 252ASTERISK_CONF_OPTS += --with-srtp 253else 254ASTERISK_CONF_OPTS += --without-srtp 255endif 256 257ifeq ($(BR2_PACKAGE_LIBVORBIS),y) 258ASTERISK_DEPENDENCIES += libvorbis 259ASTERISK_CONF_OPTS += --with-vorbis 260else 261ASTERISK_CONF_OPTS += --without-vorbis 262endif 263 264ifeq ($(BR2_PACKAGE_ZLIB),y) 265ASTERISK_DEPENDENCIES += zlib 266ASTERISK_CONF_OPTS += --with-z 267else 268ASTERISK_CONF_OPTS += --without-z 269endif 270 271ASTERISK_DIRS = \ 272 ASTVARLIBDIR="/usr/lib/asterisk" \ 273 ASTDATADIR="/usr/lib/asterisk" \ 274 ASTKEYDIR="/usr/lib/asterisk" \ 275 ASTDBDIR="/usr/lib/asterisk" 276 277ASTERISK_MAKE_OPTS = $(ASTERISK_DIRS) 278 279# Uses __atomic_fetch_add_4 280ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y) 281ASTERISK_MAKE_OPTS += ASTLDFLAGS="-latomic" 282endif 283 284# Remove default -O3 optimization flag 285ASTERISK_MAKE_OPTS += OPTIMIZE="" 286 287ASTERISK_CFLAGS = $(TARGET_CFLAGS) 288 289ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_93847),y) 290ASTERISK_CFLAGS += -O0 291endif 292 293ASTERISK_CONF_OPTS += CFLAGS="$(ASTERISK_CFLAGS)" 294 295# We want to install sample configuration files, too. 296ASTERISK_INSTALL_TARGET_OPTS = \ 297 $(ASTERISK_DIRS) \ 298 DESTDIR=$(TARGET_DIR) \ 299 LDCONFIG=true \ 300 install samples 301 302$(eval $(autotools-package)) 303 304#------------------------------------------------------------------------------- 305# This part deals with building the menuselect tool as a host package 306 307HOST_ASTERISK_DEPENDENCIES = host-pkgconf host-libxml2 host-ncurses 308HOST_ASTERISK_SUBDIR = menuselect 309 310HOST_ASTERISK_LICENSE = GPL-2.0 311HOST_ASTERISK_LICENSE_FILES = COPYING 312 313# No need to autoreconf for the host variant, 314# so do not inherit the target setup. 315HOST_ASTERISK_AUTORECONF = NO 316 317HOST_ASTERISK_CONF_ENV = CONFIG_LIBXML2=$(HOST_DIR)/bin/xml2-config 318 319HOST_ASTERISK_CONF_OPTS = \ 320 --without-newt \ 321 --without-curses \ 322 --with-ncurses=$(HOST_DIR) 323 324# Not an automake package, so does not inherit LDFLAGS et al. from 325# the configure run. 326HOST_ASTERISK_MAKE_ENV = $(HOST_CONFIGURE_OPTS) 327 328# Even though menuselect is an autotools package, it is not an automake 329# package and does not have an 'install' rule, as asterisk does expect 330# it to be in a sub-directory of its source tree. We do so by copying 331# the full menuselect build tree as a pre-configure hook in the target 332# variant. 333# However, the sanity checks on host packages are not run on menuselect. 334# But we still want to catch that menuselect has the proper rpath set, 335# for example, as it uses host libraries that we do build, like 336# host-libxml2. 337# So we do manually install the menuselect tool. 338define HOST_ASTERISK_INSTALL_CMDS 339 $(INSTALL) -D -m 0755 $(@D)/menuselect/menuselect \ 340 $(HOST_DIR)/bin/asterisk-menuselect 341endef 342 343$(eval $(host-autotools-package)) 344