asterisk.mk 8.7 KB

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