freeswitch-stable: cleanup Python setup 160/head
authorSebastian Kemper <sebastian_ml@gmx.net>
Tue, 27 Jun 2017 20:14:43 +0000 (22:14 +0200)
committerSebastian Kemper <sebastian_ml@gmx.net>
Tue, 27 Jun 2017 20:14:46 +0000 (22:14 +0200)
- Rename PYTHON_PKG_DIR to PYTHON_SITE_DIR, otherwise it's confusing.
- Remove the 'sed' hacks; handle the Python setup like the Perl setup is
  already done.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
net/freeswitch-stable/Makefile
net/freeswitch-stable/patches/030-fix-configure-ac.patch
net/freeswitch-stable/patches/120-fix-copts.diff
net/freeswitch-stable/patches/220-esl-python.patch [new file with mode: 0644]

index 96485ad17bbf9036e00513952f1e0dde5f1acb5d..3c9ad3a6dcd2cbebd927ac3aa20a454785f20d73 100644 (file)
@@ -393,13 +393,13 @@ Library (ESL).
 endef
 
 define Package/$(PKG_NAME)-misc-python-esl/install
-       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(INSTALL_DIR) $(1)$(PYTHON_SITE_DIR)
        $(INSTALL_DATA) \
-               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/ESL.py \
-                                       $(1)$(PYTHON_PKG_DIR)
+               $(PKG_INSTALL_DIR)$(PYTHON_SITE_DIR)/ESL.py \
+                                       $(1)$(PYTHON_SITE_DIR)
        $(INSTALL_BIN) \
-               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/_ESL.so \
-                                       $(1)$(PYTHON_PKG_DIR)
+               $(PKG_INSTALL_DIR)$(PYTHON_SITE_DIR)/_ESL.so \
+                                       $(1)$(PYTHON_SITE_DIR)
 endef
 
 define Package/$(PKG_NAME)-misc-timezones
@@ -506,10 +506,10 @@ ifeq ($(1),perl)
                                                        $$(1)$(PERL_SITELIB)/auto
 endif
 ifeq ($(1),python)
-       $(INSTALL_DIR) $$(1)$(PYTHON_PKG_DIR)
+       $(INSTALL_DIR) $$(1)$(PYTHON_SITE_DIR)
        $(INSTALL_DATA) \
-               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/$(PRG_NAME).py \
-                                               $$(1)$(PYTHON_PKG_DIR)
+               $(PKG_INSTALL_DIR)$(PYTHON_SITE_DIR)/$(PRG_NAME).py \
+                                               $$(1)$(PYTHON_SITE_DIR)
 endif
 endef
 $$(eval $$(call BuildPackage,$(PKG_NAME)-mod-$(1)))
@@ -635,15 +635,17 @@ ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-misc-python-esl)$(CONFIG_PACKAGE_$(PKG_NAME)
 
 $(call include_mk, python-version.mk)
 
-PYTHON_DIR:=$(STAGING_DIR)/usr
-PYTHON_INC_DIR:=$(PYTHON_DIR)/include/python$(PYTHON_VERSION)
-PYTHON_LDFLAGS:=-lpython$(PYTHON_VERSION) -ldl -lpthread -lm -Xlinker -export-dynamic
-PYTHON_PKG_DIR:=$(FS_STABLE_LIB_DIR)/python$(PYTHON_VERSION)/site-packages
+PYTHON_SITE_DIR:=$(FS_STABLE_LIB_DIR)/python$(PYTHON_VERSION)/site-packages
 
 CONFIGURE_VARS+= \
-       _python_sysroot="$(STAGING_DIR)" \
-       _python_prefix="/usr" \
-       _python_exec_prefix="/usr"
+       PYTHON_CFLAGS="-I$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION)" \
+       PYTHON_LDFLAGS="-lpython$(PYTHON_VERSION) -ldl -lpthread -lm -Xlinker -export-dynamic" \
+       PYTHON_LIB="python$(PYTHON_VERSION)" \
+       PYTHON_LIBDIR="$(FS_STABLE_LIB_DIR)" \
+       PYTHON_SITE_DIR="$(PYTHON_SITE_DIR)"
+
+CONFIGURE_ARGS+= \
+       --with-python=$(STAGING_DIR_HOSTPKG)/bin/python$(PYTHON_VERSION)
 
 else
 
@@ -754,21 +756,6 @@ define Build/Prepare
                $(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-$(m)),
                $(SED) '/mod_$(m)$$$$/s/^#//' $(PKG_BUILD_DIR)/modules.conf))
 
-ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-misc-python-esl)$(CONFIG_PACKAGE_$(PKG_NAME)-mod-python),)
-       $(SED) 's|^LOCAL_CFLAGS=.*|LOCAL_CFLAGS=-I$(PYTHON_INC_DIR)|' \
-               $(PKG_BUILD_DIR)/libs/esl/python/Makefile
-       $(SED) 's|^LOCAL_LDFLAGS=.*|LOCAL_LDFLAGS=$(PYTHON_LDFLAGS)|' \
-               $(PKG_BUILD_DIR)/libs/esl/python/Makefile
-       $(SED) 's|^SITE_DIR=.*|SITE_DIR=$$$$(DESTDIR)$(PYTHON_PKG_DIR)|' \
-               $(PKG_BUILD_DIR)/libs/esl/python/Makefile
-       $(SED) 's|^PYTHON_SITE_DIR=.*|PYTHON_SITE_DIR=$(PYTHON_PKG_DIR)|' \
-               $(PKG_BUILD_DIR)/src/mod/languages/mod_python/Makefile.am
-       $(SED) 's|@PYTHON_CFLAGS@|-I$(PYTHON_INC_DIR)|' \
-               $(PKG_BUILD_DIR)/src/mod/languages/mod_python/Makefile.am
-       $(SED) 's|@PYTHON_LDFLAGS@|$(PYTHON_LDFLAGS)|' \
-               $(PKG_BUILD_DIR)/src/mod/languages/mod_python/Makefile.am
-endif
-
        $(SED) 's|$(FS_STABLE_ANCHOR)|APR_SETVAR(LDFLAGS,$(FS_STABLE_APR_LIBS) $(TARGET_LDFLAGS))|' \
                $(PKG_BUILD_DIR)/libs/unimrcp/build/acmacros/apr.m4
 
index ce9aaa02285fbb835746ddf630127f05b4be5439..08393608883860197ea2b4714b08caf65c4dd7a7 100644 (file)
  
     save_CFLAGS="$CFLAGS"
     CFLAGS="$PERL_CFLAGS"
+@@ -1656,24 +1626,12 @@ then
+               if test "$python_has_distutils" != "no" ; then
+                       AC_MSG_CHECKING([location of site-packages])
+-                      PYTHON_SITE_DIR="`$PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(0));'`"
+-
+                       if test -z "$PYTHON_SITE_DIR" ; then
+                               AC_MSG_ERROR([Unable to detect python site-packages path])
+-                      elif test ! -d "$PYTHON_SITE_DIR" ; then
+-                              AC_MSG_ERROR([Path $PYTHON_SITE_DIR returned by python does not exist!])
+                       fi
+                       AC_MSG_RESULT([$PYTHON_SITE_DIR])
+                       AC_SUBST([PYTHON_SITE_DIR], [$PYTHON_SITE_DIR])
+-                      #
+-                      # python distutils found, get settings from python directly
+-                      #
+-                      PYTHON_CFLAGS="`$PYTHON -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'`"
+-                      PYTHON_LDFLAGS="`$PYTHON -c 'from distutils import sysconfig; libs = sysconfig.get_config_var(\"LIBS\").split() + sysconfig.get_config_var(\"SYSLIBS\").split(); libs.append(\"-lpython\"+sysconfig.get_config_var(\"VERSION\")); print(\" \".join(libs));'`"
+-                      PYTHON_LIB="`$PYTHON -c 'from distutils import sysconfig; print(\"python\" + sysconfig.get_config_var(\"VERSION\"));'`"
+-                      PYTHON_LIBDIR="`$PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_config_var(\"LIBDIR\"));'`"
+-
+                       # handle python being installed into /usr/local
+                       AC_MSG_CHECKING([python libdir])
+                       if test -z "`echo $PYTHON_LIBDIR | grep "/usr/lib"`" ; then
index 2959db4a46b19a1ea783aea6c6e98480978c6817..4940acf9a4be97fbe562a3df33e6a795a90939c1 100644 (file)
@@ -1,6 +1,6 @@
 --- a/configure.ac
 +++ b/configure.ac
-@@ -1953,7 +1953,13 @@ AC_SUBST(OUR_DISABLED_INSTALL_MODS)
+@@ -1941,7 +1941,13 @@ AC_SUBST(OUR_DISABLED_INSTALL_MODS)
  AC_SUBST(OUR_DISABLED_UNINSTALL_MODS)
  AC_SUBST(AM_MAKEFLAGS)
  
diff --git a/net/freeswitch-stable/patches/220-esl-python.patch b/net/freeswitch-stable/patches/220-esl-python.patch
new file mode 100644 (file)
index 0000000..11b39ef
--- /dev/null
@@ -0,0 +1,43 @@
+--- a/libs/esl/python/Makefile
++++ b/libs/esl/python/Makefile
+@@ -1,6 +1,4 @@
+-LOCAL_CFLAGS=`python ./python-config --includes`
+-LOCAL_LDFLAGS=`python ./python-config --ldflags`
+-SITE_DIR=$(DESTDIR)/`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)"`
++SITE_DIR=$(DESTDIR)/$(PYTHON_SITE_DIR)
+ all: _ESL.so
+@@ -8,10 +6,10 @@ esl_wrap.cpp:
+       swig2.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) $(PYTHON_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) $(PYTHON_LDFLAGS) -o _ESL.so -L. $(LIBS)
+ install: _ESL.so
+       mkdir -p $(SITE_DIR)
+--- a/libs/esl/Makefile.am
++++ b/libs/esl/Makefile.am
+@@ -77,7 +77,7 @@ luamod: $(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)" LUA_CFLAGS="$(LUA_CFLAGS)" LUA_LIBS="$(LUA_LIBS)" -C lua
+ pymod: $(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 python
++      $(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)" PYTHON_CFLAGS="$(PYTHON_CFLAGS)" PYTHON_LDFLAGS="$(PYTHON_LDFLAGS)" -C python
+ 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
+@@ -98,7 +98,7 @@ phpmod-install: phpmod
+       $(MAKE) -C php install
+ pymod-install: pymod
+-      $(MAKE) -C python install
++      $(MAKE) PYTHON_SITE_DIR="$(PYTHON_SITE_DIR)" -C python install
+ rubymod-install: rubymod
+       $(MAKE) -C ruby install