portaudio_stream \
posix_timer \
prefix \
+ python3 \
radius_cdr \
random \
raven \
CONFIG_FS_WITH_ZRTP \
CONFIG_LIBC \
CONFIG_PACKAGE_freeswitch-misc-perl-esl \
+ CONFIG_PACKAGE_freeswitch-misc-python3-esl \
CONFIG_SOFT_FLOAT
include $(INCLUDE_DIR)/package.mk
FS_PERL_FEED:=$(TOPDIR)/feeds/packages/lang/perl
+include $(TOPDIR)/feeds/packages/lang/python/python3-host.mk
include $(FS_PERL_FEED)/perlver.mk
PERL_SITELIB:=/usr/lib/perl$(PERL_MAJOR)/$(PERL_VERSION2)
$(FS_PERL_FEED)/files/base.config | \
sed "s/^libs=//;s/'//g")
+FS_PYTHON3_SITE_DIR:=$(FS_LIB_DIR)/python$(PYTHON3_VERSION)/site-packages
+
define Download/files
define Download/$(1)
FILE:=$(2)
$(1)$(PERL_SITELIB)/ESL
endef
+define Package/freeswitch-misc-python3-esl
+$(call Package/freeswitch/Default)
+ TITLE:=Python3 ESL
+ DEPENDS:=freeswitch +PACKAGE_freeswitch-misc-python3-esl:python3-light
+endef
+
+define Package/freeswitch-misc-python3-esl/description
+This package contains the Python3 binding for FreeSWITCH's Event Socket
+Library (ESL).
+endef
+
+define Package/freeswitch-misc-python3-esl/install
+ $(INSTALL_DIR) $(1)$(FS_PYTHON3_SITE_DIR)
+ $(INSTALL_BIN) \
+ $(PKG_INSTALL_DIR)$(FS_PYTHON3_SITE_DIR)/_ESL.so \
+ $(1)$(FS_PYTHON3_SITE_DIR)
+ $(INSTALL_DATA) \
+ $(PKG_INSTALL_DIR)$(FS_PYTHON3_SITE_DIR)/ESL.py \
+ $(1)$(FS_PYTHON3_SITE_DIR)
+endef
+
define Package/freeswitch-misc-timezones
$(call Package/freeswitch/Default)
TITLE:=Timezones file
$(PKG_INSTALL_DIR)/usr/perl/freeswitch.pm \
$$(1)$(PERL_SITELIB)
endif
+ifeq ($(1),python3)
+ $(INSTALL_DIR) $$(1)$(FS_PYTHON3_SITE_DIR)
+ $(INSTALL_DATA) \
+ $(PKG_INSTALL_DIR)$(FS_PYTHON3_SITE_DIR)/freeswitch.py \
+ $$(1)$(FS_PYTHON3_SITE_DIR)
+endif
endef
$$(eval $$(call BuildPackage,freeswitch-mod-$(subst _,-,$(1))))
endef
$(if $(CONFIG_FS_WITH_ODBC),--with-odbc="$(STAGING_DIR)/usr") \
$(if $(CONFIG_FS_WITH_PNG),,--without-png)
+ifneq ($(CONFIG_PACKAGE_freeswitch-misc-python3-esl)$(CONFIG_PACKAGE_freeswitch-mod-python3),)
+CONFIGURE_ARGS+= \
+ --with-python3=$(STAGING_DIR_HOST)/bin/python3
+else
+CONFIGURE_ARGS+= \
+ --with-python3=no
+endif
+
ifeq ($(CONFIG_PACKAGE_freeswitch-mod-erlang-event)$(CONFIG_PACKAGE_freeswitch-mod-kazoo),)
CONFIGURE_ARGS+= \
--with-erlang=no
ac_cv_prog_PERL=false
endif
+ifneq ($(CONFIG_PACKAGE_freeswitch-misc-python3-esl)$(CONFIG_PACKAGE_freeswitch-mod-python3),)
+CONFIGURE_VARS+= \
+ PYTHON3_CFLAGS="-I$(STAGING_DIR)/usr/include/python$(PYTHON3_VERSION)" \
+ PYTHON3_LDFLAGS="-lpython$(PYTHON3_VERSION)" \
+ PYTHON3_LIB="python$(PYTHON3_VERSION)" \
+ PYTHON3_LIBDIR="$(FS_LIB_DIR)" \
+ PYTHON3_SITE_DIR="$(FS_PYTHON3_SITE_DIR)"
+endif
+
# mod_radius_cdr runs configure in libs/freeradius-client. Let
# freeradius-client know /dev/urandom is available on target devices.
MAKE_VARS+= \
ifneq ($(CONFIG_PACKAGE_freeswitch-misc-perl-esl),)
$(call Build/Compile/Default,-C $(PKG_BUILD_DIR)/libs/esl perlmod)
endif
+ifneq ($(CONFIG_PACKAGE_freeswitch-misc-python3-esl),)
+ $(call Build/Compile/Default,-C $(PKG_BUILD_DIR)/libs/esl py3mod)
+endif
endef
define Build/Install
ifneq ($(CONFIG_PACKAGE_freeswitch-misc-perl-esl),)
$(call Build/Compile/Default,-C $(PKG_BUILD_DIR)/libs/esl DESTDIR=$(PKG_INSTALL_DIR) perlmod-install)
endif
+ifneq ($(CONFIG_PACKAGE_freeswitch-misc-python3-esl),)
+ $(call Build/Install/Default,-C $(PKG_BUILD_DIR)/libs/esl py3mod-install)
+endif
endef
define Build/InstallDev
$(eval $(call BuildPackage,freeswitch))
$(eval $(call BuildPackage,freeswitch-misc-perl-esl))
+$(eval $(call BuildPackage,freeswitch-misc-python3-esl))
$(eval $(call BuildPackage,freeswitch-misc-timezones))
################################
$(eval $(call Package/freeswitch/Module,portaudio_stream,Portaudio streaming,Stream from an external audio source for Music on Hold.,+portaudio))
$(eval $(call Package/freeswitch/Module,posix_timer,POSIX timer,Add POSIX timer support.,))
$(eval $(call Package/freeswitch/Module,prefix,Prefix match,This module provides a data store with fast lookups by the longest\nprefix match rule.,))
+$(eval $(call Package/freeswitch/Module,python3,Python3,Python3 support module.,+python3-light))
$(eval $(call Package/freeswitch/Module,radius_cdr,Radius CDR,Radius Call Detail Record handler.,))
$(eval $(call Package/freeswitch/Module,random,Entropy,This module extracts entropy from FreeSWITCH and feeds it into\n/dev/random.,))
$(eval $(call Package/freeswitch/Module,raven,Raven logging,Adds support for logging to Raven instances.,))
--- /dev/null
+--- a/configure.ac
++++ b/configure.ac
+@@ -1865,24 +1865,12 @@ then
+ if test "$python3_has_distutils" != "no" ; then
+ AC_MSG_CHECKING([location of python3 site-packages])
+
+- PYTHON3_SITE_DIR="`$PYTHON3 -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(0));'`"
+-
+ if test -z "$PYTHON3_SITE_DIR" ; then
+ AC_MSG_ERROR([Unable to detect python3 site-packages path])
+- elif test ! -d "$PYTHON3_SITE_DIR" ; then
+- AC_MSG_ERROR([Path $PYTHON3_SITE_DIR returned by python3 does not exist!])
+ fi
+ AC_MSG_RESULT([$PYTHON3_SITE_DIR])
+ AC_SUBST([PYTHON3_SITE_DIR], [$PYTHON3_SITE_DIR])
+
+- #
+- # python3 distutils found, get settings from python3 directly
+- #
+- PYTHON3_CFLAGS="`$PYTHON3 -c 'from distutils import sysconfig; flags = [[\"-I\" + sysconfig.get_python_inc(0), \"-I\" + sysconfig.get_python_inc(1), \" \".join(sysconfig.get_config_var(\"CFLAGS\").split())]]; print(\" \".join(flags));' | sed -e 's/-arch i386//g;s/-arch x86_64//g'`"
+- PYTHON3_LDFLAGS="`$PYTHON3 -c 'from distutils import sysconfig; ldver = sysconfig.get_config_var(\"LDVERSION\"); libs = sysconfig.get_config_var(\"LIBS\").split() + sysconfig.get_config_var(\"SYSLIBS\").split(); libs.append(\"-lpython\" + [[ldver,sysconfig.get_config_var(\"VERSION\")]][[ldver==None]]); print(\" \".join(libs));'`"
+- PYTHON3_LIB="`$PYTHON3 -c 'from distutils import sysconfig; ldver = sysconfig.get_config_var(\"LDVERSION\"); print(\"python\" + [[ldver,sysconfig.get_config_var(\"VERSION\")]][[ldver==None]]);'`"
+- PYTHON3_LIBDIR="`$PYTHON3 -c 'from distutils import sysconfig; print(sysconfig.get_config_var(\"LIBDIR\"));'`"
+-
+ # handle python3 being installed into /usr/local
+ AC_MSG_CHECKING([python3 libdir])
+ if test -z "`echo $PYTHON3_LIBDIR | grep "/usr/lib"`" ; then
--- /dev/null
+--- a/libs/esl/Makefile.am
++++ b/libs/esl/Makefile.am
+@@ -82,7 +82,7 @@ pymod: $(MYLIB)
+ $(MAKE) PYTHON=$(PYTHON) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CFLAGS)" CXXFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C python
+
+ py3mod: $(MYLIB)
+- $(MAKE) PYTHON3=$(PYTHON3) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CFLAGS)" CXXFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C python3
++ $(MAKE) PYTHON3=$(PYTHON3) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CFLAGS)" CXXFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" PYTHON3_CFLAGS="$(PYTHON3_CFLAGS)" PYTHON3_LDFLAGS="$(PYTHON3_LDFLAGS)" -C python3
+
+ tclmod: $(MYLIB)
+ $(MAKE) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CFLAGS)" CXXFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C tcl
+@@ -106,7 +106,7 @@ pymod-install: pymod
+ $(MAKE) PYTHON=$(PYTHON) -C python install
+
+ py3mod-install: py3mod
+- $(MAKE) PYTHON3=$(PYTHON3) -C python3 install
++ $(MAKE) PYTHON3=$(PYTHON3) PYTHON3_SITE_DIR="$(PYTHON3_SITE_DIR)" -C python3 install
+
+ rubymod-install: rubymod
+ $(MAKE) -C ruby install
+--- a/libs/esl/python3/Makefile
++++ b/libs/esl/python3/Makefile
+@@ -1,6 +1,4 @@
+-LOCAL_CFLAGS=`$(PYTHON3) ./python-config --includes`
+-LOCAL_LDFLAGS=`$(PYTHON3) ./python-config --ldflags`
+-SITE_DIR=$(DESTDIR)/`$(PYTHON3) -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))"`
++SITE_DIR=$(DESTDIR)/$(PYTHON3_SITE_DIR)
+
+ all: _ESL.so
+
+@@ -8,10 +6,10 @@ esl_wrap.cpp:
+ swig3.0 -module ESL -classic -python -c++ -DMULTIPLICITY -threads -I../src/include -o esl_wrap.cpp ../ESL.i
+
+ esl_wrap.o: esl_wrap.cpp
+- $(CXX) $(CXX_CFLAGS) $(CXXFLAGS) $(LOCAL_CFLAGS) -c esl_wrap.cpp -o esl_wrap.o
++ $(CXX) $(CXX_CFLAGS) $(CXXFLAGS) $(PYTHON3_CFLAGS) -c esl_wrap.cpp -o esl_wrap.o
+
+ _ESL.so: esl_wrap.o
+- $(CXX) $(SOLINK) esl_wrap.o $(MYLIB) $(LOCAL_LDFLAGS) -o _ESL.so -L. $(LIBS)
++ $(CXX) $(SOLINK) esl_wrap.o $(MYLIB) $(PYTHON3_LDFLAGS) -o _ESL.so -L. $(LIBS)
+
+ install: _ESL.so
+ mkdir -p $(SITE_DIR)