From f780db14453bc8b868912b9936b9f3462e7417c3 Mon Sep 17 00:00:00 2001 From: Mazi Lo Date: Sat, 26 Mar 2016 18:20:35 -0400 Subject: [PATCH] [FreeSWITCH]: Update patched files for musl -- Signed-off-by: Mazi Lo --- net/freeswitch/patches/musl/Makefile_am.patch | 11 +++ .../patches/musl/build-modules_conf_in.patch | 2 +- .../patches/musl/configure_ac.patch | 92 +++++++++++++++++-- .../patches/musl/libs-apr-configure_ac.patch | 42 ++++++++- ...autoload_configs-http_cache_conf_xml.patch | 11 +++ ...points-mod_sofia-conf-sofia_conf_xml.patch | 11 +++ ...mod-languages-mod_python-Makefile_am.patch | 11 +++ ...ges-mod_python-freeswitch_python_cpp.patch | 15 +++ 8 files changed, 183 insertions(+), 12 deletions(-) create mode 100644 net/freeswitch/patches/musl/Makefile_am.patch create mode 100644 net/freeswitch/patches/musl/src-mod-applications-mod_http_cache-conf-autoload_configs-http_cache_conf_xml.patch create mode 100644 net/freeswitch/patches/musl/src-mod-endpoints-mod_sofia-conf-sofia_conf_xml.patch create mode 100644 net/freeswitch/patches/musl/src-mod-languages-mod_python-Makefile_am.patch create mode 100644 net/freeswitch/patches/musl/src-mod-languages-mod_python-freeswitch_python_cpp.patch diff --git a/net/freeswitch/patches/musl/Makefile_am.patch b/net/freeswitch/patches/musl/Makefile_am.patch new file mode 100644 index 0000000..6689883 --- /dev/null +++ b/net/freeswitch/patches/musl/Makefile_am.patch @@ -0,0 +1,11 @@ +--- a/Makefile.am ++++ b/Makefile.am +@@ -533,7 +533,7 @@ libs/libzrtp/libzrtp.a: + cd libs/libzrtp && $(MAKE) + + libs/libvpx/Makefile: +- cd libs/libvpx && CC=$(CC) CXX=$(CXX) CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure --enable-pic --disable-docs --disable-examples --disable-install-bins --disable-install-srcs --disable-unit-tests --extra-cflags="-fvisibility=hidden" ++ cd libs/libvpx && CC=$(CC) CXX=$(CXX) CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" CROSS=$(ARCH)-openwrt-linux LD=$(CXX) ./configure --target=generic-gnu --enable-pic --disable-docs --disable-examples --disable-install-bins --disable-install-srcs --disable-unit-tests --extra-cflags="-fvisibility=hidden" + + libs/libvpx/libvpx.a: libs/libvpx/Makefile + @cd libs/libvpx && $(MAKE) diff --git a/net/freeswitch/patches/musl/build-modules_conf_in.patch b/net/freeswitch/patches/musl/build-modules_conf_in.patch index 9db0e8e..86aad26 100644 --- a/net/freeswitch/patches/musl/build-modules_conf_in.patch +++ b/net/freeswitch/patches/musl/build-modules_conf_in.patch @@ -1,6 +1,6 @@ --- a/build/modules.conf.in +++ b/build/modules.conf.in -@@ -38,6 +38,7 @@ applications/mod_httapi +@@ -39,6 +39,7 @@ applications/mod_httapi #applications/mod_rad_auth #applications/mod_redis #applications/mod_rss diff --git a/net/freeswitch/patches/musl/configure_ac.patch b/net/freeswitch/patches/musl/configure_ac.patch index 5a47835..a69a12b 100644 --- a/net/freeswitch/patches/musl/configure_ac.patch +++ b/net/freeswitch/patches/musl/configure_ac.patch @@ -1,34 +1,37 @@ --- a/configure.ac +++ b/configure.ac -@@ -254,7 +254,7 @@ AX_COMPILER_VENDOR +@@ -257,9 +257,9 @@ AX_COMPILER_VENDOR if test "x${cross_compiling}" = "xyes"; then CC_FOR_BUILD=${CC_FOR_BUILD-gcc} case "$host" in - arm*-linux-gnueabi*|arm*-*-linux-gnueabi*) + arm*-linux-gnueabi*|arm*-*-linux-*) # spandsp modem - ac_cv_file__dev_ptmx=yes +- ac_cv_file__dev_ptmx=yes ++ ac_cv_file__dev_ptmx=no # libjs -@@ -273,7 +273,7 @@ if test "x${cross_compiling}" = "xyes"; + export ac_cv_va_copy=yes + # srtp +@@ -276,7 +276,7 @@ if test "x${cross_compiling}" = "xyes"; 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_process_shared_works=no ++ #export apr_cv_process_shared_works=no export apr_cv_mutex_robust_shared=yes ;; esac -@@ -405,9 +405,6 @@ elif test "x${ax_cv_c_compiler_vendor}" - elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then +@@ -409,9 +409,6 @@ elif test "x${ax_cv_c_compiler_vendor}" APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC) APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC) + AC_SUBST([AM_MOD_AVMD_CXXFLAGS], [-std=gnu99]) # FS-8809, needed for MAP_POPULATE - if test "$ac_cv_gcc_supports_w_no_unused_result" = yes; then - APR_ADDTO(SWITCH_AM_CFLAGS, -Werror) - fi if test "${enable_64}" = "yes"; then case "$host" in *darwin*) -@@ -901,7 +898,6 @@ AC_CHECK_LIB(pthread, pthread_setschedpa +@@ -912,7 +909,6 @@ AC_CHECK_LIB(pthread, pthread_setschedpa AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket)) @@ -36,7 +39,7 @@ AC_CHECK_LIB(util, openpty, [AC_DEFINE(HAVE_OPENPTY, 1, [Define if you have openpty()])]) AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[ -@@ -1474,14 +1470,14 @@ AM_CONDITIONAL([HAVE_MYSQL],[test "$foun +@@ -1487,16 +1483,16 @@ AM_CONDITIONAL([HAVE_MYSQL],[test "$foun # perl checks # @@ -53,9 +56,12 @@ + PERL_SITEDIR="`$PERL -MConfig -e 'print $Config{archlibexp}'`" + PERL_LIBDIR="-L`$PERL -MConfig -e 'print $Config{archlibexp}'`/CORE" PERL_LIBS="`$PERL -MConfig -e 'print $Config{libs}'`" - PERL_CFLAGS="-w -DMULTIPLICITY `$PERL -MExtUtils::Embed -e ccopts | sed -e 's|-arch x86_64 -arch i386||'` -DEMBED_PERL" +- PERL_CFLAGS="-w -DMULTIPLICITY `$PERL -MExtUtils::Embed -e ccopts | sed -e 's|-arch x86_64 -arch i386||'` -DEMBED_PERL" ++ PERL_CFLAGS="-w -DMULTIPLICITY `$PERL -MExtUtils::Embed -e ccopts | sed -e 's| -I/usr/local/include||g'` -DEMBED_PERL" PERL_LDFLAGS="`$PERL -MExtUtils::Embed -e ldopts| sed -e 's|-arch x86_64 -arch i386||'`" -@@ -1498,6 +1494,7 @@ if test "x$ac_cv_have_perl" != "xno"; th + PERL_INC="`$PERL -MExtUtils::Embed -e perl_inc`" + +@@ -1511,6 +1507,7 @@ if test "x$ac_cv_have_perl" != "xno"; th AC_CHECK_LIB([perl], [perl_alloc], ac_cv_use_libperl=yes, ac_cv_use_libperl=no) LDFLAGS="$save_LDFLAGS" @@ -63,3 +69,69 @@ AC_SUBST(PERL_SITEDIR) AC_SUBST(PERL_LIBDIR) AC_SUBST(PERL_LIBS) +@@ -1526,16 +1523,16 @@ AM_CONDITIONAL([HAVE_PERL],[test "x$ac_c + # + + AC_CHECK_PROG(PHP,php,[ac_cv_have_php=yes],[ac_cv_have_php=no]) +-AC_CHECK_PROG(PHP_CONFIG,php-config,[ac_cv_have_php_config=yes],[ac_cv_have_php_config=no]) ++AC_CHECK_PROG(PHP_CONFIG,php-config,[ac_cv_have_php_config=yes],[ac_cv_have_php_config=no],[${STAGING_DIR}/host/usr/bin]) + AM_CONDITIONAL([HAVE_PHP],[test "x$ac_cv_have_php" != "xno" -a "x$ac_cv_have_php_config" != "xno"]) + + if test "x$ac_cv_have_php" != "xno" -a "x$ac_cv_have_php_config" != "xno"; then + PHP=php +- PHP_CONFIG=php-config ++ PHP_CONFIG=${STAGING_DIR}/host/usr/bin/php-config + PHP_LDFLAGS="`$PHP_CONFIG --ldflags`" + PHP_LIBS="`$PHP_CONFIG --libs | sed -r 's/ ?-l(bz2|pcre|xml2|gssapi_krb5|krb5|k5crypto|com_err|history|z|readline|gmp|ssl|crypto)//g'`" + PHP_EXT_DIR="`$PHP_CONFIG --extension-dir`" +- PHP_INC_DIR="`$PHP -r 'echo ini_get("include_path");' | cut -d: -f2`" ++ PHP_INC_DIR="`$PHP_CONFIG --includes | cut -d" " -f1 | cut -dI -f2`" + PHP_INI_DIR="`$PHP_CONFIG --configure-options | tr " " "\n" | grep -- --with-config-file-scan-dir | cut -f2 -d=`" + PHP_CFLAGS="`$PHP_CONFIG --includes`" + AC_SUBST(PHP_LDFLAGS) +@@ -1569,12 +1566,12 @@ then + AC_MSG_RESULT([$with_python]) + AC_SUBST([PYTHON], ["$with_python"]) + else +- AC_PATH_PROG([PYTHON], ["python"], ["no"], ["$PATH:/usr/bin:/usr/local/bin"]) ++ AC_PATH_PROG([PYTHON], ["python3"], ["no"], ["$PATH:${STAGING_DIR}/host/bin:/usr/bin:/usr/local/bin"]) + fi + + if test "$PYTHON" != "no" ; then + AC_MSG_CHECKING([python version]) +- PYTHON_VER="`$PYTHON -V 2>&1 | cut -d' ' -f2`" ++ PYTHON_VER=`$PYTHON -c "import sys; print('%d.%d' % (sys.version_info[[0]], sys.version_info[[1]]))"` + + if test -z "$PYTHON_VER" ; then + AC_MSG_ERROR([Unable to detect python version]) +@@ -1593,12 +1590,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 -d "`$PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(0));'`" ; then ++ PYTHON_SITE_DIR="`$PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(0));' | sed -e 's|\(^.*\)/host|/usr|g'`" + +- 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!]) ++ if test -z "$PYTHON_SITE_DIR" ; then ++ AC_MSG_ERROR([Unable to detect python site-packages path]) ++ fi + fi + AC_MSG_RESULT([$PYTHON_SITE_DIR]) + AC_SUBST([PYTHON_SITE_DIR], [$PYTHON_SITE_DIR]) +@@ -1606,10 +1603,10 @@ then + # + # 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_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|host|usr|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\"));'`" ++ PYTHON_LIBDIR="`$PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_config_var(\"LIBDIR\"));' | sed -e 's|host|usr|g'`" + + # handle python being installed into /usr/local + AC_MSG_CHECKING([python libdir]) diff --git a/net/freeswitch/patches/musl/libs-apr-configure_ac.patch b/net/freeswitch/patches/musl/libs-apr-configure_ac.patch index c4667dd..7c0630f 100644 --- a/net/freeswitch/patches/musl/libs-apr-configure_ac.patch +++ b/net/freeswitch/patches/musl/libs-apr-configure_ac.patch @@ -1,6 +1,46 @@ --- a/libs/apr/configure.ac +++ b/libs/apr/configure.ac -@@ -1956,7 +1956,11 @@ fi +@@ -1624,38 +1624,7 @@ if test "$threads" = "1"; then + APR_CHECK_DEFINE(PTHREAD_PROCESS_SHARED, pthread.h) + AC_CHECK_FUNCS(pthread_mutexattr_setpshared) + AC_CHECK_LIB(pthread, pthread_setschedparam, [AC_DEFINE(HAVE_PTHREAD_SETSCHEDPARAM, 1, [Define if you have pthread_setschedparam()])]) +- +- # Some systems have setpshared and define PROCESS_SHARED, but don't +- # really support PROCESS_SHARED locks. So, we must validate that we +- # can go through the steps without receiving some sort of system error. +- # Linux and older versions of AIX have this problem. +- APR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED func:pthread_mutexattr_setpshared, [ +- AC_CACHE_CHECK([for working PROCESS_SHARED locks], apr_cv_process_shared_works, [ +- AC_TRY_RUN([ +-#include +-#include +- int main() +- { +- pthread_mutex_t mutex; +- pthread_mutexattr_t attr; +- if (pthread_mutexattr_init(&attr)) +- exit(1); +- if (pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED)) +- exit(2); +- if (pthread_mutex_init(&mutex, &attr)) +- exit(3); +- if (pthread_mutexattr_destroy(&attr)) +- exit(4); +- if (pthread_mutex_destroy(&mutex)) +- exit(5); +- exit(0); +- }], [apr_cv_process_shared_works=yes], [apr_cv_process_shared_works=no])]) +- # Override detection of pthread_mutexattr_setpshared +- ac_cv_func_pthread_mutexattr_setpshared=$apr_cv_process_shared_works]) +- +- if test "$ac_cv_func_pthread_mutexattr_setpshared" = "yes"; then +- APR_CHECK_PTHREAD_ROBUST_SHARED_MUTEX +- fi ++ APR_CHECK_PTHREAD_ROBUST_SHARED_MUTEX + fi + + # See which lock mechanisms we can support on this system. +@@ -1956,7 +1925,11 @@ fi APR_CHECK_TCP_NODELAY_INHERITED APR_CHECK_O_NONBLOCK_INHERITED diff --git a/net/freeswitch/patches/musl/src-mod-applications-mod_http_cache-conf-autoload_configs-http_cache_conf_xml.patch b/net/freeswitch/patches/musl/src-mod-applications-mod_http_cache-conf-autoload_configs-http_cache_conf_xml.patch new file mode 100644 index 0000000..d1a6715 --- /dev/null +++ b/net/freeswitch/patches/musl/src-mod-applications-mod_http_cache-conf-autoload_configs-http_cache_conf_xml.patch @@ -0,0 +1,11 @@ +--- a/src/mod/applications/mod_http_cache/conf/autoload_configs/http_cache.conf.xml ++++ b/src/mod/applications/mod_http_cache/conf/autoload_configs/http_cache.conf.xml +@@ -9,7 +9,7 @@ + + + +- + + + diff --git a/net/freeswitch/patches/musl/src-mod-endpoints-mod_sofia-conf-sofia_conf_xml.patch b/net/freeswitch/patches/musl/src-mod-endpoints-mod_sofia-conf-sofia_conf_xml.patch new file mode 100644 index 0000000..78db028 --- /dev/null +++ b/net/freeswitch/patches/musl/src-mod-endpoints-mod_sofia-conf-sofia_conf_xml.patch @@ -0,0 +1,11 @@ +--- a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml ++++ b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml +@@ -216,7 +216,7 @@ + + + +- + + + diff --git a/net/freeswitch/patches/musl/src-mod-languages-mod_python-Makefile_am.patch b/net/freeswitch/patches/musl/src-mod-languages-mod_python-Makefile_am.patch new file mode 100644 index 0000000..7ce0878 --- /dev/null +++ b/net/freeswitch/patches/musl/src-mod-languages-mod_python-Makefile_am.patch @@ -0,0 +1,11 @@ +--- a/src/mod/languages/mod_python/Makefile.am ++++ b/src/mod/languages/mod_python/Makefile.am +@@ -20,7 +20,7 @@ swigclean: clean + rm -f mod_python_wrap.* freeswitch.py + + mod_python_wrap.cpp: mod_python_extra.c hack.diff +- swig2.0 -python -c++ -I../../../../src/include -oh mod_python_wrap.h -o mod_python_wrap.cpp mod_python.i ++ ${STAGING_DIR}/host/bin/swig -python -c++ -I../../../../src/include -oh mod_python_wrap.h -o mod_python_wrap.cpp mod_python.i + echo "#include \"mod_python_extra.c\"" >> mod_python_wrap.cpp + patch -s -p0 -i hack.diff + diff --git a/net/freeswitch/patches/musl/src-mod-languages-mod_python-freeswitch_python_cpp.patch b/net/freeswitch/patches/musl/src-mod-languages-mod_python-freeswitch_python_cpp.patch new file mode 100644 index 0000000..9d509c8 --- /dev/null +++ b/net/freeswitch/patches/musl/src-mod-languages-mod_python-freeswitch_python_cpp.patch @@ -0,0 +1,15 @@ +--- a/src/mod/languages/mod_python/freeswitch_python.cpp ++++ b/src/mod/languages/mod_python/freeswitch_python.cpp +@@ -319,7 +319,12 @@ switch_status_t Session::run_dtmf_callba + } + + if ((pyresult = PyEval_CallObject(cb_function, arglist))) { ++#if PY_MAJOR_VERSION < 3 + str = (char *) PyString_AsString(pyresult); ++#else ++ //str = (char *) pyresult->encode('UTF-8'); ++ str = (char *) PyUnicode_AsUnicode(pyresult); ++#endif + } else { + PyErr_Print(); + } -- 2.30.2