freeswitch-stable: add FreeTDM support
authorSebastian Kemper <sebastian_ml@gmx.net>
Thu, 4 Jan 2018 15:34:36 +0000 (16:34 +0100)
committerSebastian Kemper <sebastian_ml@gmx.net>
Thu, 4 Jan 2018 15:38:39 +0000 (16:38 +0100)
The OpenWrt telephony feed already has DAHDI support. This commit
enables FreeTDM so FreeSWITCH can make use of DAHDI via libpri.

This does not change the existing FreeSWITCH packages as FreeTDM is a
separate library in the FreeSWITCH distribution, hence no revision bump.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
net/freeswitch-stable/Makefile
net/freeswitch-stable/patches/280-tone-down-freetdm-COMP_VENDOR_CFLAGS.patch [new file with mode: 0644]

index eaffe8d0460dd90745bbbc802ab971e08e767a81..347e83d608e8def0355243675fbb6893f2e1662d 100644 (file)
@@ -241,6 +241,8 @@ FS_STABLE_MOD_AVAILABLE:= \
        yaml \
        yuv
 
+LIBFTDM:=libfreetdm
+
 PKG_CONFIG_DEPENDS:= \
        $(patsubst %,CONFIG_PACKAGE_$(PKG_NAME)-%,$(FS_STABLE_MISC_AVAILABLE)) \
        $(patsubst %,CONFIG_PACKAGE_$(PKG_NAME)-mod-%,$(FS_STABLE_MOD_AVAILABLE)) \
@@ -257,6 +259,7 @@ PKG_CONFIG_DEPENDS:= \
        CONFIG_FS_STABLE_WITH_VPX \
        CONFIG_FS_STABLE_WITH_ZRTP \
        CONFIG_LIBC \
+       CONFIG_PACKAGE_$(LIBFTDM) \
        CONFIG_SOFT_FLOAT
 
 include $(INCLUDE_DIR)/package.mk
@@ -311,6 +314,24 @@ define Package/$(PKG_NAME)/install/mod
                                                $(1)$(FS_STABLE_MOD_DIR)
 endef
 
+define Package/$(LIBFTDM)
+  CATEGORY:=Libraries
+  DEPENDS:=$(PKG_NAME)
+  SECTION:=libs
+  SUBMENU:=Telephony
+  TITLE:=TDM signaling and media API
+  URL:=https://www.$(PRG_NAME).org
+endef
+
+define Package/$(LIBFTDM)/description
+Provides a unified interface to hardware TDM cards and ss7 stacks for
+FreeSWITCH.
+endef
+
+define Package/$(LIBFTDM)/install
+$(call Package/$(PKG_NAME)/install/lib,$(1),$(LIBFTDM))
+endef
+
 define Package/$(PKG_NAME)/config
        source "$(SOURCE)/Config.in"
 endef
@@ -922,6 +943,12 @@ endef
 
 define Build/Compile
        $(call Build/Compile/Default)
+# FreeTDM is only compiled/installed automatically if mod_freetdm is selected
+ifneq ($(CONFIG_PACKAGE_$(LIBFTDM)),)
+ifeq ($(CONFIG_PACKAGE_$(PKG_NAME)-mod-freetdm),)
+       $(call Build/Compile/Default,-C $(PKG_BUILD_DIR)/libs/freetdm)
+endif
+endif
 ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-misc-perl-esl),)
        $(call Build/Compile/Default,-C $(PKG_BUILD_DIR)/libs/esl perlmod)
 endif
@@ -932,6 +959,11 @@ endef
 
 define Build/Install
        $(call Build/Install/Default)
+ifneq ($(CONFIG_PACKAGE_$(LIBFTDM)),)
+ifeq ($(CONFIG_PACKAGE_$(PKG_NAME)-mod-freetdm),)
+       $(call Build/Install/Default,-C $(PKG_BUILD_DIR)/libs/freetdm install)
+endif
+endif
 ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-misc-perl-esl),)
        $(call Build/Compile/Default,-C $(PKG_BUILD_DIR)/libs/esl DESTDIR=$(PKG_INSTALL_DIR) perlmod-install)
 endif
@@ -948,8 +980,15 @@ define Build/InstallDev
        $(INSTALL_DATA) \
                $(PKG_INSTALL_DIR)$(FS_STABLE_PKGCONFIG_DIR)/$(PRG_NAME).pc \
                                                $(1)$(FS_STABLE_PKGCONFIG_DIR)
+ifneq ($(CONFIG_PACKAGE_$(LIBFTDM)),)
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)$(FS_STABLE_PKGCONFIG_DIR)/freetdm.pc \
+                                               $(1)$(FS_STABLE_PKGCONFIG_DIR)
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include
+endif
 endef
 
+$(eval $(call BuildPackage,$(LIBFTDM)))
 $(eval $(call BuildPackage,$(PKG_NAME)))
 $(eval $(call BuildPackage,$(PKG_NAME)-misc-hotplug))
 $(eval $(call BuildPackage,$(PKG_NAME)-misc-perl-esl))
diff --git a/net/freeswitch-stable/patches/280-tone-down-freetdm-COMP_VENDOR_CFLAGS.patch b/net/freeswitch-stable/patches/280-tone-down-freetdm-COMP_VENDOR_CFLAGS.patch
new file mode 100644 (file)
index 0000000..7e29e94
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/libs/freetdm/configure.ac
++++ b/libs/freetdm/configure.ac
+@@ -88,7 +88,7 @@ AC_ARG_ENABLE([enable_64],
+ case "${ax_cv_c_compiler_vendor}" in
+ gnu)
+-      COMP_VENDOR_CFLAGS="-ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -O0"
++      COMP_VENDOR_CFLAGS="-ffast-math -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
+       ;;
+ sun)
+       COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -xvpara"