--- /dev/null
+#
+# Copyright (C) 2017 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=freeswitch-stable-sounds
+PKG_VERSION:=1.0.52
+PKG_RELEASE:=1
+PKG_MAINTAINER:=Sebastian Kemper <sebastian_ml@gmx.net>
+
+PKG_LICENSE:=MPL-1.1
+
+PRG_URL:=https://files.freeswitch.org/releases/sounds
+
+include $(INCLUDE_DIR)/package.mk
+
+SOUNDS_DIR:=/usr/share/freeswitch/sounds
+
+define Package/$(PKG_NAME)/Default
+ SUBMENU:=Telephony
+ SECTION:=net
+ CATEGORY:=Network
+ URL:=https://www.freeswitch.org
+ DEPENDS:=freeswitch-stable
+ PKGARCH:=all
+endef
+
+define Package/$(PKG_NAME)/Sounds
+define Package/$(PKG_NAME)-$(1)
+$(call Package/$(PKG_NAME)/Default)
+ TITLE:=$(2)
+endef
+define Download/$(PKG_NAME)-$(1)
+ FILE:=freeswitch-sounds-$(1)-$(4).tar.gz
+ URL:=$(PRG_URL)
+ MD5SUM:=$(5)
+endef
+define Package/$(PKG_NAME)-$(1)/description
+$(3)
+endef
+define Package/$(PKG_NAME)-$(1)/install
+ $(INSTALL_DIR) $$(1)$(SOUNDS_DIR)
+ $(TAR) --extract --no-same-owner --no-same-permissions --gzip \
+ --file=$(DL_DIR)/freeswitch-sounds-$(1)-$(4).tar.gz \
+ --directory=$$(1)$(SOUNDS_DIR)
+ $(FIND) $$(1)$(SOUNDS_DIR) -type d -exec chmod 755 {} \;
+ $(FIND) $$(1)$(SOUNDS_DIR) -type f -exec chmod 644 {} \;
+endef
+ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-$(1)),)
+$$(eval $$(call Download,$(PKG_NAME)-$(1)))
+endif
+$$(eval $$(call BuildPackage,$(PKG_NAME)-$(1)))
+endef
+
+define Build/Prepare
+endef
+
+define Build/Compile
+endef
+
+################################
+# FreeSWITCH sound packs
+# Params:
+# 1 - Package subname
+# 2 - Package title
+# 3 - Package description
+# 4 - Source version
+# 5 - Source SHA256SUM
+################################
+
+$(eval $(call Package/$(PKG_NAME)/Sounds,en-ca-june-8000,Sound prompts,Speaker: June - Language: en-CA - Sample Rate: 8kHz,1.0.51,9aaa9d73cfecfdab7a1fa2d63d65b922b86a405ebb9a31b09b15e58a2af9260a))
+$(eval $(call Package/$(PKG_NAME)/Sounds,en-ca-june-16000,Sound prompts,Speaker: June - Language: en-CA - Sample Rate: 16kHz,1.0.51,8d0091a2c98e5e06afea6bdd9f6cf2942e937786016037207b85757218b0f7a7))
+$(eval $(call Package/$(PKG_NAME)/Sounds,en-ca-june-32000,Sound prompts,Speaker: June - Language: en-CA - Sample Rate: 32kHz,1.0.51,8720b363995724792ff4723e1c8218ef95b27cb36208b7258f93bdda72123387))
+$(eval $(call Package/$(PKG_NAME)/Sounds,en-ca-june-48000,Sound prompts,Speaker: June - Language: en-CA - Sample Rate: 48kHz,1.0.51,d2fce478a95b8d9500a544a00253c81d7e9f639e21980bd689910fac87f30871))
+$(eval $(call Package/$(PKG_NAME)/Sounds,en-us-callie-8000,Sound prompts,Speaker: Callie - Language: en-US - Sample Rate: 8kHz,1.0.51,e48a63bd69e6253d294ce43a941d603b02467feb5d92ee57a536ccc5f849a4a8))
+$(eval $(call Package/$(PKG_NAME)/Sounds,en-us-callie-16000,Sound prompts,Speaker: Callie - Language: en-US - Sample Rate: 16kHz,1.0.51,324b1ab5ab754db5697963e9bf6a2f9c7aeb1463755e86bbb6dc4d6a77329da2))
+$(eval $(call Package/$(PKG_NAME)/Sounds,en-us-callie-32000,Sound prompts,Speaker: Callie - Language: en-US - Sample Rate: 32kHz,1.0.51,06fd6b8aec937556bf5303ab19a212c60daf00546d395cf269dfe324ac9c6838))
+$(eval $(call Package/$(PKG_NAME)/Sounds,en-us-callie-48000,Sound prompts,Speaker: Callie - Language: en-US - Sample Rate: 48kHz,1.0.51,cfc50f1d9b5d43cb87a9a2c0ce136c37ee85ac3b0e5be930d8dc2c913c4495aa))
+$(eval $(call Package/$(PKG_NAME)/Sounds,fr-ca-june-8000,Sound prompts,Speaker: June - Language: fr-CA - Sample Rate: 8kHz,1.0.51,eada67c61bd62ec420eb017df7524d10de286fba0c2da4800516b9f62c00e78c))
+$(eval $(call Package/$(PKG_NAME)/Sounds,fr-ca-june-16000,Sound prompts,Speaker: June - Language: fr-CA - Sample Rate: 16kHz,1.0.51,f942980ad359951ef3f69a324a3299ef86cdb4f8d2c62adaf73a1b95fb39fcc6))
+$(eval $(call Package/$(PKG_NAME)/Sounds,fr-ca-june-32000,Sound prompts,Speaker: June - Language: fr-CA - Sample Rate: 32kHz,1.0.51,8966a0c4daf666018cca6d8ba0f7708e251bed952b015d0ca6a0792341fe531b))
+$(eval $(call Package/$(PKG_NAME)/Sounds,fr-ca-june-48000,Sound prompts,Speaker: June - Language: fr-CA - Sample Rate: 48kHz,1.0.51,abaea558fb5485abdd01d0b1186e03cf508f96ac90492814cc7ed4475e99a1e0))
+$(eval $(call Package/$(PKG_NAME)/Sounds,music-8000,Music on Hold,Music on Hold - Sample Rate: 8kHz,1.0.52,2491dcb92a69c629b03ea070d2483908a52e2c530dd77791f49a45a4d70aaa07))
+$(eval $(call Package/$(PKG_NAME)/Sounds,music-16000,Music on Hold,Music on Hold - Sample Rate: 16kHz,1.0.52,93e0bf31797f4847dc19a94605c039ad4f0763616b6d819f5bddbfb6dd09718a))
+$(eval $(call Package/$(PKG_NAME)/Sounds,music-32000,Music on Hold,Music on Hold - Sample Rate: 32kHz,1.0.52,4129788a638b77c5f85ff35abfcd69793d8aeb9d7833a75c74ec77355b2657a9))
+$(eval $(call Package/$(PKG_NAME)/Sounds,music-48000,Music on Hold,Music on Hold - Sample Rate: 48kHz,1.0.52,cc31cdb5b1bd653850bf6e054d963314bcf7c1706a9bf05f5a69bcbd00858d2a))
+$(eval $(call Package/$(PKG_NAME)/Sounds,pl-pl-espeak-8000,Sound prompts,Speaker: espeak - Language: pl-PL - Sample Rate: 8kHz,0.1.0,4bc7a772edde56d76f618fe4b33d71e47314cf36fc632c94a22d34dd581cbfc0))
+$(eval $(call Package/$(PKG_NAME)/Sounds,pl-pl-espeak-16000,Sound prompts,Speaker: espeak - Language: pl-PL - Sample Rate: 16kHz,0.1.0,824f28092913e3be8a042347b20bf0c425c7889de54cfa0740767c1431e66a93))
+$(eval $(call Package/$(PKG_NAME)/Sounds,pt-BR-karina-8000,Sound prompts,Speaker: Karina - Language: pr-BR - Sample Rate: 8kHz,1.0.51,ba9b5d7f97675c560823a6f94804a6716dac66efe203dd1779952518c3944a77))
+$(eval $(call Package/$(PKG_NAME)/Sounds,pt-BR-karina-16000,Sound prompts,Speaker: Karina - Language: pr-BR - Sample Rate: 16kHz,1.0.51,80432c1027f57e464cd899ed92216936cf48a3993dc1c168b1be2545b8f97aed))
+$(eval $(call Package/$(PKG_NAME)/Sounds,pt-BR-karina-32000,Sound prompts,Speaker: Karina - Language: pr-BR - Sample Rate: 32kHz,1.0.51,e80a8653585cf9a4fe9cf1c0004279602542d15894ba13f2104d990cefdee567))
+$(eval $(call Package/$(PKG_NAME)/Sounds,pt-BR-karina-48000,Sound prompts,Speaker: Karina - Language: pr-BR - Sample Rate: 48kHz,1.0.51,51ef9cac2dc4dd70d81c18f8e65bfd11de44207e8fac9961a68aa0d50d539870))
+$(eval $(call Package/$(PKG_NAME)/Sounds,ru-RU-elena-8000,Sound prompts,Speaker: Elena - Language: ru-RU - Sample Rate: 8kHz,1.0.51,d2679503eb1f4dc1716df5f8c4b5a7b721f087b17e96a02b1a92480311074c66))
+$(eval $(call Package/$(PKG_NAME)/Sounds,ru-RU-elena-16000,Sound prompts,Speaker: Elena - Language: ru-RU - Sample Rate: 16kHz,1.0.51,d2679503eb1f4dc1716df5f8c4b5a7b721f087b17e96a02b1a92480311074c66))
+$(eval $(call Package/$(PKG_NAME)/Sounds,ru-RU-elena-32000,Sound prompts,Speaker: Elena - Language: ru-RU - Sample Rate: 32kHz,1.0.51,d2679503eb1f4dc1716df5f8c4b5a7b721f087b17e96a02b1a92480311074c66))
+$(eval $(call Package/$(PKG_NAME)/Sounds,ru-RU-elena-48000,Sound prompts,Speaker: Elena - Language: ru-RU - Sample Rate: 48kHz,1.0.51,d2679503eb1f4dc1716df5f8c4b5a7b721f087b17e96a02b1a92480311074c66))
+$(eval $(call Package/$(PKG_NAME)/Sounds,sv-se-jakob-8000,Sound prompts,Speaker: Jakob - Language: sv-SE - Sample Rate: 8kHz,1.0.50,aa81c97b2954b36d5625d556d2c6764ee79d0c925284ba5ff4c60cb479936b48))
+$(eval $(call Package/$(PKG_NAME)/Sounds,sv-se-jakob-16000,Sound prompts,Speaker: Jakob - Language: sv-SE - Sample Rate: 16kHz,1.0.50,52da670c651ff598815aed655644b44b891ee158f4c67d048da90056a36ddcf6))
+$(eval $(call Package/$(PKG_NAME)/Sounds,sv-se-jakob-32000,Sound prompts,Speaker: Jakob - Language: sv-SE - Sample Rate: 32kHz,1.0.50,160de01069afa827c830595e521b53d95de4b415b48061fb843a1c4025fa17f2))
+$(eval $(call Package/$(PKG_NAME)/Sounds,sv-se-jakob-48000,Sound prompts,Speaker: Jakob - Language: sv-SE - Sample Rate: 48kHz,1.0.50,059889d75926b8e1f39e8d2c33f0e8f744a43c094bbe213a1caa9f26ae9a2799))
+$(eval $(call Package/$(PKG_NAME)/Sounds,zh-cn-sinmei-8000,Sound prompts,Speaker: Sinmei - Language: zh-CN - Sample Rate: 8kHz,1.0.51,764985f39313426ef4a0ea4dd848f05faaced37b91b2c9a22f17d3f77235fae3))
+$(eval $(call Package/$(PKG_NAME)/Sounds,zh-cn-sinmei-16000,Sound prompts,Speaker: Sinmei - Language: zh-CN - Sample Rate: 16kHz,1.0.51,d849a5818ac6630d7c572d728dcd48176a6877defd8c239cb12011528e95c2cd))
+$(eval $(call Package/$(PKG_NAME)/Sounds,zh-cn-sinmei-32000,Sound prompts,Speaker: Sinmei - Language: zh-CN - Sample Rate: 32kHz,1.0.51,903fda016d2ac053ffe6bc2d4eaf816a66c8043ddc3383d48b7b14335d9ea98e))
+$(eval $(call Package/$(PKG_NAME)/Sounds,zh-cn-sinmei-48000,Sound prompts,Speaker: Sinmei - Language: zh-CN - Sample Rate: 48kHz,1.0.51,95b9064acec13a0a32b15ea0b44dc408094b4d9dee84b183c5d9150a77e9bb23))
+$(eval $(call Package/$(PKG_NAME)/Sounds,zh-hk-sinmei-8000,Sound prompts,Speaker: Sinmei - Language: zh-HK - Sample Rate: 8kHz,1.0.51,917d08c80969bdaf30f2a63a3b69f542b143614d42c6241503ac655d13864eb0))
+$(eval $(call Package/$(PKG_NAME)/Sounds,zh-hk-sinmei-16000,Sound prompts,Speaker: Sinmei - Language: zh-HK - Sample Rate: 16kHz,1.0.51,0950e1d971b4f2ba4decd949406ccd0198fe9c686f246e175c70aafdf9783f30))
+$(eval $(call Package/$(PKG_NAME)/Sounds,zh-hk-sinmei-32000,Sound prompts,Speaker: Sinmei - Language: zh-HK - Sample Rate: 32kHz,1.0.51,97d846ab06b5c84d2c46bec64560556acbfc88eb2080bd325b2c5259a5ae80d0))
+$(eval $(call Package/$(PKG_NAME)/Sounds,zh-hk-sinmei-48000,Sound prompts,Speaker: Sinmei - Language: zh-HK - Sample Rate: 48kHz,1.0.51,bd605be7e536e11f8f67229a95513ef3f177263587c5bca75ccae647f43962a1))
--- /dev/null
+menu "Advanced configuration"
+ depends on PACKAGE_freeswitch-stable
+
+config FS_STABLE_WITH_DEBUG
+ bool "Compile with debug information"
+ default n
+ help
+ Enable extra debug codepaths, like asserts and extra output. If you
+ want to get meaningful backtraces see
+ https://wiki.openwrt.org/doc/devel/debugging for starting points.
+
+config FS_STABLE_WITH_LIBEDIT
+ bool "Compile with libedit support"
+ default y
+ help
+ Compile with libedit support to enable command-line history editing
+ and curses functionality. Of course this feels nicer when interacting
+ with FreeSWITCH (without it it doesn't feel very interactive at all),
+ but it adds additional dependencies (libedit, libncursesw, terminfo).
+
+config FS_STABLE_WITH_ODBC
+ bool "Compile with ODBC support"
+ default n
+ help
+ Enable ODBC support.
+
+config FS_STABLE_WITH_PGSQL
+ bool "Compile with PGSQL support"
+ default n
+ help
+ Enable PostgreSQL support.
+
+config FS_STABLE_WITH_SRTP
+ bool "Enable SRTP"
+ default y
+ help
+ Compile with SRTP support.
+
+config FS_STABLE_WITH_ZRTP
+ bool "Enable ZRTP"
+ default n
+ help
+ Compile with ZRTP support.
+
+endmenu
--- /dev/null
+#
+# Copyright (C) 2017 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+# TODO
+#
+# - try to use system xmlrpc-c once it compiles again :-)
+# - include fs_ivrd?
+
+# NOTES
+#
+# - --disable-cpp sounds like we could get rid of the dep on libstdcpp, but it
+# only results in switch_cpp.cpp not being compiled and there is other stuff
+# that depends on libstdcpp.
+# - I have patched configure.ac to be able to say no to libpng and freetype. If
+# there are errors in the future due to missing depends we'll need to poke
+# around some more.
+
+include $(TOPDIR)/rules.mk
+
+PRG_NAME:=freeswitch
+PKG_NAME:=$(PRG_NAME)-stable
+PKG_VERSION:=1.6.15
+PKG_RELEASE:=1
+PKG_MAINTAINER:=Sebastian Kemper <sebastian_ml@gmx.net>
+
+PKG_SOURCE:=$(PRG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=https://files.$(PRG_NAME).org/releases/$(PRG_NAME)
+PKG_MD5SUM:=95b38c07de200a43cd6963d21e0882ab8a7087473ea82ece68d76b9fa78ca27c
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PRG_NAME)-$(PKG_VERSION)
+
+# configure fails without libjpeg, but it's only needed for mod_spandsp
+PKG_BUILD_DEPENDS:=libjpeg
+
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+PKG_LICENSE:= \
+ AGPL-3.0 \
+ Apache-2.0 \
+ BSD-2-Clause \
+ BSD-3-Clause \
+ BSD-4-Clause \
+ BSD-like \
+ Beerware \
+ GPL-1.0+ \
+ GPL-2.0 \
+ GPL-2.0+ \
+ GPL-3.0 \
+ ISC \
+ LGPL-2.0+ \
+ LGPL-2.1 \
+ LGPL-2.1+ \
+ MIT/X11 (BSD like) \
+ MPL-1.1 \
+ OpenLDAP \
+ RSA-MD \
+ zlib-acknowledgement
+
+PKG_LICENSE_FILES:=debian/copyright
+
+FS_STABLE_DEPS_BASE:= \
+ +FS_STABLE_WITH_PGSQL:libpq \
+ +libopenssl \
+ +libuuid
+
+FS_STABLE_DEPS:= \
+ $(FS_STABLE_DEPS_BASE) \
+ +FS_STABLE_WITH_LIBEDIT:libedit \
+ +FS_STABLE_WITH_ODBC:unixodbc \
+ +libcurl \
+ +libpcre \
+ +libpthread \
+ +librt \
+ +libspeex \
+ +libspeexdsp \
+ +libstdcpp \
+ +libsqlite3 \
+ +zlib
+
+FS_STABLE_MOD_AVAILABLE:= \
+ abstraction \
+ alsa \
+ avmd \
+ blacklist \
+ callcenter \
+ cdr_csv \
+ cdr_sqlite \
+ cidlookup \
+ commands \
+ conference \
+ console \
+ curl \
+ db \
+ dialplan_asterisk \
+ dialplan_xml \
+ dingaling \
+ directory \
+ distributor \
+ dptools \
+ easyroute \
+ enum \
+ esf \
+ esl \
+ event_multicast \
+ event_socket \
+ expr \
+ fifo \
+ format_cdr \
+ fsk \
+ g723_1 \
+ g729 \
+ hash \
+ hiredis \
+ httapi \
+ http_cache \
+ json_cdr \
+ lcr \
+ local_stream \
+ logfile \
+ loopback \
+ lua \
+ native_file \
+ odbc_cdr \
+ redis \
+ rtc \
+ rtmp \
+ say_de \
+ say_en \
+ say_es \
+ say_es_ar \
+ say_fa \
+ say_fr \
+ say_he \
+ say_hr \
+ say_hu \
+ say_it \
+ say_ja \
+ say_nl \
+ say_pl \
+ say_pt \
+ say_ru \
+ say_sv \
+ say_th \
+ say_zh \
+ sndfile \
+ snom \
+ sofia \
+ spandsp \
+ spy \
+ syslog \
+ tone_stream \
+ translate \
+ valet_parking \
+ verto \
+ voicemail \
+ xml_cdr \
+ xml_rpc \
+ xml_scgi
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/$(PKG_NAME)/install/bin
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $(1)/usr/bin
+endef
+
+define Package/$(PKG_NAME)/install/dir
+ for dir in $$$$(shell cd $(2); find -type d -print | sed 's|^./\?||'); \
+ do \
+ $(INSTALL_DIR) $(1)/$$$$$$$$dir; \
+ done
+ for file in $$$$(shell cd $(2); find -type f -print | sed 's|^./||'); \
+ do \
+ $(INSTALL_DATA) $(2)/$$$$$$$$file $(1)/$$$$$$$$file; \
+ done
+endef
+
+define Package/$(PKG_NAME)/install/lib
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/$(2).so* $(1)/usr/lib
+endef
+
+define Package/$(PKG_NAME)/install/mod
+ $(INSTALL_DIR) $(1)/usr/lib/$(PRG_NAME)/mod
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/$(PRG_NAME)/mod/mod_$(2).so \
+ $(1)/usr/lib/$(PRG_NAME)/mod
+endef
+
+define Package/$(PKG_NAME)/config
+ source "$(SOURCE)/Config.in"
+endef
+
+define Package/$(PKG_NAME)/Default
+ SUBMENU:=Telephony
+ SECTION:=net
+ CATEGORY:=Network
+ URL:=https://www.$(PRG_NAME).org
+endef
+
+define Package/$(PKG_NAME)
+$(call Package/$(PKG_NAME)/Default)
+ TITLE:=Open source telephony platform, v$(PKG_VERSION)
+ MENU:=1
+ USERID:=$(PRG_NAME)=372:$(PRG_NAME)=372
+ DEPENDS:=$(FS_STABLE_DEPS)
+ CONFLICTS:=$(PRG_NAME)
+endef
+
+define Package/$(PKG_NAME)/description
+FreeSWITCH is a scalable open source cross-platform telephony platform
+designed to route and interconnect popular communication protocols
+using audio, video, text or any other form of media.
+endef
+
+define Package/$(PKG_NAME)/conffiles
+/etc/$(PRG_NAME)
+/etc/default/$(PRG_NAME)
+/etc/init.d/$(PRG_NAME)
+endef
+
+define Package/$(PKG_NAME)/install
+$(call Package/$(PKG_NAME)/install/bin,$(1),$(PRG_NAME))
+$(call Package/$(PKG_NAME)/install/lib,$(1),lib$(PRG_NAME))
+ $(INSTALL_DIR) $(1)/etc/$(PRG_NAME)/tls
+ $(INSTALL_DIR) $(1)/usr/share/$(PRG_NAME)/fonts
+ $(INSTALL_DIR) $(1)/usr/share/$(PRG_NAME)/grammar
+ $(INSTALL_DIR) $(1)/usr/share/$(PRG_NAME)/htdocs
+ $(INSTALL_DIR) $(1)/usr/share/$(PRG_NAME)/images
+ $(INSTALL_DIR) $(1)/usr/share/$(PRG_NAME)/scripts
+ $(INSTALL_DIR) $(1)/usr/share/$(PRG_NAME)/sounds
+ $(INSTALL_DIR) $(1)/etc/default
+ $(INSTALL_CONF) ./files/$(PRG_NAME).default $(1)/etc/default/$(PRG_NAME)
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) ./files/$(PRG_NAME).init $(1)/etc/init.d/$(PRG_NAME)
+ifeq ($(CONFIG_FS_STABLE_WITH_LIBEDIT),)
+ $(SED) '/^ #procd_append_param command -nc -nf$$$$/s/#//' \
+ $(1)/etc/init.d/$(PRG_NAME)
+endif
+endef
+
+define Package/$(PKG_NAME)/postinst
+#!/bin/sh
+if [ -z "$${IPKG_INSTROOT}" ]; then
+ # Prevent autostart of $(PRG_NAME)
+ touch /etc/$(PRG_NAME)_disabled
+
+ echo
+ echo "o-------------------------------------------------------------------o"
+ echo "| FreeSWITCH note |"
+ echo "o-------------------------------------------------------------------o"
+ echo "| Edit /etc/default/freeswitch to change basic init configuration. |"
+ echo "o-------------------------------------------------------------=^_^=-o"
+ echo
+fi
+exit 0
+endef
+
+define Package/$(PKG_NAME)-hotplug
+$(call Package/$(PKG_NAME)/Default)
+ TITLE:=Hotplug script
+ DEPENDS:=$(PKG_NAME)
+ PKGARCH:=all
+endef
+
+define Package/$(PKG_NAME)-hotplug/description
+This package includes a hotplug script for FreeSWITCH.
+endef
+
+define Package/$(PKG_NAME)-hotplug/install
+ $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+ $(INSTALL_BIN) ./files/$(PRG_NAME).hotplug \
+ $(1)/etc/hotplug.d/iface/99-$(PRG_NAME)
+endef
+
+define Package/$(PKG_NAME)-hotplug/postinst
+#!/bin/sh
+if [ -z "$${IPKG_INSTROOT}" ]; then
+ echo
+ echo "o-------------------------------------------------------------------o"
+ echo "| FreeSWITCH hotplug note |"
+ echo "o-------------------------------------------------------------------o"
+ echo "| See /etc/default/freeswitch for hotplug hints. |"
+ echo "o-------------------------------------------------------------=^_^=-o"
+ echo
+fi
+exit 0
+endef
+
+define Package/$(PKG_NAME)-timezones
+$(call Package/$(PKG_NAME)/Default)
+ TITLE:=Timezones file
+ DEPENDS:=$(PKG_NAME)
+ PKGARCH:=all
+endef
+
+define Package/$(PKG_NAME)-timezones/description
+This package includes a timezones file for FreeSWITCH.
+endef
+
+define Package/$(PKG_NAME)-timezones/install
+ $(INSTALL_DIR) $(1)/usr/share/$(PRG_NAME)/tz
+ $(INSTALL_DATA) \
+ $(PKG_BUILD_DIR)/conf/vanilla/autoload_configs/timezones.conf.xml \
+ $(1)/usr/share/$(PRG_NAME)/tz
+endef
+
+define Package/$(PKG_NAME)/Example
+define Package/$(PKG_NAME)-example-$(1)
+$(call Package/$(PKG_NAME)/Default)
+ TITLE:=Example configuration
+ DEPENDS:=$(PKG_NAME)
+ PKGARCH:=all
+endef
+define Package/$(PKG_NAME)-example-$(1)/description
+This package does not install any configuration for FreeSWITCH into
+/etc/freeswitch. The system administrator is completely responsible
+for that directory. If you install one of the example configuration
+packages, it will install the corresponding sample configuration to
+/usr/share/freeswitch/conf where you can take a look at it.
+endef
+define Package/$(PKG_NAME)-example-$(1)/install
+$(call Package/$(PKG_NAME)/install/dir,$$(1)/usr/share/$(PRG_NAME)/conf/$(1),$(PKG_BUILD_DIR)/conf/$(1))
+endef
+$$(eval $$(call BuildPackage,$(PKG_NAME)-example-$(1)))
+endef
+
+define Package/$(PKG_NAME)/Language
+define Package/$(PKG_NAME)-lang-$(1)
+$(call Package/$(PKG_NAME)/Default)
+ TITLE:=$(2) language files
+ DEPENDS:=$(PKG_NAME)
+ PKGARCH:=all
+endef
+define Package/$(PKG_NAME)-lang-$(1)/description
+This package includes the $(2) language files for FreeSWITCH.
+endef
+define Package/$(PKG_NAME)-lang-$(1)/install
+$(call Package/$(PKG_NAME)/install/dir,$$(1)/usr/share/$(PRG_NAME)/lang/$(1),$(PKG_BUILD_DIR)/conf/vanilla/lang/$(1))
+endef
+$$(eval $$(call BuildPackage,$(PKG_NAME)-lang-$(1)))
+endef
+
+define Package/$(PKG_NAME)/Module
+define Package/$(PKG_NAME)-mod-$(1)
+$(call Package/$(PKG_NAME)/Default)
+ TITLE:=$(2) module
+ DEPENDS:=$(PKG_NAME) $(4)
+endef
+define Package/$(PKG_NAME)-mod-$(1)/description
+$(subst \n,$(newline),$(3))
+endef
+define Package/$(PKG_NAME)-mod-$(1)/install
+$(call Package/$(PKG_NAME)/install/mod,$$(1),$(1))
+endef
+$$(eval $$(call BuildPackage,$(PKG_NAME)-mod-$(1)))
+endef
+
+define Package/$(PKG_NAME)/Util
+define Package/$(PKG_NAME)-util-$(1)
+$(call Package/$(PKG_NAME)/Default)
+ TITLE:=$(2) utility
+ DEPENDS:=$(PKG_NAME) $(4)
+ ifeq ($(5),y)
+ PKGARCH:=all
+ endif
+endef
+define Package/$(PKG_NAME)-util-$(1)/description
+$(subst \n,$(newline),$(3))
+endef
+define Package/$(PKG_NAME)-util-$(1)/install
+$(call Package/$(PKG_NAME)/install/bin,$$(1),$(1))
+endef
+ifeq ($(1)$(CONFIG_FS_STABLE_WITH_LIBEDIT),fs_cli)
+define Package/$(PKG_NAME)-util-$(1)/postinst
+#!/bin/sh
+if [ -z "$${IPKG_INSTROOT}" ]; then
+ echo
+ echo "o-------------------------------------------------------------------o"
+ echo "| fs_cli note |"
+ echo "o-------------------------------------------------------------------o"
+ echo "| Your FreeSWITCH was compiled without libedit support. Due to an |"
+ echo "| interop issue it's possible that when you try to exit fs_cli with |"
+ echo "| Ctrl-D, you'll see messages flashing by and have to kill fs_cli |"
+ echo "| manually. To avoid this you can either use Ctrl-C instead (fs_cli |"
+ echo "| needs to be started with '-i' for this to work; you could create |"
+ echo "| an appropriate alias in /etc/profile) or type /exit, /quit or |"
+ echo "| /bye. |"
+ echo "o-------------------------------------------------------------=^_^=-o"
+ echo
+fi
+exit 0
+endef
+endif
+$$(eval $$(call BuildPackage,$(PKG_NAME)-util-$(1)))
+endef
+
+# we neither need host-perl nor host-php
+CONFIGURE_VARS+= \
+ ac_cv_prog_PERL=false \
+ ac_cv_have_perl=no \
+ ac_cv_prog_PHP=false \
+ ac_cv_have_php=no \
+ ac_cv_prog_PHP_CONFIG=false \
+ ac_cv_have_php_config=no
+
+# The autoconf variables in this block are OK for both musl and glibc
+CONFIGURE_VARS+= \
+ ac_cv_file__dev_ptmx=yes \
+ ac_cv_file__dev_urandom=yes \
+ ac_cv_file_dbd_apr_dbd_mysql_c=no \
+ ac_cv_free_null=yes \
+ ac_cv_func_mmap_fixed_mapped=yes \
+ ac_cv_func_pthread_rwlock_init=yes \
+ ac_cv_func_sem_open=yes \
+ ac_cv_have_working_memmove=yes \
+ ac_cv_negative_eai=yes \
+ ac_cv_o_nonblock_inherited=no \
+ ac_cv_struct_rlimit=yes \
+ apr_cv_epoll=yes \
+ apr_cv_gai_addrconfig=yes \
+ apr_cv_mutex_recursive=yes \
+ apr_cv_process_shared_works=yes \
+ apr_cv_pthreads_lib=-lpthread \
+ apr_cv_tcp_nodelay_with_cork=yes \
+ apr_cv_type_rwlock_t=yes
+
+# Regarding apr_cv_mutex_robust_shared=no see
+# http://www.openwall.com/lists/musl/2016/11/26/1
+# _Don't_ remove quotes below!
+ifeq ($(CONFIG_LIBC),"musl")
+CONFIGURE_VARS+= \
+ apr_cv_mutex_robust_shared=no \
+ ac_cv_strerror_r_rc_int=yes
+else
+CONFIGURE_VARS+= \
+ apr_cv_mutex_robust_shared=yes
+endif
+
+# fs_cli
+CONFIGURE_VARS+= \
+ disable_cc=yes
+
+CONFIGURE_ARGS+= \
+ --build=$(GNU_HOST_NAME) \
+ --host=$(GNU_TARGET_NAME) \
+ --target=$(GNU_TARGET_NAME) \
+ --prefix=/usr/share/$(PRG_NAME) \
+ --bindir=/usr/bin \
+ --libdir=/usr/lib \
+ --srcdir=$(PKG_BUILD_DIR) \
+ --sysconfdir=/etc \
+ --disable-dependency-tracking \
+ --disable-libvpx \
+ --disable-libyuv \
+ --disable-static \
+ --disable-system-xmlrpc-c \
+ --enable-fhs \
+ --with-cachedir=/tmp/$(PRG_NAME)/cache \
+ --with-certsdir=/etc/$(PRG_NAME)/tls \
+ --with-dbdir=/tmp/$(PRG_NAME)/db \
+ --with-fontsdir=/usr/share/$(PRG_NAME)/fonts \
+ --with-grammardir=/usr/share/$(PRG_NAME)/grammar \
+ --with-htdocsdir=/usr/share/$(PRG_NAME)/htdocs \
+ --with-imagesdir=/usr/share/$(PRG_NAME)/images \
+ --with-logfiledir=/tmp/$(PRG_NAME)/log \
+ --with-modinstdir=/usr/lib/$(PRG_NAME)/mod \
+ --with-recordingsdir=/tmp/$(PRG_NAME)/recordings \
+ --with-rundir=/var/run/$(PRG_NAME) \
+ --with-scriptdir=/usr/share/$(PRG_NAME)/scripts \
+ --with-soundsdir=/usr/share/$(PRG_NAME)/sounds \
+ --with-storagedir=/tmp/$(PRG_NAME)/storage \
+ --without-erlang \
+ --without-freetype \
+ --without-png \
+ --without-python \
+ $(call autoconf_bool,CONFIG_FS_STABLE_WITH_LIBEDIT,core-libedit-support) \
+ $(call autoconf_bool,CONFIG_FS_STABLE_WITH_ODBC,core-odbc-support) \
+ $(call autoconf_bool,CONFIG_FS_STABLE_WITH_SRTP,srtp) \
+ $(call autoconf_bool,CONFIG_FS_STABLE_WITH_ZRTP,zrtp) \
+ $(if $(CONFIG_FS_STABLE_WITH_DEBUG),,--disable-debug) \
+ $(if $(CONFIG_FS_STABLE_WITH_ODBC),--with-odbc-lib="$(STAGING_DIR)/usr/lib") \
+ $(if $(CONFIG_FS_STABLE_WITH_ODBC),--with-odbc="$(STAGING_DIR)/usr") \
+ $(if $(CONFIG_FS_STABLE_WITH_PGSQL),--enable-core-pgsql-support,--without-pgsql)
+
+define Build/Prepare
+ $(call Build/Prepare/Default)
+ $(SED) '/^#/!s/^/#/' $(PKG_BUILD_DIR)/modules.conf
+ $(foreach m,$(FS_STABLE_MOD_AVAILABLE),
+ $(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-$(m)),
+ $(SED) '/mod_$(m)/s/^#//' $(PKG_BUILD_DIR)/modules.conf))
+endef
+
+define Build/Configure
+ find $(PKG_BUILD_DIR) -name missing -type f -exec rm {} \;
+ cd $(PKG_BUILD_DIR); $(AM_TOOL_PATHS) ./rebootstrap.sh
+ $(call Build/Configure/Default)
+endef
+
+$(eval $(call BuildPackage,$(PKG_NAME)))
+$(eval $(call BuildPackage,$(PKG_NAME)-hotplug))
+$(eval $(call BuildPackage,$(PKG_NAME)-timezones))
+
+################################
+# FreeSWITCH example configs
+# Params:
+# 1 - Package subname
+################################
+
+$(eval $(call Package/$(PKG_NAME)/Example,curl))
+$(eval $(call Package/$(PKG_NAME)/Example,insideout))
+$(eval $(call Package/$(PKG_NAME)/Example,minimal))
+$(eval $(call Package/$(PKG_NAME)/Example,rayo))
+$(eval $(call Package/$(PKG_NAME)/Example,sbc))
+$(eval $(call Package/$(PKG_NAME)/Example,softphone))
+$(eval $(call Package/$(PKG_NAME)/Example,testing))
+$(eval $(call Package/$(PKG_NAME)/Example,vanilla))
+
+################################
+# FreeSWITCH language files
+# Params:
+# 1 - Language code
+# 2 - Language
+################################
+
+$(eval $(call Package/$(PKG_NAME)/Language,de,German))
+$(eval $(call Package/$(PKG_NAME)/Language,en,English))
+$(eval $(call Package/$(PKG_NAME)/Language,es,Spanish))
+$(eval $(call Package/$(PKG_NAME)/Language,fr,French))
+$(eval $(call Package/$(PKG_NAME)/Language,he,Hebrew))
+$(eval $(call Package/$(PKG_NAME)/Language,pt,Portuguese))
+$(eval $(call Package/$(PKG_NAME)/Language,ru,Russian))
+$(eval $(call Package/$(PKG_NAME)/Language,sv,Swedish))
+
+################################
+# FreeSWITCH modules
+# Params:
+# 1 - Package subname
+# 2 - Package title
+# 3 - Module description
+# 4 - Module dependencies
+################################
+
+$(eval $(call Package/$(PKG_NAME)/Module,abstraction,API abstraction,This module provides a way to create new API functions via regex\nrewriting.,))
+$(eval $(call Package/$(PKG_NAME)/Module,alsa,ALSA endpoint,ALSA endpoint module.,+alsa-lib))
+$(eval $(call Package/$(PKG_NAME)/Module,avmd,Voicemail detection,This module attempts to determine when a voicemail system has answered\nthe call.,))
+$(eval $(call Package/$(PKG_NAME)/Module,blacklist,Blacklist helper,This module provides tools to blacklist callers.,))
+$(eval $(call Package/$(PKG_NAME)/Module,callcenter,Call center,This module implements Automated Call Distribution queues.,))
+$(eval $(call Package/$(PKG_NAME)/Module,cdr_csv,CSV CDR,CSV Call Detail Record handler.,))
+$(eval $(call Package/$(PKG_NAME)/Module,cdr_sqlite,SQLite CDR,SQLite Call Detail Record handler.,))
+$(eval $(call Package/$(PKG_NAME)/Module,cidlookup,Caller ID lookup,This module provides an API for querying caller ID name and location\ndata.,))
+$(eval $(call Package/$(PKG_NAME)/Module,commands,Commands,This module provides miscellaneous API commands.,))
+$(eval $(call Package/$(PKG_NAME)/Module,conference,Conference,This module provides multi-party conferencing.,))
+$(eval $(call Package/$(PKG_NAME)/Module,console,Console logger,Allows control over what messages get logged to the console. When\nFreeSWITCH is compiled without libedit support - this is not the\ndefault - mod_console has no effect because the init script starts\nFreeSWITCH with the console disabled to work around an\ninteroperability issue that causes high CPU load.,))
+$(eval $(call Package/$(PKG_NAME)/Module,curl,cURL,This module provides an API for making HTTP requests with cURL.,))
+$(eval $(call Package/$(PKG_NAME)/Module,db,DB,This module implements a simple db API with group support. Also can be\nused as a limit db backend.,+libdb47))
+$(eval $(call Package/$(PKG_NAME)/Module,dialplan_asterisk,Asterisk dialplan,Asterisk extensions.conf style dialplan parser.,))
+$(eval $(call Package/$(PKG_NAME)/Module,dialplan_xml,XML dialplan,Standard FreeSWITCH XML dialplan support.,))
+$(eval $(call Package/$(PKG_NAME)/Module,dingaling,Generic XMPP,Allows FreeSWITCH to be used as a client for XMPP Servers.,))
+$(eval $(call Package/$(PKG_NAME)/Module,directory,Dial-by-name directory,This module implements a dial-by-name directory IVR.,))
+$(eval $(call Package/$(PKG_NAME)/Module,distributor,Load distributor,This module implements a mechanism for performing load balancing.,))
+$(eval $(call Package/$(PKG_NAME)/Module,dptools,Dialplan tools,This module implements basic dialplan tools.,))
+$(eval $(call Package/$(PKG_NAME)/Module,easyroute,DID routing,This module does destination lookup based on DID.,))
+$(eval $(call Package/$(PKG_NAME)/Module,enum,ENUM routing,This module implements ENUM support.,+libldns))
+$(eval $(call Package/$(PKG_NAME)/Module,esf,Multicast,This module adds multi-cast support.,))
+$(eval $(call Package/$(PKG_NAME)/Module,esl,Single ESL,This module adds an API for generating one-off ESL requests.,))
+$(eval $(call Package/$(PKG_NAME)/Module,event_multicast,Multicast Event,Multicast Event System for FreeSWITCH.,))
+$(eval $(call Package/$(PKG_NAME)/Module,event_socket,Event socket,Sends events via a single socket. Needed for fs_cli.,))
+$(eval $(call Package/$(PKG_NAME)/Module,expr,Expr,This module adds expr support for expression evaluation.,))
+$(eval $(call Package/$(PKG_NAME)/Module,fifo,FIFO,This module adds a first-in first-out queue system.,))
+$(eval $(call Package/$(PKG_NAME)/Module,format_cdr,Multiformat CDR,A superset of mod_json_cdr and mod_xml_cdr.,))
+$(eval $(call Package/$(PKG_NAME)/Module,fsk,FSK,This module adds frequency-shift keying support which can be used to\nsend and receive caller ID.,))
+$(eval $(call Package/$(PKG_NAME)/Module,g723_1,G.723.1 passthrough,G.723.1 codec passthrough.,))
+$(eval $(call Package/$(PKG_NAME)/Module,g729,G.729 passthrough,G.729 codec passthrough.,))
+$(eval $(call Package/$(PKG_NAME)/Module,hash,Hash,This module provides a key-value in-memory datastore. Usable as a\nlimit backend.,))
+$(eval $(call Package/$(PKG_NAME)/Module,hiredis,Redis client,This module provides a mechanism to use Redis as a datastore.,libhiredis))
+$(eval $(call Package/$(PKG_NAME)/Module,httapi,HT-TAPI,This module provides an API for controlling the switch by responding\nto HTTP requests.,))
+$(eval $(call Package/$(PKG_NAME)/Module,http_cache,HTTP GET with caching,This module provides an API for making HTTP GET requests where the\nresult is cached.,))
+$(eval $(call Package/$(PKG_NAME)/Module,json_cdr,JSON CDR,JSON-based Call Detail Record handler.,))
+$(eval $(call Package/$(PKG_NAME)/Module,lcr,LCR,This module adds a facility for least-cost routing.,))
+$(eval $(call Package/$(PKG_NAME)/Module,local_stream,Local stream,Connects multiple channels to a looped stream.,))
+$(eval $(call Package/$(PKG_NAME)/Module,logfile,File logger,Logs FreeSWITCH output to a file.,))
+$(eval $(call Package/$(PKG_NAME)/Module,loopback,Loopback,A loopback channel driver.,))
+$(eval $(call Package/$(PKG_NAME)/Module,lua,Lua,Lua language interface for FreeSWITCH.,+liblua))
+$(eval $(call Package/$(PKG_NAME)/Module,native_file,Native file,Plays files that are already encoded in the right format.,))
+$(eval $(call Package/$(PKG_NAME)/Module,odbc_cdr,ODBC CDR,ODBC Call Detail Record handler.,))
+$(eval $(call Package/$(PKG_NAME)/Module,redis,Redis limit backend,This module provides a mechanism to use Redis as a limit backend data\nstore.,))
+$(eval $(call Package/$(PKG_NAME)/Module,rtc,Media streaming,Media streaming as used by WebRTC and mod_verto.,))
+$(eval $(call Package/$(PKG_NAME)/Module,rtmp,RTMP endpoint,RTMP endpoint support. Allows FreeSWITCH to be used from RTMP clients.,))
+$(eval $(call Package/$(PKG_NAME)/Module,say_de,German Say,Uses prerecorded sounds to read or say various things.,))
+$(eval $(call Package/$(PKG_NAME)/Module,say_en,English Say,Uses prerecorded sounds to read or say various things.,))
+$(eval $(call Package/$(PKG_NAME)/Module,say_es,Spanish Say,Uses prerecorded sounds to read or say various things.,))
+$(eval $(call Package/$(PKG_NAME)/Module,say_es_ar,Argentinian Spanish Say,Uses prerecorded sounds to read or say various things.,))
+$(eval $(call Package/$(PKG_NAME)/Module,say_fa,Persian Say,Uses prerecorded sounds to read or say various things.,))
+$(eval $(call Package/$(PKG_NAME)/Module,say_fr,French Say,Uses prerecorded sounds to read or say various things.,))
+$(eval $(call Package/$(PKG_NAME)/Module,say_he,Hebrew Say,Uses prerecorded sounds to read or say various things.,))
+$(eval $(call Package/$(PKG_NAME)/Module,say_hr,Croatian Say,Uses prerecorded sounds to read or say various things.,))
+$(eval $(call Package/$(PKG_NAME)/Module,say_hu,Hungarian Say,Uses prerecorded sounds to read or say various things.,))
+$(eval $(call Package/$(PKG_NAME)/Module,say_it,Italian Say,Uses prerecorded sounds to read or say various things.,))
+$(eval $(call Package/$(PKG_NAME)/Module,say_ja,Japanese Say,Uses prerecorded sounds to read or say various things.,))
+$(eval $(call Package/$(PKG_NAME)/Module,say_nl,Dutch Say,Uses prerecorded sounds to read or say various things.,))
+$(eval $(call Package/$(PKG_NAME)/Module,say_pl,Polish Say,Uses prerecorded sounds to read or say various things.,))
+$(eval $(call Package/$(PKG_NAME)/Module,say_pt,Portuguese Say,Uses prerecorded sounds to read or say various things.,))
+$(eval $(call Package/$(PKG_NAME)/Module,say_ru,Russian Say,Uses prerecorded sounds to read or say various things.,))
+$(eval $(call Package/$(PKG_NAME)/Module,say_sv,Swedish Say,Uses prerecorded sounds to read or say various things.,))
+$(eval $(call Package/$(PKG_NAME)/Module,say_th,Thai Say,Uses prerecorded sounds to read or say various things.,))
+$(eval $(call Package/$(PKG_NAME)/Module,say_zh,Chinese Say,Uses prerecorded sounds to read or say various things.,))
+$(eval $(call Package/$(PKG_NAME)/Module,sndfile,Soundfile,Adds sound format support via libsndfile.,+libsndfile))
+$(eval $(call Package/$(PKG_NAME)/Module,snom,SNOM,This module implements features specific to SNOM phones.,))
+$(eval $(call Package/$(PKG_NAME)/Module,sofia,Sofia SIP,SIP module.,))
+$(eval $(call Package/$(PKG_NAME)/Module,spandsp,SpanDSP,This module implements SpanDSP fax. It includes DSP and codec\nfunctionality.,+libjpeg +liblzma))
+$(eval $(call Package/$(PKG_NAME)/Module,spy,User Spy,This module adds the ability to monitor the audio of a channel.,))
+$(eval $(call Package/$(PKG_NAME)/Module,syslog,Syslog logger,Logs FreeSWITCH output to the syslog.,))
+$(eval $(call Package/$(PKG_NAME)/Module,tone_stream,Tone stream,Tone generation stream.,))
+$(eval $(call Package/$(PKG_NAME)/Module,translate,Number translation,This module implements number translation.,))
+$(eval $(call Package/$(PKG_NAME)/Module,valet_parking,Valet parking,This module implements the valet call parking strategy.,))
+$(eval $(call Package/$(PKG_NAME)/Module,verto,Verto,Verto signaling protocol.,))
+$(eval $(call Package/$(PKG_NAME)/Module,voicemail,Voicemail,This module provides a voicemail system.,))
+$(eval $(call Package/$(PKG_NAME)/Module,xml_cdr,XML CDR,XML Call Detail Record handler.,))
+$(eval $(call Package/$(PKG_NAME)/Module,xml_rpc,XML RPC,Allows using the webapi to control FreeSWITCH.,))
+$(eval $(call Package/$(PKG_NAME)/Module,xml_scgi,XML SCGI,SCGI XML Gateway.,))
+
+################################
+# FreeSWITCH utilities
+# Params:
+# 1 - Package subname
+# 2 - Package title
+# 3 - Utility description
+# 4 - Utility dependencies
+# 5 - Utility is a script (y/n)
+################################
+
+$(eval $(call Package/$(PKG_NAME)/Util,fs_cli,CLI,The fs_cli program is a Command-Line Interface that allows a user to\nconnect to a FreeSWITCH instance running on the local or a remote\nsystem.,$(FS_STABLE_DEPS_BASE) +FS_STABLE_WITH_LIBEDIT:libedit,n))
+$(eval $(call Package/$(PKG_NAME)/Util,fs_encode,Sound file conversion,Format conversion of sound files so the result can be used by\nmod_native_file.,$(FS_STABLE_DEPS) +$(PKG_NAME)-mod-native_file +$(PKG_NAME)-mod-sndfile +$(PKG_NAME)-mod-spandsp,n))
+$(eval $(call Package/$(PKG_NAME)/Util,gentls_cert,TLS certificate,Can be used to create TLS certificates and setup CAs.,+openssl-util,y))
+$(eval $(call Package/$(PKG_NAME)/Util,tone2wav,Sound file generation,Generates a sound file from a teletone script. The output can be in\nany format that is supported by libsndfile.,$(FS_STABLE_DEPS) +$(PKG_NAME)-mod-sndfile,n))
--- /dev/null
+### FreeSWITCH configuration ###
+
+#FS_USER=freeswitch
+#FS_GROUP=freeswitch
+
+#FS_DIR_CACHE="/tmp/freeswitch/cache"
+
+# Don't point FS_DIR_DB toward a flash drive, e.g. the flash drive of your
+# router. FreeSWITCH will be writing constantly to its databases, which would
+# degrade the flash over time. Point it to a tmpfs destination like /dev/shm or
+# /tmp instead in order for the writes to go to RAM.
+#FS_DIR_DB="/tmp/freeswitch/db"
+
+#FS_DIR_LOG="/tmp/freeswitch/log"
+#FS_DIR_RECORDINGS="/tmp/freeswitch/recordings"
+#FS_DIR_STORAGE="/tmp/freeswitch/storage"
+#FS_DIR_TEMP="/tmp/freeswitch/temp"
+
+# The following is appended to the command line when starting FreeSWITCH:
+OPTIONS="-np -nonat"
+
+### Hotplug configuration ###
+
+# Only used by the FreeSWITCH hotplug script (available in a seperate package).
+
+# Provide the interface that needs to change its state to "up" (if unset the
+# hotplug script does nothing):
+#FS_HOTPLUG_INTERFACE="wan"
+
+# You can add conditions which need to be met before FreeSWITCH is started.
+
+# Uncomment to check if something is mounted here:
+#FS_HOTPLUG_MOUNTPOINT="/mnt/usb"
+
+# Uncomment to check if ntpd is running and has set the system time:
+#FS_HOTPLUG_NTPD="check"
+
+# Uncomment to change the default timeout of 60 seconds that the hotplug script
+# waits for a condition to turn from false to true:
+#FS_HOTPLUG_TIMEOUT="20"
--- /dev/null
+#!/bin/sh
+
+FS=freeswitch
+DEFAULT=/etc/default/$FS
+LOGGER="/usr/bin/logger -t ${FS}-hotplug"
+LOG_ERR="$LOGGER -p user.err --"
+LOG_NOTICE="$LOGGER -p user.notice --"
+LOG_WARN="$LOGGER -p user.warn --"
+
+[ "$ACTION" = ifup ] || exit 0
+
+[ -f $DEFAULT ] && . $DEFAULT
+
+[ -n "$FS_HOTPLUG_INTERFACE" ] || exit 0
+
+[ "$INTERFACE" = "$FS_HOTPLUG_INTERFACE" ] || exit 0
+
+pgrep $FS &> /dev/null
+if [ $? -eq 0 ]; then
+ $LOG_NOTICE Stopping $FS
+ /etc/init.d/$FS stop &> /dev/null
+ pgrep $FS &> /dev/null
+ if [ $? -eq 0 ]; then
+ $LOG_ERR Failed to stop $FS
+ exit 1
+ else
+ $LOG_NOTICE $FS stopped
+ fi
+fi
+
+[ "$FS_HOTPLUG_TIMEOUT" -gt 0 ] 2> /dev/null || unset FS_HOTPLUG_TIMEOUT
+TIMEOUT="${FS_HOTPLUG_TIMEOUT:-60}"
+
+# Mount condition, idea lifted from OpenWrt wiki
+[ -n "$FS_HOTPLUG_MOUNTPOINT" ] && {
+
+ if ! [ -d "$FS_HOTPLUG_MOUNTPOINT" ]; then
+ $LOG_ERR "$FS_HOTPLUG_MOUNTPOINT" not a valid mount point
+ exit 1
+ fi
+
+ mnt="$FS_HOTPLUG_MOUNTPOINT"
+ notReady=start
+ timeout=$TIMEOUT
+
+ while [ -n "$notReady" -a $timeout -gt 0 ]; do
+ if [ "$notReady" != start ]; then
+ $LOG_NOTICE "$mnt" not yet mounted, timeout in $timeout s
+ sleep 5
+ timeout=$(($timeout-5))
+ fi
+
+ notReady=
+
+ result=$(cat /proc/mounts | awk '{print $2}' | grep "^$mnt\$")
+ if [ -z "$result" ]; then
+ notReady="$mnt not ready yet"
+ fi
+ done
+
+ if [ -n "$notReady" ]; then
+ $LOG_ERR "$mnt" still not mounted
+ $LOG_ERR Not starting $FS
+ exit 1
+ else
+ $LOG_NOTICE "$mnt" mounted
+ fi
+
+}
+
+# ntpd condition
+[ -n "$FS_HOTPLUG_NTPD" ] && {
+
+ type ntpq &> /dev/null
+ [ $? -eq 0 ] || {
+ $LOG_ERR ntpq utility not found
+ exit 1
+ }
+
+ pgrep ntpd &> /dev/null || {
+ $LOG_ERR ntpd not running
+ exit 1
+ }
+
+ notReady=start
+ timeout=$TIMEOUT
+
+ result=$(uci get 'system.ntp.enabled' 2> /dev/null)
+ [ "$result" -eq 1 ] 2> /dev/null && {
+ $LOG_WARN BusyBox NTP client _and_ ntpd running
+ }
+
+ while [ -n "$notReady" -a $timeout -gt 0 ]; do
+ if [ "$notReady" != start ]; then
+ $LOG_NOTICE System time not in sync yet, timeout in $timeout s
+ sleep 5
+ timeout=$(($timeout-5))
+ fi
+
+ notReady=
+
+ result=$(ntpq -c 'timeout 300' -c 'rv 0 stratum' 2> /dev/null | \
+ awk -F '=' '{print $2}' | grep -o -E '^[0-9]+')
+ if [ -z $result ]; then
+ $LOG_WARN Failed to extract stratum from ntpd
+ notReady="unable to extract stratum"
+ else
+ $LOG_NOTICE ntpd stratum $result
+ if [ $result -lt 16 ] 2> /dev/null; then
+ result=$(ntpq -c 'timeout 300' -c 'rv 0 offset' 2> /dev/null \
+ | awk -F '=' '{print $2}' | grep -o -E '^-?[0-9]+')
+ if [ -z $result ]; then
+ $LOG_WARN Failed to extract offset from ntpd
+ notReady="unable to extract offset"
+ else
+ # "-0" looks stupid, so remove "-"
+ result=$(echo $result | grep -o '[0-9]*')
+ $LOG_NOTICE ntpd to system time offset \+\/\- $result ms
+ # If offset < 100 ms consider system time in sync
+ [ $result -lt 100 ] || notReady="system time not in sync yet"
+ fi
+ else
+ notReady="ntpd not in sync yet"
+ fi
+ fi
+ done
+
+ if [ -n "$notReady" ]; then
+ $LOG_ERR System time still not in sync
+ $LOG_ERR Not starting $FS
+ exit 1
+ else
+ $LOG_NOTICE System time in sync
+ fi
+
+}
+
+/etc/init.d/$FS start &> /dev/null
+# Wait a bit in order for pgrep to be able to find the new process
+sleep 1
+pgrep $FS &>/dev/null
+if [ $? -eq 0 ]; then
+ $LOG_NOTICE Started $FS due to \"ifup "$INTERFACE"\" event
+else
+ $LOG_ERR Start of $FS due to \"ifup "$INTERFACE"\" event failed
+ exit 1
+fi
--- /dev/null
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2017 OpenWrt.org
+
+START=90
+
+USE_PROCD=1
+
+#PROCD_DEBUG=1
+
+FS=freeswitch
+DEFAULT=/etc/default/$FS
+LOGGER="/usr/bin/logger -p user.err -s -t $FS"
+OPTIONS=
+TIMEOUT=30
+
+[ -f $DEFAULT ] && . $DEFAULT
+
+fs_user="${FS_USER:-$FS}"
+fs_group="${FS_GROUP:-$FS}"
+
+fs_dir_etc="/etc/$FS"
+fs_dir_localstate="/var/lib/$FS"
+fs_dir_run="/var/run/$FS"
+
+fs_dir_cache="${FS_DIR_CACHE:-/tmp/$FS/cache}"
+fs_dir_db="${FS_DIR_DB:-/tmp/$FS/db}"
+fs_dir_log="${FS_DIR_LOG:-/tmp/$FS/log}"
+fs_dir_recordings="${FS_DIR_RECORDINGS:-/tmp/$FS/recordings}"
+fs_dir_storage="${FS_DIR_STORAGE:-/tmp/$FS/storage}"
+fs_dir_temp="${FS_DIR_TEMP:-/tmp/$FS/temp}"
+
+start_service() {
+ local dir=
+
+ if [ -f "/etc/${FS}_disabled" ]; then
+ $LOGGER File \"/etc/${FS}_disabled\" exists
+ $LOGGER Remove it once your configuration is set up
+ exit 1
+ fi
+
+ for dir in "$fs_dir_cache" "$fs_dir_db" "$fs_dir_localstate" \
+ "$fs_dir_log" "$fs_dir_recordings" "$fs_dir_run" "$fs_dir_storage" \
+ "$fs_dir_temp"
+ do
+ [ -n "$dir" ] && {
+ mkdir -p "$dir"
+ chown "$fs_user":"$fs_group" "$dir"
+ chmod 750 "$dir"
+ }
+ done
+
+ #[ -d "$fs_dir_etc" ] && {
+ # find "$fs_dir_etc" -type f -exec chown root:"$fs_group" {} \;
+ # find "$fs_dir_etc" -type f -exec chmod 640 {} \;
+ #}
+
+ procd_open_instance
+ # starting with full path seems cleaner judging by 'ps' output
+ procd_set_param command /usr/bin/$FS
+ # need to specify all or none of -conf, -log, and -db
+ procd_append_param command -cache "$fs_dir_cache" -conf \
+ "$fs_dir_etc" -db "$fs_dir_db" -log "$fs_dir_log" -recordings \
+ "$fs_dir_recordings" -run "$fs_dir_run" -storage "$fs_dir_storage" \
+ -temp "$fs_dir_temp"
+ procd_append_param command -c
+ # -nc -nf: workaround for interop issue (which causes high load)
+ #procd_append_param command -nc -nf
+ procd_append_param command $OPTIONS
+ procd_set_param user "$fs_user"
+ # forward stdout of the command to logd
+ #procd_set_param stdout 1
+ # same for stderr
+ procd_set_param stderr 1
+ procd_close_instance
+}
+
+stop_service() {
+ local retval=
+ local mypid=
+ local timeout=$TIMEOUT
+
+ pgrep $FS &> /dev/null
+ [ $? -ne 0 ] && exit 0
+
+ [ -f "$fs_dir_run"/${FS}.pid ]
+ retval=$?
+
+ # init script could find itself in a scenario where FS was started
+ # very recently, so make it wait a while for a pid file to appear
+ while [ $retval -ne 0 -a $timeout -gt 0 ]; do
+ sleep 1
+ [ -f "$fs_dir_run"/${FS}.pid ]
+ retval=$?
+ timeout=$(($timeout-1))
+ done
+
+ [ $retval -eq 0 ] || {
+ $LOGGER PID file does not exist
+ exit 1
+ }
+
+ mypid=$(cat "$fs_dir_run"/${FS}.pid)
+
+ [ "$mypid" -gt 1 ] 2> /dev/null || {
+ $LOGGER PID file contains garbage
+ exit 1
+ }
+
+ timeout=$TIMEOUT
+ kill $mypid
+ pgrep $FS | grep -w $mypid &>/dev/null
+ retval=$?
+
+ while [ $retval -eq 0 -a $timeout -gt 0 ]; do
+ sleep 10
+ pgrep $FS | grep -w $mypid &>/dev/null
+ retval=$?
+ [ $retval -eq 0 ] && kill $mypid 2>/dev/null
+ timeout=$(($timeout-10))
+ done
+
+ [ $retval -ne 1 ] && {
+ $LOGGER Failed to stop $FS
+ exit 1
+ }
+}
--- /dev/null
+--- a/libs/libzrtp/configure.ac
++++ b/libs/libzrtp/configure.ac
+@@ -34,7 +34,7 @@ esac
+ AM_INIT_AUTOMAKE
+ AX_PREFIX_CONFIG_H(include/zrtp_config_unix.h,ZRTP,config/config.h)
+
+-CFLAGS="$CFLAGS -std=c99 -O2 -g3 -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -fPIC -DZRTP_AUTOMAKE=1"
++CFLAGS="$CFLAGS -std=c99 -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -fPIC -DZRTP_AUTOMAKE=1"
+
+ # Configuring external libraries
+ echo "========================= configuring bnlib =============================="
--- /dev/null
+--- a/configure.ac
++++ b/configure.ac
+@@ -256,30 +256,6 @@ AX_COMPILER_VENDOR
+ # Set CC_FOR_BUILD
+ if test "x${cross_compiling}" = "xyes"; then
+ CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
+- case "$host" in
+- arm*-linux-gnueabi*|arm*-*-linux-gnueabi*)
+- # spandsp modem
+- ac_cv_file__dev_ptmx=yes
+- # libjs
+- export ac_cv_va_copy=yes
+- # srtp
+- export ac_cv_file__dev_urandom=yes
+- # rpl_malloc
+- export ac_cv_func_realloc_0_nonnull=yes
+- export ac_cv_func_malloc_0_nonnull=yes
+- # apr
+- export ac_cv_func_setpgrp_void=yes
+- export ac_cv_file__dev_zero=yes
+- export apr_cv_tcp_nodelay_with_cork=yes
+- export ac_cv_file_dbd_apr_dbd_mysql_c=no
+- export ac_cv_sizeof_ssize_t=4
+- export apr_cv_mutex_recursive=yes
+- export ac_cv_func_pthread_rwlock_init=yes
+- export apr_cv_type_rwlock_t=yes
+- export apr_cv_process_shared_works=yes
+- export apr_cv_mutex_robust_shared=yes
+- ;;
+- esac
+ else
+ CC_FOR_BUILD='$(CC)'
+ fi
+@@ -667,7 +643,7 @@ AC_ARG_ENABLE(core-pgsql-pkgconfig,
+ [AS_HELP_STRING([--disable-core-pgsql-pkgconfig], [Use pg_config to get PGQSL build options])],[enable_core_pgsql_pkgconfig="$enableval"],[enable_core_pgsql_pkgconfig="yes"])
+
+ if test x"$enable_core_pgsql_support" = x"yes" ; then
+- AC_PATH_PROG([PG_CONFIG], [pg_config], [no])
++ AC_PATH_PROG([PG_CONFIG], [pg_config], [no], ["${STAGING_DIR}"/usr/bin])
+ AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])
+ if test "$PKG_CONFIG" = "no" \
+ || test x"$enable_core_pgsql_pkgconfig" = x"no" \
--- /dev/null
+--- a/scripts/gentls_cert.in
++++ b/scripts/gentls_cert.in
+@@ -1,6 +1,6 @@
+ #!/bin/sh
+
+-CONFDIR=@prefix@/conf/ssl
++CONFDIR=@certsdir@
+ DAYS=2190
+ KEY_SIZE=2048
+ export KEY_SIZE=${KEY_SIZE}
--- /dev/null
+--- a/libs/apr-util/build/apr_common.m4
++++ b/libs/apr-util/build/apr_common.m4
+@@ -514,8 +514,9 @@ dnl string.
+ dnl
+ dnl
+ AC_DEFUN([APR_CHECK_STRERROR_R_RC],[
+-AC_MSG_CHECKING(for type of return code from strerror_r)
+-AC_TRY_RUN([
++AC_CACHE_CHECK([whether return code from strerror_r has type int],
++[ac_cv_strerror_r_rc_int],
++[AC_TRY_RUN([
+ #include <errno.h>
+ #include <string.h>
+ #include <stdio.h>
+@@ -531,14 +532,10 @@ int main(void)
+ }], [
+ ac_cv_strerror_r_rc_int=yes ], [
+ ac_cv_strerror_r_rc_int=no ], [
+- ac_cv_strerror_r_rc_int=no ] )
++ ac_cv_strerror_r_rc_int=no ] ) ] )
+ if test "x$ac_cv_strerror_r_rc_int" = xyes; then
+ AC_DEFINE(STRERROR_R_RC_INT, 1, [Define if strerror returns int])
+- msg="int"
+-else
+- msg="pointer"
+ fi
+-AC_MSG_RESULT([$msg])
+ ] )
+
+ dnl
+--- a/libs/apr/build/apr_common.m4
++++ b/libs/apr/build/apr_common.m4
+@@ -514,8 +514,9 @@ dnl string.
+ dnl
+ dnl
+ AC_DEFUN([APR_CHECK_STRERROR_R_RC],[
+-AC_MSG_CHECKING(for type of return code from strerror_r)
+-AC_TRY_RUN([
++AC_CACHE_CHECK([whether return code from strerror_r has type int],
++[ac_cv_strerror_r_rc_int],
++[AC_TRY_RUN([
+ #include <errno.h>
+ #include <string.h>
+ #include <stdio.h>
+@@ -531,14 +532,10 @@ int main(void)
+ }], [
+ ac_cv_strerror_r_rc_int=yes ], [
+ ac_cv_strerror_r_rc_int=no ], [
+- ac_cv_strerror_r_rc_int=no ] )
++ ac_cv_strerror_r_rc_int=no ] ) ] )
+ if test "x$ac_cv_strerror_r_rc_int" = xyes; then
+ AC_DEFINE(STRERROR_R_RC_INT, 1, [Define if strerror returns int])
+- msg="int"
+-else
+- msg="pointer"
+ fi
+-AC_MSG_RESULT([$msg])
+ ] )
+
+ dnl
+--- a/libs/unimrcp/build/acmacros/apr_common.m4
++++ b/libs/unimrcp/build/acmacros/apr_common.m4
+@@ -526,8 +526,9 @@ dnl string.
+ dnl
+ dnl
+ AC_DEFUN([APR_CHECK_STRERROR_R_RC], [
+-AC_MSG_CHECKING(for type of return code from strerror_r)
+-AC_TRY_RUN([
++AC_CACHE_CHECK([whether return code from strerror_r has type int],
++[ac_cv_strerror_r_rc_int],
++[AC_TRY_RUN([
+ #include <errno.h>
+ #include <string.h>
+ #include <stdio.h>
+@@ -543,14 +544,10 @@ main()
+ }], [
+ ac_cv_strerror_r_rc_int=yes ], [
+ ac_cv_strerror_r_rc_int=no ], [
+- ac_cv_strerror_r_rc_int=no ] )
++ ac_cv_strerror_r_rc_int=no ] ) ] )
+ if test "x$ac_cv_strerror_r_rc_int" = xyes; then
+ AC_DEFINE(STRERROR_R_RC_INT, 1, [Define if strerror returns int])
+- msg="int"
+-else
+- msg="pointer"
+ fi
+-AC_MSG_RESULT([$msg])
+ ] )
+
+ dnl
--- /dev/null
+--- a/configure.ac
++++ b/configure.ac
+@@ -1958,7 +1958,13 @@ AC_SUBST(OUR_DISABLED_INSTALL_MODS)
+ AC_SUBST(OUR_DISABLED_UNINSTALL_MODS)
+ AC_SUBST(AM_MAKEFLAGS)
+
+-ac_configure_args="$ac_configure_args --with-modinstdir=${modulesdir} CONFIGURE_CFLAGS='$CFLAGS $CPPFLAGS' CONFIGURE_CXXFLAGS='$CXXFLAGS $CPPFLAGS' CONFIGURE_LDFLAGS='$LDFLAGS' "
++ac_configure_args="$ac_configure_args --with-modinstdir=${modulesdir}"
++
++case $host in
++ *-darwin*)
++ ac_configure_args="$ac_configure_args CONFIGURE_CFLAGS='$CFLAGS $CPPFLAGS' CONFIGURE_CXXFLAGS='$CXXFLAGS $CPPFLAGS' CONFIGURE_LDFLAGS='$LDFLAGS' "
++ ;;
++esac
+
+ # --prefix='$prefix' --exec_prefix='$exec_prefix' --libdir='$libdir' --libexecdir='$libexecdir' --bindir='$bindir' --sbindir='$sbindir' \
+ # --localstatedir='$localstatedir' --datadir='$datadir'"
+--- a/libs/apr-util/configure.ac
++++ b/libs/apr-util/configure.ac
+@@ -20,9 +20,13 @@ dnl Generate ./config.nice for reproduci
+ dnl
+ APR_CONFIG_NICE(config.nice)
+
+-CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+-CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+-LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++case $host in
++ *-darwin*)
++ CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
++ CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
++ LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++ ;;
++esac
+
+ dnl # Some initial steps for configuration. We setup the default directory
+ dnl # and which files are to be configured.
+--- a/libs/apr/configure.ac
++++ b/libs/apr/configure.ac
+@@ -20,9 +20,13 @@ sinclude(build/apr_hints.m4)
+ sinclude(build/libtool.m4)
+ sinclude(build/ltsugar.m4)
+
+-CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+-CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+-LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++case $host in
++ *-darwin*)
++ CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
++ CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
++ LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++ ;;
++esac
+
+ dnl Hard-coded inclusion at the tail end of apr_private.h:
+ AH_BOTTOM([
+--- a/libs/broadvoice/configure.ac
++++ b/libs/broadvoice/configure.ac
+@@ -22,9 +22,13 @@
+
+ AC_INIT([broadvoice],[0.1.0])
+
+-CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+-CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+-LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++case $host in
++ *-darwin*)
++ CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
++ CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
++ LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++ ;;
++esac
+
+ m4_include(config/ax_compiler_vendor.m4)
+ m4_include(config/ax_check_real_file.m4)
+--- a/libs/iksemel/configure.ac
++++ b/libs/iksemel/configure.ac
+@@ -6,9 +6,13 @@ AC_CONFIG_SRCDIR([configure.ac])
+ AM_INIT_AUTOMAKE
+ AC_CONFIG_HEADERS(include/config.h)
+
+-CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+-CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+-LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++case $host in
++ *-darwin*)
++ CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
++ CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
++ LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++ ;;
++esac
+
+ AC_CANONICAL_HOST
+
+--- a/libs/ilbc/configure.ac
++++ b/libs/ilbc/configure.ac
+@@ -22,9 +22,13 @@
+
+ AC_INIT([ilbc], [0.0.1])
+
+-CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+-CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+-LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++case $host in
++ *-darwin*)
++ CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
++ CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
++ LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++ ;;
++esac
+
+ AC_DEFUN([AX_COMPILER_VENDOR],
+ [
+--- a/libs/libdingaling/configure.ac
++++ b/libs/libdingaling/configure.ac
+@@ -8,9 +8,13 @@ AM_INIT_AUTOMAKE
+ AC_CONFIG_SRCDIR([src])
+ AC_CONFIG_HEADERS([src/config.h])
+
+-CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+-CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+-LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++case $host in
++ *-darwin*)
++ CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
++ CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
++ LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++ ;;
++esac
+
+ #Set default language
+ AC_LANG_C
+--- a/libs/libsndfile/configure.ac
++++ b/libs/libsndfile/configure.ac
+@@ -15,9 +15,13 @@ AC_CANONICAL_TARGET([])
+ AC_CONFIG_MACRO_DIR([M4])
+ AC_CONFIG_HEADERS([src/config.h])
+
+-CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+-CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+-LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++case $host in
++ *-darwin*)
++ CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
++ CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
++ LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++ ;;
++esac
+
+ AM_INIT_AUTOMAKE
+ AC_SUBST(ACLOCAL_AMFLAGS, "-I M4")
+--- a/libs/sofia-sip/configure.ac
++++ b/libs/sofia-sip/configure.ac
+@@ -13,9 +13,13 @@ dnl ---------------------------
+ dnl update both the version for AC_INIT and the LIBSOFIA_SIP_UA_MAJOR_MINOR
+ AC_INIT([sofia-sip], [1.12.10devel])
+
+-CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+-CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+-LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++case $host in
++ *-darwin*)
++ CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
++ CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
++ LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++ ;;
++esac
+
+ AC_CONFIG_SRCDIR([libsofia-sip-ua/sip/sofia-sip/sip.h])
+ AC_CONFIG_MACRO_DIR([m4])
+--- a/libs/spandsp/configure.ac
++++ b/libs/spandsp/configure.ac
+@@ -21,9 +21,13 @@
+ AC_PREREQ([2.59])
+ AC_INIT([spandsp], [1.99.0])
+
+-CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+-CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+-LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++case $host in
++ *-darwin*)
++ CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
++ CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
++ LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++ ;;
++esac
+
+ SPANDSP_LT_CURRENT=3
+ SPANDSP_LT_REVISION=0
+--- a/libs/srtp/configure.ac
++++ b/libs/srtp/configure.ac
+@@ -3,9 +3,13 @@ AC_INIT(srtp, 1.4.2, mcgrew@cisco.com)
+ AC_CONFIG_AUX_DIR(build)
+ AM_INIT_AUTOMAKE
+
+-CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+-CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+-LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++case $host in
++ *-darwin*)
++ CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
++ CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
++ LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++ ;;
++esac
+
+ #Set default language
+ AC_LANG_C
+--- a/libs/tiff-4.0.2/configure.ac
++++ b/libs/tiff-4.0.2/configure.ac
+@@ -32,9 +32,13 @@ AC_LANG(C)
+ AC_PROG_LIBTOOL
+ m4_include(m4/acinclude.m4)
+
+-CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+-CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+-LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++case $host in
++ *-darwin*)
++ CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
++ CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
++ LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
++ ;;
++esac
+
+ dnl Compute the canonical host (run-time) system type variable
+ AC_CANONICAL_HOST
--- /dev/null
+--- a/libs/iksemel/src/Makefile.am
++++ b/libs/iksemel/src/Makefile.am
+@@ -25,5 +25,5 @@ libiksemel_la_SOURCES = \
+ base64.c
+
+ libiksemel_la_LDFLAGS = -version-info 4:0:1 -no-undefined
+-libiksemel_la_CFLAGS = $(CFLAGS) $(LIBGNUTLS_CFLAGS)
++libiksemel_la_CFLAGS = $(LIBGNUTLS_CFLAGS)
+ libiksemel_la_LIBADD = $(LIBGNUTLS_LIBS)
--- /dev/null
+--- a/build/Makefile.am
++++ b/build/Makefile.am
+@@ -71,7 +71,7 @@ install:
+ @echo " + +"
+ @echo " +-------------------------------------------------+"
+ @cat $(switch_srcdir)/cluecon2.tmpl
+- @sh $(switch_srcdir)/build/modcheck.sh $(modulesdir)
++ @sh $(switch_srcdir)/build/modcheck.sh $(DESTDIR)$(modulesdir)
+
+ .PHONY: check dvi html info install-data \
+ install-dvi install-exec install-html install-info install-pdf install-ps installcheck installdirs pdf \