<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/17838">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">bundled_pjproject:  Make it easier to hack<br><br>There are times when you need to troubleshoot issues with bundled<br>pjproject or add new features that need to be pushed upstream<br>but...<br><br>* The source directory created by extracting the pjproject tarball<br>  is not scanned for code changes so you have to keep forcing<br>  rebuilds.<br>* The source directory isn't a git repo so you can't easily create<br>  patches, do git bisects, etc.<br>* Accidentally doing a make distclean will ruin your day by wiping<br>  out the source directory, and your changes.<br>* etc.<br><br>This commit makes that easier.<br>See third-party/pjproject/README-hacking.md for the details.<br><br>ASTERISK-29824<br><br>Change-Id: Idb1251040affdab31d27cd272dda68676da9b268<br>---<br>M configure<br>M configure.ac<br>A doc/CHANGES-staging/bundled-pjproject-build.txt<br>M include/asterisk/autoconfig.h.in<br>M makeopts.in<br>M res/res_pjproject.c<br>M third-party/Makefile<br>M third-party/Makefile.rules<br>M third-party/apply_patches<br>M third-party/jansson/Makefile<br>M third-party/pjproject/.gitignore<br>M third-party/pjproject/Makefile<br>M third-party/pjproject/Makefile.rules<br>A third-party/pjproject/README-hacking.md<br>M third-party/pjproject/configure.m4<br>A third-party/pjproject/dependency_utils<br>16 files changed, 546 insertions(+), 65 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/configure b/configure</span><br><span>index 6f0a273..d701af6 100755</span><br><span>--- a/configure</span><br><span>+++ b/configure</span><br><span>@@ -1157,6 +1157,7 @@</span><br><span> PJPROJECT_LIB</span><br><span> PBX_PJPROJECT</span><br><span> PJPROJECT_DIR</span><br><span style="color: hsl(120, 100%, 40%);">+PJPROJECT_BUNDLED_OOT</span><br><span> PJPROJECT_BUNDLED</span><br><span> PJPROJECT_CONFIGURE_OPTS</span><br><span> JANSSON_INCLUDE</span><br><span>@@ -1210,6 +1211,7 @@</span><br><span> DOWNLOAD_TO_STDOUT</span><br><span> DOWNLOAD</span><br><span> FETCH</span><br><span style="color: hsl(120, 100%, 40%);">+REALPATH</span><br><span> NM</span><br><span> PATCH</span><br><span> TAR</span><br><span>@@ -7607,6 +7609,48 @@</span><br><span> fi</span><br><span> </span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+# Extract the first word of "realpath", so it can be a program name with args.</span><br><span style="color: hsl(120, 100%, 40%);">+set dummy realpath; ac_word=$2</span><br><span style="color: hsl(120, 100%, 40%);">+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5</span><br><span style="color: hsl(120, 100%, 40%);">+$as_echo_n "checking for $ac_word... " >&6; }</span><br><span style="color: hsl(120, 100%, 40%);">+if ${ac_cv_path_REALPATH+:} false; then :</span><br><span style="color: hsl(120, 100%, 40%);">+  $as_echo_n "(cached) " >&6</span><br><span style="color: hsl(120, 100%, 40%);">+else</span><br><span style="color: hsl(120, 100%, 40%);">+  case $REALPATH in</span><br><span style="color: hsl(120, 100%, 40%);">+  [\\/]* | ?:[\\/]*)</span><br><span style="color: hsl(120, 100%, 40%);">+  ac_cv_path_REALPATH="$REALPATH" # Let the user override the test with a path.</span><br><span style="color: hsl(120, 100%, 40%);">+  ;;</span><br><span style="color: hsl(120, 100%, 40%);">+  *)</span><br><span style="color: hsl(120, 100%, 40%);">+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR</span><br><span style="color: hsl(120, 100%, 40%);">+for as_dir in $PATH</span><br><span style="color: hsl(120, 100%, 40%);">+do</span><br><span style="color: hsl(120, 100%, 40%);">+  IFS=$as_save_IFS</span><br><span style="color: hsl(120, 100%, 40%);">+  test -z "$as_dir" && as_dir=.</span><br><span style="color: hsl(120, 100%, 40%);">+    for ac_exec_ext in '' $ac_executable_extensions; do</span><br><span style="color: hsl(120, 100%, 40%);">+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then</span><br><span style="color: hsl(120, 100%, 40%);">+    ac_cv_path_REALPATH="$as_dir/$ac_word$ac_exec_ext"</span><br><span style="color: hsl(120, 100%, 40%);">+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5</span><br><span style="color: hsl(120, 100%, 40%);">+    break 2</span><br><span style="color: hsl(120, 100%, 40%);">+  fi</span><br><span style="color: hsl(120, 100%, 40%);">+done</span><br><span style="color: hsl(120, 100%, 40%);">+  done</span><br><span style="color: hsl(120, 100%, 40%);">+IFS=$as_save_IFS</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  test -z "$ac_cv_path_REALPATH" && ac_cv_path_REALPATH=":"</span><br><span style="color: hsl(120, 100%, 40%);">+  ;;</span><br><span style="color: hsl(120, 100%, 40%);">+esac</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+REALPATH=$ac_cv_path_REALPATH</span><br><span style="color: hsl(120, 100%, 40%);">+if test -n "$REALPATH"; then</span><br><span style="color: hsl(120, 100%, 40%);">+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $REALPATH" >&5</span><br><span style="color: hsl(120, 100%, 40%);">+$as_echo "$REALPATH" >&6; }</span><br><span style="color: hsl(120, 100%, 40%);">+else</span><br><span style="color: hsl(120, 100%, 40%);">+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5</span><br><span style="color: hsl(120, 100%, 40%);">+$as_echo "no" >&6; }</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> </span><br><span> DOWNLOAD=":"</span><br><span> DOWNLOAD_TO_STDOUT=</span><br><span>@@ -9973,6 +10017,14 @@</span><br><span>           if test "${GREP}" = ":" ; then</span><br><span>                   as_fn_error $? "grep is required to build bundled pjproject" "$LINENO" 5</span><br><span>                 fi</span><br><span style="color: hsl(120, 100%, 40%);">+            if test "${FIND}" = ":" ; then</span><br><span style="color: hsl(120, 100%, 40%);">+                    as_fn_error $? "find is required to build bundled pjproject" "$LINENO" 5</span><br><span style="color: hsl(120, 100%, 40%);">+          fi</span><br><span style="color: hsl(120, 100%, 40%);">+            if test "x${AST_DEVMODE}" != "x" ; then</span><br><span style="color: hsl(120, 100%, 40%);">+                   if test "${REALPATH}" = ":" ; then</span><br><span style="color: hsl(120, 100%, 40%);">+                                as_fn_error $? "realpath is required to build bundled pjproject in dev mode" "$LINENO" 5</span><br><span style="color: hsl(120, 100%, 40%);">+                  fi</span><br><span style="color: hsl(120, 100%, 40%);">+            fi</span><br><span> </span><br><span> </span><br><span>           this_host=$(./config.sub $(./config.guess))</span><br><span>@@ -10000,11 +10052,20 @@</span><br><span>                      esac</span><br><span>                 fi</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-          export TAR PATCH SED NM EXTERNALS_CACHE_DIR AST_DOWNLOAD_CACHE DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT CUT GREP</span><br><span style="color: hsl(120, 100%, 40%);">+          # Determine if we're doing an out-of-tree build...</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+              if test -L ${PJPROJECT_DIR}/source -o -d ${PJPROJECT_DIR}/source/.git ; then</span><br><span style="color: hsl(120, 100%, 40%);">+                  $as_echo "#define HAVE_PJPROJECT_BUNDLED_OOT 1" >>confdefs.h</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                        PJPROJECT_BUNDLED_OOT=yes</span><br><span style="color: hsl(120, 100%, 40%);">+             fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+          export TAR PATCH SED NM EXTERNALS_CACHE_DIR AST_DOWNLOAD_CACHE DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT CUT GREP FIND REALPATH</span><br><span>           export NOISY_BUILD AST_DEVMODE</span><br><span>               ${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} \</span><br><span>                       PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" \</span><br><span>                     EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" \</span><br><span style="color: hsl(120, 100%, 40%);">+                       PJPROJECT_BUNDLED_OOT="${PJPROJECT_BUNDLED_OOT}" \</span><br><span>                         configure</span><br><span>            if test $? -ne 0 ; then</span><br><span>                      { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5</span><br><span>@@ -10017,7 +10078,11 @@</span><br><span>             { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bundled pjproject" >&5</span><br><span> $as_echo_n "checking for bundled pjproject... " >&6; }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-            PJPROJECT_INCLUDE=$(${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" echo_cflags)</span><br><span style="color: hsl(120, 100%, 40%);">+            PJPROJECT_INCLUDE=$(${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} \</span><br><span style="color: hsl(120, 100%, 40%);">+                    PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" \</span><br><span style="color: hsl(120, 100%, 40%);">+                      EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" \</span><br><span style="color: hsl(120, 100%, 40%);">+                       PJPROJECT_BUNDLED_OOT="${PJPROJECT_BUNDLED_OOT}" \</span><br><span style="color: hsl(120, 100%, 40%);">+                  echo_cflags)</span><br><span>                 PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE"</span><br><span>              PBX_PJPROJECT=1</span><br><span> </span><br><span>@@ -10083,6 +10148,7 @@</span><br><span> </span><br><span> </span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>          { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5</span><br><span> $as_echo "yes" >&6; }</span><br><span> </span><br><span>@@ -23048,8 +23114,8 @@</span><br><span>    if test "x${PBX_NETSNMP}" != "x1" -a "${USE_NETSNMP}" != "no"; then</span><br><span> </span><br><span> pkg_failed=no</span><br><span style="color: hsl(0, 100%, 40%);">-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for netsnmp-agent" >&5</span><br><span style="color: hsl(0, 100%, 40%);">-$as_echo_n "checking for netsnmp-agent... " >&6; }</span><br><span style="color: hsl(120, 100%, 40%);">+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for NETSNMP" >&5</span><br><span style="color: hsl(120, 100%, 40%);">+$as_echo_n "checking for NETSNMP... " >&6; }</span><br><span> </span><br><span> if test -n "$NETSNMP_CFLAGS"; then</span><br><span>     pkg_cv_NETSNMP_CFLAGS="$NETSNMP_CFLAGS"</span><br><span>@@ -23089,7 +23155,7 @@</span><br><span> </span><br><span> </span><br><span> if test $pkg_failed = yes; then</span><br><span style="color: hsl(0, 100%, 40%);">-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5</span><br><span style="color: hsl(120, 100%, 40%);">+          { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5</span><br><span> $as_echo "no" >&6; }</span><br><span> </span><br><span> if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then</span><br><span>@@ -23110,7 +23176,7 @@</span><br><span> </span><br><span> </span><br><span> elif test $pkg_failed = untried; then</span><br><span style="color: hsl(0, 100%, 40%);">-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5</span><br><span style="color: hsl(120, 100%, 40%);">+           { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5</span><br><span> $as_echo "no" >&6; }</span><br><span> </span><br><span>             PBX_NETSNMP=0</span><br><span>diff --git a/configure.ac b/configure.ac</span><br><span>index 9bae413..b175ef0 100644</span><br><span>--- a/configure.ac</span><br><span>+++ b/configure.ac</span><br><span>@@ -285,6 +285,8 @@</span><br><span> AC_PATH_PROG([PATCH], [patch], :)</span><br><span> AC_PATH_PROG([SED], [sed], :)</span><br><span> AC_PATH_PROG([NM], [nm], :)</span><br><span style="color: hsl(120, 100%, 40%);">+AC_PATH_PROG([REALPATH], [realpath], :)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> </span><br><span> DOWNLOAD=":"</span><br><span> DOWNLOAD_TO_STDOUT=</span><br><span>diff --git a/doc/CHANGES-staging/bundled-pjproject-build.txt b/doc/CHANGES-staging/bundled-pjproject-build.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..976c0f5</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/bundled-pjproject-build.txt</span><br><span>@@ -0,0 +1,8 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: Core</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Bundled PJProject Build</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+The build process has been updated to make pjproject troubleshooting</span><br><span style="color: hsl(120, 100%, 40%);">+and development easier. See third-party/pjproject/README-hacking.md or</span><br><span style="color: hsl(120, 100%, 40%);">+https://wiki.asterisk.org/wiki/display/AST/Bundled+PJProject</span><br><span style="color: hsl(120, 100%, 40%);">+for more info.</span><br><span>diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in</span><br><span>index ff1f537..8ffa9ca 100644</span><br><span>--- a/include/asterisk/autoconfig.h.in</span><br><span>+++ b/include/asterisk/autoconfig.h.in</span><br><span>@@ -609,6 +609,9 @@</span><br><span> /* Define if your system has PJPROJECT_BUNDLED */</span><br><span> #undef HAVE_PJPROJECT_BUNDLED</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* Define if doing a bundled pjproject out-of-tree build. */</span><br><span style="color: hsl(120, 100%, 40%);">+#undef HAVE_PJPROJECT_BUNDLED_OOT</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* Define to 1 if on_valid_pair callback is present. */</span><br><span> #undef HAVE_PJPROJECT_ON_VALID_ICE_PAIR_CALLBACK</span><br><span> </span><br><span>diff --git a/makeopts.in b/makeopts.in</span><br><span>index 210ac76..77bc974 100644</span><br><span>--- a/makeopts.in</span><br><span>+++ b/makeopts.in</span><br><span>@@ -228,6 +228,7 @@</span><br><span> PGSQL_LIB=@PGSQL_LIB@</span><br><span> </span><br><span> PJPROJECT_BUNDLED=@PJPROJECT_BUNDLED@</span><br><span style="color: hsl(120, 100%, 40%);">+PJPROJECT_BUNDLED_OOT=@PJPROJECT_BUNDLED_OOT@</span><br><span> PJPROJECT_INCLUDE=@PJPROJECT_INCLUDE@</span><br><span> PJPROJECT_LIB=@PJPROJECT_LIB@</span><br><span> PJPROJECT_DIR=@PJPROJECT_DIR@</span><br><span>diff --git a/res/res_pjproject.c b/res/res_pjproject.c</span><br><span>index 4047aca..9bd053b 100644</span><br><span>--- a/res/res_pjproject.c</span><br><span>+++ b/res/res_pjproject.c</span><br><span>@@ -489,7 +489,7 @@</span><br><span>      if (addr->ss.ss_family == AF_INET) {</span><br><span>              struct sockaddr_in *sin = (struct sockaddr_in *) &addr->ss;</span><br><span>           pjaddr->ipv4.sin_family = pj_AF_INET();</span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef HAVE_PJPROJECT_BUNDLED</span><br><span style="color: hsl(120, 100%, 40%);">+#if defined(HAVE_PJPROJECT_BUNDLED) && !defined(HAVE_PJPROJECT_BUNDLED_OOT)</span><br><span>                 pjaddr->ipv4.sin_addr = sin->sin_addr;</span><br><span> #else</span><br><span>                pjaddr->ipv4.sin_addr.s_addr = sin->sin_addr.s_addr;</span><br><span>@@ -514,7 +514,7 @@</span><br><span>     if (pjaddr->addr.sa_family == pj_AF_INET()) {</span><br><span>             struct sockaddr_in *sin = (struct sockaddr_in *) &addr->ss;</span><br><span>           sin->sin_family = AF_INET;</span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef HAVE_PJPROJECT_BUNDLED</span><br><span style="color: hsl(120, 100%, 40%);">+#if defined(HAVE_PJPROJECT_BUNDLED) && !defined(HAVE_PJPROJECT_BUNDLED_OOT)</span><br><span>              sin->sin_addr = pjaddr->ipv4.sin_addr;</span><br><span> #else</span><br><span>                sin->sin_addr.s_addr = pjaddr->ipv4.sin_addr.s_addr;</span><br><span>diff --git a/third-party/Makefile b/third-party/Makefile</span><br><span>index 7b2afda..e87e26f 100644</span><br><span>--- a/third-party/Makefile</span><br><span>+++ b/third-party/Makefile</span><br><span>@@ -11,9 +11,8 @@</span><br><span> override MAKECMDGOALS?=all</span><br><span> </span><br><span> MAKECMDGOALS:=$(subst dist-clean,distclean,$(MAKECMDGOALS))</span><br><span style="color: hsl(0, 100%, 40%);">-MAKECMDGOALS:=$(subst tpclean,clean,$(MAKECMDGOALS))</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-all distclean dist-clean install uninstall tpclean : $(TP_SUBDIRS)</span><br><span style="color: hsl(120, 100%, 40%);">+all distclean dist-clean install uninstall clean : $(TP_SUBDIRS)</span><br><span> install uninstall: $(TP_INSTALL_SUBDIRS)</span><br><span> </span><br><span> $(TP_SUBDIRS):</span><br><span>diff --git a/third-party/Makefile.rules b/third-party/Makefile.rules</span><br><span>index f02ddb1..9e4925e 100644</span><br><span>--- a/third-party/Makefile.rules</span><br><span>+++ b/third-party/Makefile.rules</span><br><span>@@ -13,6 +13,9 @@</span><br><span> REALLY_QUIET=</span><br><span> endif</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+# The following exports are set during a configure but if</span><br><span style="color: hsl(120, 100%, 40%);">+# it hasn't been run yet, we'll set some defaults</span><br><span style="color: hsl(120, 100%, 40%);">+# to be able to still allow clean and distclean to run</span><br><span> export SUBMAKE</span><br><span> export ECHO_PREFIX</span><br><span> export CMD_PREFIX</span><br><span>@@ -24,12 +27,16 @@</span><br><span> export ASTDATADIR</span><br><span> export TAR</span><br><span> export PATCH</span><br><span style="color: hsl(0, 100%, 40%);">-export SED</span><br><span style="color: hsl(120, 100%, 40%);">+export SED ?= sed</span><br><span> export NM</span><br><span> export MD5</span><br><span> export CAT</span><br><span> export CUT</span><br><span style="color: hsl(0, 100%, 40%);">-export GREP</span><br><span style="color: hsl(120, 100%, 40%);">+export GREP ?= grep</span><br><span style="color: hsl(120, 100%, 40%);">+export FIND ?= find</span><br><span style="color: hsl(120, 100%, 40%);">+export REALPATH ?= realpath</span><br><span style="color: hsl(120, 100%, 40%);">+export BASENAME ?= basename</span><br><span style="color: hsl(120, 100%, 40%);">+export DIRNAME ?= dirname</span><br><span> export DOWNLOAD</span><br><span> export DOWNLOAD_TO_STDOUT</span><br><span> export DOWNLOAD_TIMEOUT</span><br><span>diff --git a/third-party/apply_patches b/third-party/apply_patches</span><br><span>index 23323fb..3c0a6bc 100755</span><br><span>--- a/third-party/apply_patches</span><br><span>+++ b/third-party/apply_patches</span><br><span>@@ -6,6 +6,7 @@</span><br><span> fi</span><br><span> </span><br><span> PATCH=${PATCH:-patch}</span><br><span style="color: hsl(120, 100%, 40%);">+FIND=${FIND:-find}</span><br><span> </span><br><span> patchdir=${1:?You must supply a patches directory}</span><br><span> sourcedir=${2?:You must supply a source directory}</span><br><span>@@ -20,12 +21,13 @@</span><br><span>       exit 1</span><br><span> fi</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-if [ ! "$(ls -A $patchdir/*.patch 2>/dev/null)" ] ; then</span><br><span style="color: hsl(120, 100%, 40%);">+patches=$(${FIND} "$patchdir" -name "*.patch")</span><br><span style="color: hsl(120, 100%, 40%);">+if [ x"$patches" = x"" ] ; then</span><br><span>       echo "No patches in $patchdir"  >&2</span><br><span>         exit 0</span><br><span> fi</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-for patchfile in "$patchdir"/*.patch ; do</span><br><span style="color: hsl(120, 100%, 40%);">+for patchfile in ${patches} ; do</span><br><span>        [ -z $quiet ] && echo "Applying patch $(basename $patchfile)"</span><br><span>      ${PATCH} -d "$sourcedir" -p1 -s -i "$patchfile" || exit 1</span><br><span> done</span><br><span>diff --git a/third-party/jansson/Makefile b/third-party/jansson/Makefile</span><br><span>index 8c9da1a..f24a1c6 100644</span><br><span>--- a/third-party/jansson/Makefile</span><br><span>+++ b/third-party/jansson/Makefile</span><br><span>@@ -96,7 +96,7 @@</span><br><span> </span><br><span> clean:</span><br><span>         $(ECHO_PREFIX) Cleaning</span><br><span style="color: hsl(0, 100%, 40%);">- +-$(CMD_PREFIX) test -d source dest && $(SUBMAKE) -C source clean || :</span><br><span style="color: hsl(120, 100%, 40%);">+        +-$(CMD_PREFIX) test -d source && $(SUBMAKE) -C source clean $(REALLY_QUIET) || :</span><br><span> </span><br><span> distclean:</span><br><span>  $(ECHO_PREFIX) Distcleaning</span><br><span>diff --git a/third-party/pjproject/.gitignore b/third-party/pjproject/.gitignore</span><br><span>index 6904ebf..f0a2b2a 100644</span><br><span>--- a/third-party/pjproject/.gitignore</span><br><span>+++ b/third-party/pjproject/.gitignore</span><br><span>@@ -1,5 +1,6 @@</span><br><span style="color: hsl(0, 100%, 40%);">-source/</span><br><span style="color: hsl(120, 100%, 40%);">+source</span><br><span> **.bz2</span><br><span> build.mak</span><br><span> pjproject.symbols</span><br><span> .rebuild_needed</span><br><span style="color: hsl(120, 100%, 40%);">+.makedeps</span><br><span>diff --git a/third-party/pjproject/Makefile b/third-party/pjproject/Makefile</span><br><span>index 96a6491..612c116 100644</span><br><span>--- a/third-party/pjproject/Makefile</span><br><span>+++ b/third-party/pjproject/Makefile</span><br><span>@@ -3,6 +3,7 @@</span><br><span> .NOTPARALLEL:</span><br><span> </span><br><span> include ../versions.mak</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> export PJDIR := $(shell pwd -P)/source</span><br><span> </span><br><span> SPECIAL_TARGETS :=</span><br><span>@@ -40,21 +41,21 @@</span><br><span>     endif</span><br><span> </span><br><span>     ifeq ($(PJPROJECT_BUNDLED),yes)</span><br><span style="color: hsl(120, 100%, 40%);">+        all: _all</span><br><span style="color: hsl(120, 100%, 40%);">+        install: _install</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>         ifneq ($(wildcard ../../menuselect.makeopts),)</span><br><span>             include ../../menuselect.makeopts</span><br><span>         else</span><br><span>             $(warning ASTTOPDIR/menuselect hasn't been run yet.  Can't find debug options.)</span><br><span>         endif</span><br><span>            include ../../Makefile.rules</span><br><span style="color: hsl(0, 100%, 40%);">-            include ../Makefile.rules</span><br><span style="color: hsl(120, 100%, 40%);">+        include ../Makefile.rules</span><br><span>                 include Makefile.rules</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-        all: _all</span><br><span style="color: hsl(0, 100%, 40%);">-        install: _install</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-        include source/user.mak</span><br><span style="color: hsl(0, 100%, 40%);">-        include source/version.mak</span><br><span style="color: hsl(0, 100%, 40%);">-        include source/build.mak</span><br><span style="color: hsl(120, 100%, 40%);">+        -include source/user.mak</span><br><span style="color: hsl(120, 100%, 40%);">+        -include source/version.mak</span><br><span style="color: hsl(120, 100%, 40%);">+        -include source/build.mak</span><br><span>         CF := $(filter-out -W%,$(CC_CFLAGS))</span><br><span>         CF := $(filter-out -I%,$(CF))</span><br><span>         ifeq ($(AST_DEVMODE),yes)</span><br><span>@@ -92,31 +93,28 @@</span><br><span> export LDFLAGS += $(CC_LDFLAGS) $(OPENSSL_LIB)</span><br><span> </span><br><span> ECHO_PREFIX := $(ECHO_PREFIX) echo '[pjproject] '</span><br><span style="color: hsl(120, 100%, 40%);">+ECHO_PREFIX_NONL := $(ECHO_PREFIX) echo -n '[pjproject] '</span><br><span> SHELL_ECHO_PREFIX := echo '[pjproject] '</span><br><span> </span><br><span> _all: $(TARGETS)</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-.DELETE_ON_ERROR:</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> $(DOWNLOAD_DIR)/$(TARBALL_FILE): ../versions.mak</span><br><span>       $(CMD_PREFIX) ($(TARBALL_EXISTS) && $(TARBALL_VERIFY) && touch $@) || (rm -rf $@ ;\</span><br><span>  $(TARBALL_DOWNLOAD)) || (rm -rf $@ ;\</span><br><span>        $(SHELL_ECHO_PREFIX) Retrying download ; $(TARBALL_DOWNLOAD))</span><br><span> </span><br><span> source/.unpacked: $(DOWNLOAD_DIR)/$(TARBALL_FILE)</span><br><span style="color: hsl(0, 100%, 40%);">-  $(CMD_PREFIX) $(TARBALL_VERIFY) || (rm -rf $@ ;\</span><br><span style="color: hsl(0, 100%, 40%);">-        $(SHELL_ECHO_PREFIX) Retrying download ; $(TARBALL_DOWNLOAD))</span><br><span style="color: hsl(0, 100%, 40%);">-   $(ECHO_PREFIX) Unpacking $<</span><br><span style="color: hsl(0, 100%, 40%);">-  -@rm -rf source pjproject-*/ >/dev/null 2>&1</span><br><span style="color: hsl(0, 100%, 40%);">-  $(CMD_PREFIX) $(TAR) -xjf $<</span><br><span style="color: hsl(0, 100%, 40%);">- @mv pjproject-$(PJPROJECT_VERSION) source</span><br><span style="color: hsl(120, 100%, 40%);">+     $(CMD_PREFIX) \</span><br><span style="color: hsl(120, 100%, 40%);">+               $(TARBALL_VERIFY) || (rm -rf $@ ; $(SHELL_ECHO_PREFIX) Retrying download ; $(TARBALL_DOWNLOAD)) ;\</span><br><span style="color: hsl(120, 100%, 40%);">+            $(SHELL_ECHO_PREFIX) Unpacking $< ;\</span><br><span style="color: hsl(120, 100%, 40%);">+               rm -rf source pjproject-*/ $(REALLY_QUIET) || : ;\</span><br><span style="color: hsl(120, 100%, 40%);">+            $(TAR) -xjf $< ;\</span><br><span style="color: hsl(120, 100%, 40%);">+          mv pjproject-$(PJPROJECT_VERSION) source</span><br><span>     $(ECHO_PREFIX) Applying patches "$(realpath patches)" "$(realpath .)/source"</span><br><span>     $(CMD_PREFIX) ../apply_patches $(QUIET_CONFIGURE) "$(realpath patches)" "$(realpath .)/source"</span><br><span>   -@touch source/.unpacked</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-source/version.mak: source/.unpacked</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-source/user.mak: source/.unpacked patches/user.mak</span><br><span style="color: hsl(120, 100%, 40%);">+source/user.mak: $(if $(PJPROJECT_BUNDLED_OOT),,source/.unpacked) patches/user.mak</span><br><span>       $(ECHO_PREFIX) Applying user.mak</span><br><span>     $(CMD_PREFIX) cp -f patches/user.mak source/</span><br><span> </span><br><span>@@ -128,7 +126,7 @@</span><br><span>       $(ECHO_PREFIX) Rebuilding</span><br><span>    $(CMD_PREFIX) $(MAKE) clean $(REALLY_QUIET)</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-source/build.mak: Makefile.rules source/version.mak source/user.mak $(addprefix source/pjlib/include/pj/,$(notdir $(wildcard patches/*.h))) .rebuild_needed</span><br><span style="color: hsl(120, 100%, 40%);">+source/build.mak: Makefile.rules source/user.mak $(if $(PJPROJECT_BUNDLED_OOT),,.rebuild_needed)</span><br><span>         $(ECHO_PREFIX) Configuring with $(PJPROJECT_CONFIG_OPTS) </span><br><span>    $(CMD_PREFIX) (cd source ; ./aconfigure $(QUIET_CONFIGURE) $(PJPROJECT_CONFIG_OPTS))</span><br><span> </span><br><span>@@ -144,25 +142,74 @@</span><br><span> echo_cflags: source/build.mak</span><br><span>    @echo $(filter-out -O% -g%,$(PJ_CFLAGS))</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-libpj%.a: source/build.mak</span><br><span style="color: hsl(0, 100%, 40%);">-  $(ECHO_PREFIX) Compiling lib $(@F)</span><br><span style="color: hsl(0, 100%, 40%);">-      $(CMD_PREFIX) $(MAKE) -C $(dir $(shell dirname $@))/build $(@F) $(REALLY_QUIET)</span><br><span style="color: hsl(120, 100%, 40%);">+# The dependency_utils script needs TARGET_NAME in the environment</span><br><span style="color: hsl(120, 100%, 40%);">+export TARGET_NAME</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-# pjsua needs resample and g711 to successfully run the testsuite</span><br><span style="color: hsl(0, 100%, 40%);">-libresample%.a: source/build.mak</span><br><span style="color: hsl(0, 100%, 40%);">-    $(ECHO_PREFIX) Compiling lib $(@F)</span><br><span style="color: hsl(0, 100%, 40%);">-      $(CMD_PREFIX) $(MAKE) -C $(dir $(shell dirname $@))/build/resample all $(REALLY_QUIET)</span><br><span style="color: hsl(120, 100%, 40%);">+# PJ_LIB_FILES is set by the pjproject build.mak and contains the libs we</span><br><span style="color: hsl(120, 100%, 40%);">+# need, but not in the order they need to be built.  We need to compile</span><br><span style="color: hsl(120, 100%, 40%);">+# pjlib, then pjlib-util, then the rest so we separate them out and create</span><br><span style="color: hsl(120, 100%, 40%);">+# the dependencies.  First though, we shorten all file paths by making them</span><br><span style="color: hsl(120, 100%, 40%);">+# relative to the current directory.</span><br><span style="color: hsl(120, 100%, 40%);">+SHORTENED_PJ_LIB_FILES = $(subst $(CURDIR)/,,$(PJ_LIB_FILES))</span><br><span style="color: hsl(120, 100%, 40%);">+# Now separate them</span><br><span style="color: hsl(120, 100%, 40%);">+PJLIB_LIB_FILES = $(filter %/libpj-$(TARGET_NAME).a,$(SHORTENED_PJ_LIB_FILES))</span><br><span style="color: hsl(120, 100%, 40%);">+PJLIB_UTIL_LIB_FILES = $(filter %/libpjlib-util-$(TARGET_NAME).a,$(SHORTENED_PJ_LIB_FILES))</span><br><span style="color: hsl(120, 100%, 40%);">+RESAMPLE_LIB_FILE = $(filter %/libresample-$(TARGET_NAME).a,$(SHORTENED_PJ_LIB_FILES))</span><br><span style="color: hsl(120, 100%, 40%);">+# The rest.</span><br><span style="color: hsl(120, 100%, 40%);">+PJSIP_LIB_FILES = $(filter-out $(PJLIB_LIB_FILES) $(PJLIB_UTIL_LIB_FILES) $(RESAMPLE_LIB_FILE),$(SHORTENED_PJ_LIB_FILES))</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-# We need to compile pjlib, then pjlib-util, then the rest</span><br><span style="color: hsl(0, 100%, 40%);">-# so we separate them out and create the dependencies</span><br><span style="color: hsl(0, 100%, 40%);">-PJLIB_LIB_FILES = $(foreach lib,$(PJ_LIB_FILES),$(if $(findstring libpj-,$(lib)),$(lib),))</span><br><span style="color: hsl(0, 100%, 40%);">-PJLIB_UTIL_LIB_FILES = $(foreach lib,$(PJ_LIB_FILES),$(if $(findstring libpjlib-util,$(lib)),$(lib),))</span><br><span style="color: hsl(0, 100%, 40%);">-PJSIP_LIB_FILES = $(filter-out $(PJLIB_LIB_FILES) $(PJLIB_UTIL_LIB_FILES) $(APP_THIRD_PARTY_LIB_FILES),$(PJ_LIB_FILES))</span><br><span style="color: hsl(0, 100%, 40%);">-ALL_LIB_FILES = $(PJLIB_LIB_FILES) $(PJLIB_UTIL_LIB_FILES) $(PJSIP_LIB_FILES)</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(120, 100%, 40%);">+# Create the dependency order we need</span><br><span> $(PJLIB_UTIL_LIB_FILES): $(PJLIB_LIB_FILES)</span><br><span> $(PJSIP_LIB_FILES): $(PJLIB_UTIL_LIB_FILES)</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+# and here's the full list</span><br><span style="color: hsl(120, 100%, 40%);">+ALL_LIB_FILES = $(PJLIB_LIB_FILES) $(PJLIB_UTIL_LIB_FILES) $(PJSIP_LIB_FILES) $(RESAMPLE_LIB_FILE)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Assuming that since you're doing an out-of-tree build you're modifying</span><br><span style="color: hsl(120, 100%, 40%);">+# the pjproject source files, we need to create dependencies between</span><br><span style="color: hsl(120, 100%, 40%);">+# the libraries and their respective source files.  Pjproject does</span><br><span style="color: hsl(120, 100%, 40%);">+# create dependency files if you run 'make dep' but those files include</span><br><span style="color: hsl(120, 100%, 40%);">+# the system include files and the paths are relative to the lib's</span><br><span style="color: hsl(120, 100%, 40%);">+# "build" directory.  Neither really works for us.</span><br><span style="color: hsl(120, 100%, 40%);">+# So...</span><br><span style="color: hsl(120, 100%, 40%);">+# We create our own "astdep" files with dependency paths relative</span><br><span style="color: hsl(120, 100%, 40%);">+# to "this" directory and strip out all the system includes.</span><br><span style="color: hsl(120, 100%, 40%);">+# The dependency_utils script does all the heavy lifting.</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# REMINDER: None of this gets invoked unless you're doing an out-of-tree</span><br><span style="color: hsl(120, 100%, 40%);">+# pjproject build.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ifdef PJPROJECT_BUNDLED_OOT</span><br><span style="color: hsl(120, 100%, 40%);">+    ALL_PJDEP_FILES = $(shell TARGET_NAME=$(TARGET_NAME) ./dependency_utils getpjdepname $(ALL_LIB_FILES))</span><br><span style="color: hsl(120, 100%, 40%);">+    ALL_ASTDEP_FILES = $(ALL_PJDEP_FILES:.depend=.astdep)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    $(ALL_PJDEP_FILES): build.mak</span><br><span style="color: hsl(120, 100%, 40%);">+          $(ECHO_PREFIX) Generating pjproject dependency file $(@F)</span><br><span style="color: hsl(120, 100%, 40%);">+             $(CMD_PREFIX) $(MAKE) -C $(@D) dep $(REALLY_QUIET)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    $(ALL_ASTDEP_FILES): %.astdep: %.depend</span><br><span style="color: hsl(120, 100%, 40%);">+             $(ECHO_PREFIX) Generating asterisk dependency file $(@F)</span><br><span style="color: hsl(120, 100%, 40%);">+              $(CMD_PREFIX) ./dependency_utils gendepfile $<</span><br><span style="color: hsl(120, 100%, 40%);">+    ifeq ($(SPECIAL_TARGETS),)</span><br><span style="color: hsl(120, 100%, 40%);">+        ifneq ($(ALL_ASTDEP_FILES),)</span><br><span style="color: hsl(120, 100%, 40%);">+            include $(ALL_ASTDEP_FILES)</span><br><span style="color: hsl(120, 100%, 40%);">+            depends: $(ALL_ASTDEP_FILES)</span><br><span style="color: hsl(120, 100%, 40%);">+        endif</span><br><span style="color: hsl(120, 100%, 40%);">+    endif</span><br><span style="color: hsl(120, 100%, 40%);">+endif</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# resample's a little odd in that it's build directory is one directory</span><br><span style="color: hsl(120, 100%, 40%);">+# level down from the other libraries.  We set the RESAMPLE_OPTS</span><br><span style="color: hsl(120, 100%, 40%);">+# variable for it then let the ALL_LIB_FILE build rules take over.</span><br><span style="color: hsl(120, 100%, 40%);">+$(RESAMPLE_LIB_FILE): RESAMPLE_OPTS=/resample all</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+.PRECIOUS: $(ALL_LIB_FILES)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+$(ALL_LIB_FILES): BUILD_DIR=$(dir $(@D))</span><br><span style="color: hsl(120, 100%, 40%);">+$(ALL_LIB_FILES): source/build.mak source/pjlib/include/pj/config_site.h</span><br><span style="color: hsl(120, 100%, 40%);">+  $(ECHO_PREFIX) Compiling $(@F)</span><br><span style="color: hsl(120, 100%, 40%);">+        $(CMD_PREFIX) ( $(MAKE) -C $(BUILD_DIR)build$(if $(RESAMPLE_OPTS),$(RESAMPLE_OPTS), $(@F)) >/dev/null ) $(if $(PJPROJECT_BUNDLED_OOT),2>&1 | ($(GREP) -E -v "^(r - output|ar:)" || : ),$(REALLY_QUIET))</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> pjproject.symbols: $(ALL_LIB_FILES)</span><br><span>         $(ECHO_PREFIX) Generating symbols</span><br><span>    $(CMD_PREFIX) $(NM) -Pog $(ALL_LIB_FILES) | $(SED) -n -E -e "s/.+: ([_]?[pP][jJ][^ ]+) .+/\1/gp" | sort -u > pjproject.symbols</span><br><span>@@ -170,21 +217,22 @@</span><br><span> source/pjsip-apps/src/asterisk_malloc_debug.c: patches/asterisk_malloc_debug.c</span><br><span>        $(ECHO_PREFIX) Copying $< to $@</span><br><span>   $(CMD_PREFIX) cp -f $< $@</span><br><span style="color: hsl(0, 100%, 40%);">-    $(CMD_PREFIX) mkdir source/pjsip-apps/lib/</span><br><span style="color: hsl(120, 100%, 40%);">+    -$(CMD_PREFIX) mkdir source/pjsip-apps/lib/ $(REALLY_QUIET)</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-source/pjsip-apps/lib/asterisk_malloc_debug.o: source/pjsip-apps/src/asterisk_malloc_debug.c .rebuild_needed</span><br><span style="color: hsl(120, 100%, 40%);">+source/pjsip-apps/lib/asterisk_malloc_debug.o: source/pjsip-apps/src/asterisk_malloc_debug.c | source/pjlib/include/pj/config_site.h source/pjlib/include/pj/asterisk_malloc_debug.h</span><br><span>    $(ECHO_PREFIX) Compiling asterisk debug malloc stubs</span><br><span>         $(CMD_PREFIX) $(CC) -fPIC  $(PJ_CFLAGS) -c $< -o $@</span><br><span> </span><br><span> source/pjsip-apps/lib/libasterisk_malloc_debug.a: source/pjsip-apps/lib/asterisk_malloc_debug.o</span><br><span>        $(ECHO_PREFIX) Creating archive $(@F)</span><br><span style="color: hsl(0, 100%, 40%);">-   $(CMD_PREFIX) ar qs $@ $< >/dev/null 2>&1</span><br><span style="color: hsl(120, 100%, 40%);">+        $(CMD_PREFIX) ar qs $@ $< $(REALLY_QUIET)</span><br><span> </span><br><span> $(apps): APP = $(filter pj%,$(subst -, ,$(notdir $@)))</span><br><span> $(apps): LDFLAGS += $(MALLOC_DEBUG_LDFLAGS)</span><br><span style="color: hsl(0, 100%, 40%);">-$(apps): $(MALLOC_DEBUG_LIBS) pjproject.symbols $(APP_THIRD_PARTY_LIB_FILES)</span><br><span style="color: hsl(120, 100%, 40%);">+$(apps): $(MALLOC_DEBUG_LIBS) pjproject.symbols</span><br><span>       $(ECHO_PREFIX) Compiling $(APP)</span><br><span style="color: hsl(0, 100%, 40%);">- $(CMD_PREFIX) +$(MAKE) -C source/pjsip-apps/build $(filter pj%,$(subst -, ,$(notdir $@))) $(REALLY_QUIET)</span><br><span style="color: hsl(120, 100%, 40%);">+     $(CMD_PREFIX) +$(MAKE) -C source/pjsip-apps/build $(APP) $(REALLY_QUIET)</span><br><span style="color: hsl(120, 100%, 40%);">+      $(CMD_PREFIX) touch $@</span><br><span> </span><br><span> source/pjsip-apps/src/python/_pjsua.o: source/pjsip-apps/src/python/_pjsua.c $(apps)</span><br><span>   $(ECHO_PREFIX) Compiling python bindings</span><br><span>@@ -210,19 +258,33 @@</span><br><span>     $(CMD_PREFIX) $(INSTALL) -m 644 source/pjsip-apps/src/python/pjsua.py "$(DESTDIR)$(ASTDATADIR)/third-party/pjproject/"</span><br><span> endif</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+all: _all</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> uninstall:</span><br><span>     $(ECHO_PREFIX) Uninstalling apps and python bindings</span><br><span>         $(CMD_PREFIX) rm -rf "$(DESTDIR)$(ASTDATADIR)/third-party/pjproject"</span><br><span> </span><br><span> clean:</span><br><span>         $(ECHO_PREFIX) Cleaning</span><br><span style="color: hsl(0, 100%, 40%);">- +-$(CMD_PREFIX) test -d source && ($(SUBMAKE) -C source clean || : ;\</span><br><span style="color: hsl(0, 100%, 40%);">-           rm -rf source/pjsip-apps/bin/* || : ;\</span><br><span style="color: hsl(0, 100%, 40%);">-          find source -name *.a | xargs rm -rf  ;\</span><br><span style="color: hsl(0, 100%, 40%);">-                find source -name *.o | xargs rm -rf  ;\</span><br><span style="color: hsl(0, 100%, 40%);">-                find source -name *.so  | xargs rm -rf ; ) || :</span><br><span style="color: hsl(0, 100%, 40%);">- -$(CMD_PREFIX) rm -rf pjproject.symbols</span><br><span style="color: hsl(120, 100%, 40%);">+       +-$(CMD_PREFIX) {\</span><br><span style="color: hsl(120, 100%, 40%);">+            if [ -d source ] ; then  \</span><br><span style="color: hsl(120, 100%, 40%);">+                    $(SUBMAKE) -C source clean ;\</span><br><span style="color: hsl(120, 100%, 40%);">+                 rm -rf source/pjsip-apps/bin/* ;\</span><br><span style="color: hsl(120, 100%, 40%);">+                     $(FIND) source/ '(' -name *.a -or -name *.o -or -name *.so ')' -delete ;\</span><br><span style="color: hsl(120, 100%, 40%);">+             fi ;\</span><br><span style="color: hsl(120, 100%, 40%);">+         rm -rf pjproject.symbols ;\</span><br><span style="color: hsl(120, 100%, 40%);">+           } $(REALLY_QUIET) || :</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-distclean:</span><br><span style="color: hsl(120, 100%, 40%);">+distclean: clean</span><br><span>       $(ECHO_PREFIX) Distcleaning</span><br><span style="color: hsl(0, 100%, 40%);">-     -$(CMD_PREFIX) rm -rf source pjproject.symbols pjproject-*.tar.bz2 build.mak .rebuild_needed</span><br><span style="color: hsl(120, 100%, 40%);">+  +-$(CMD_PREFIX) {\</span><br><span style="color: hsl(120, 100%, 40%);">+            rm -rf build.mak .rebuild_needed ;\</span><br><span style="color: hsl(120, 100%, 40%);">+           if [ "x$(PJPROJECT_BUNDLED_OOT)" = "x" -a ! -d source/.git ] ; then \</span><br><span style="color: hsl(120, 100%, 40%);">+                     rm -rf source pjproject-*.tar.bz2 ;\</span><br><span style="color: hsl(120, 100%, 40%);">+          else \</span><br><span style="color: hsl(120, 100%, 40%);">+                        $(SUBMAKE) -C source distclean ;\</span><br><span style="color: hsl(120, 100%, 40%);">+                     rm -rf source/build.mak source/user.mak ;\</span><br><span style="color: hsl(120, 100%, 40%);">+                    $(FIND) source/ -name '*asterisk_malloc_debug*' -delete ;\</span><br><span style="color: hsl(120, 100%, 40%);">+                    $(FIND) source/ '(' -name '.*.depend' -or -name '.*.astdep' ')' -delete ;\</span><br><span style="color: hsl(120, 100%, 40%);">+            fi \</span><br><span style="color: hsl(120, 100%, 40%);">+          } $(REALLY_QUIET) || :</span><br><span>diff --git a/third-party/pjproject/Makefile.rules b/third-party/pjproject/Makefile.rules</span><br><span>index e76a753..b92a4cb 100644</span><br><span>--- a/third-party/pjproject/Makefile.rules</span><br><span>+++ b/third-party/pjproject/Makefile.rules</span><br><span>@@ -37,7 +37,7 @@</span><br><span>      --disable-ipp \</span><br><span>      --disable-libwebrtc \</span><br><span>        --without-external-pa \</span><br><span style="color: hsl(0, 100%, 40%);">- --without-external-srtp</span><br><span style="color: hsl(120, 100%, 40%);">+       --with-external-srtp</span><br><span> </span><br><span> ifneq ($(AST_DEVMODE),yes)</span><br><span>     PJPROJECT_CONFIG_OPTS += --disable-resample --disable-g711-codec</span><br><span>diff --git a/third-party/pjproject/README-hacking.md b/third-party/pjproject/README-hacking.md</span><br><span>new file mode 100644</span><br><span>index 0000000..0ce57ec</span><br><span>--- /dev/null</span><br><span>+++ b/third-party/pjproject/README-hacking.md</span><br><span>@@ -0,0 +1,213 @@</span><br><span style="color: hsl(120, 100%, 40%);">+# Hacking on PJProject</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+## Intro</span><br><span style="color: hsl(120, 100%, 40%);">+There are times when you need to troubleshoot issues with bundled pjproject</span><br><span style="color: hsl(120, 100%, 40%);">+or add new features that need to be pushed upstream but...</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+* The source directory created by extracting the pjproject tarball is not</span><br><span style="color: hsl(120, 100%, 40%);">+scanned for code changes so you have to keep forcing rebuilds.</span><br><span style="color: hsl(120, 100%, 40%);">+* The source directory isn't a git repo so you can't easily create patches,</span><br><span style="color: hsl(120, 100%, 40%);">+do git bisects, etc.</span><br><span style="color: hsl(120, 100%, 40%);">+* Accidentally doing a make distclean will ruin your day by wiping out the</span><br><span style="color: hsl(120, 100%, 40%);">+source directory, and your changes.</span><br><span style="color: hsl(120, 100%, 40%);">+* etc.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Well No More!</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+You can now replace the `source` directory that's normally created</span><br><span style="color: hsl(120, 100%, 40%);">+by the Makefile extracting the tarball, with a symlink to a "real" pjproject</span><br><span style="color: hsl(120, 100%, 40%);">+git clone.  The Makefile will now detect that `source` is a real pjproject</span><br><span style="color: hsl(120, 100%, 40%);">+repo and enable some advanced behaviors (and disable others).</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+## Setup</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Let's assume you have an Asterisk development environment like so:</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+```plain</span><br><span style="color: hsl(120, 100%, 40%);">+~/dev/asterisk/</span><br><span style="color: hsl(120, 100%, 40%);">+  asterisk/</span><br><span style="color: hsl(120, 100%, 40%);">+    .git/</span><br><span style="color: hsl(120, 100%, 40%);">+    addons/</span><br><span style="color: hsl(120, 100%, 40%);">+    ...</span><br><span style="color: hsl(120, 100%, 40%);">+    third-party/</span><br><span style="color: hsl(120, 100%, 40%);">+      jansson/</span><br><span style="color: hsl(120, 100%, 40%);">+      pjproject/</span><br><span style="color: hsl(120, 100%, 40%);">+```</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+### Cloning pjproject</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Start by cloning a pjproject repository next to your asterisk repository.</span><br><span style="color: hsl(120, 100%, 40%);">+The source of the clone depends on whether you anticipate pushing changes</span><br><span style="color: hsl(120, 100%, 40%);">+back upstream or not.  If you already have a good pjproject repository clone,</span><br><span style="color: hsl(120, 100%, 40%);">+read this section anyway but you probably won't have to do anything.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+* For pushing upstream: (Community Contributors)</span><br><span style="color: hsl(120, 100%, 40%);">+    * Make sure you have the proper ssh keys added to your github account</span><br><span style="color: hsl(120, 100%, 40%);">+    so you can push changes.</span><br><span style="color: hsl(120, 100%, 40%);">+    * Navigate to https://github.com/pjsip/pjproject</span><br><span style="color: hsl(120, 100%, 40%);">+    * Click the "Fork" button to create a fork under your own username.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Back on your own machine...</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+```plain</span><br><span style="color: hsl(120, 100%, 40%);">+$ cd ~/dev/asterisk</span><br><span style="color: hsl(120, 100%, 40%);">+$ git clone git@github.com:<yourusername>/pjproject</span><br><span style="color: hsl(120, 100%, 40%);">+```</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+* For pushing upstream: (Asterisk Core Team Developers)</span><br><span style="color: hsl(120, 100%, 40%);">+Asterisk Core Team Developers should clone the fork we have in our own</span><br><span style="color: hsl(120, 100%, 40%);">+Asterisk github organization.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+```plain</span><br><span style="color: hsl(120, 100%, 40%);">+$ cd ~/dev/asterisk</span><br><span style="color: hsl(120, 100%, 40%);">+$ git clone git@github.com:asterisk/pjproject</span><br><span style="color: hsl(120, 100%, 40%);">+```</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Regardless of how you got your repo, you'll need to create an "upstream"</span><br><span style="color: hsl(120, 100%, 40%);">+remote that points to the original pjproject repo.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+```plain</span><br><span style="color: hsl(120, 100%, 40%);">+$ cd pjproject</span><br><span style="color: hsl(120, 100%, 40%);">+$ git remote add upstream https://github.com/pjsip/pjproject</span><br><span style="color: hsl(120, 100%, 40%);">+```</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+If you're just troubleshooting and don't plan on pushing changes upstream,</span><br><span style="color: hsl(120, 100%, 40%);">+you can just clone directly from the upstream pjproject repo.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+```plain</span><br><span style="color: hsl(120, 100%, 40%);">+$ cd ~/dev/asterisk</span><br><span style="color: hsl(120, 100%, 40%);">+$ git clone https://github.com/pjsip/pjproject</span><br><span style="color: hsl(120, 100%, 40%);">+```</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Your directory structure should now look something like:</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+```plain</span><br><span style="color: hsl(120, 100%, 40%);">+~/dev/asterisk/</span><br><span style="color: hsl(120, 100%, 40%);">+  asterisk/</span><br><span style="color: hsl(120, 100%, 40%);">+    .git/</span><br><span style="color: hsl(120, 100%, 40%);">+    addons/</span><br><span style="color: hsl(120, 100%, 40%);">+    ...</span><br><span style="color: hsl(120, 100%, 40%);">+    third-party/</span><br><span style="color: hsl(120, 100%, 40%);">+      jansson/</span><br><span style="color: hsl(120, 100%, 40%);">+      pjproject/</span><br><span style="color: hsl(120, 100%, 40%);">+  pjproject/</span><br><span style="color: hsl(120, 100%, 40%);">+    .git</span><br><span style="color: hsl(120, 100%, 40%);">+    pjlib/</span><br><span style="color: hsl(120, 100%, 40%);">+    ...</span><br><span style="color: hsl(120, 100%, 40%);">+```</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+### Adjusting Asterisk</span><br><span style="color: hsl(120, 100%, 40%);">+Start with a "distcleaned" asterisk work tree then in the</span><br><span style="color: hsl(120, 100%, 40%);">+asterisk/third-party/pjproject directory, create a symlink to the pjproject</span><br><span style="color: hsl(120, 100%, 40%);">+clone you just created.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+```plain</span><br><span style="color: hsl(120, 100%, 40%);">+$ cd ~/dev/asterisk/asterisk/</span><br><span style="color: hsl(120, 100%, 40%);">+$ make distclean</span><br><span style="color: hsl(120, 100%, 40%);">+$ cd third-party/pjproject</span><br><span style="color: hsl(120, 100%, 40%);">+$ ln -s ../../../pjproject source</span><br><span style="color: hsl(120, 100%, 40%);">+```</span><br><span style="color: hsl(120, 100%, 40%);">+The "source" directory is now a relative symlink to your pjproject</span><br><span style="color: hsl(120, 100%, 40%);">+clone so your directory structure should now look something like:</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+```plain</span><br><span style="color: hsl(120, 100%, 40%);">+~/dev/asterisk/</span><br><span style="color: hsl(120, 100%, 40%);">+  asterisk/</span><br><span style="color: hsl(120, 100%, 40%);">+    .git/</span><br><span style="color: hsl(120, 100%, 40%);">+    addons/</span><br><span style="color: hsl(120, 100%, 40%);">+    ...</span><br><span style="color: hsl(120, 100%, 40%);">+    third-party/</span><br><span style="color: hsl(120, 100%, 40%);">+      jansson/</span><br><span style="color: hsl(120, 100%, 40%);">+      pjproject/</span><br><span style="color: hsl(120, 100%, 40%);">+        source -> ../../../pjproject</span><br><span style="color: hsl(120, 100%, 40%);">+  pjproject/</span><br><span style="color: hsl(120, 100%, 40%);">+    .git</span><br><span style="color: hsl(120, 100%, 40%);">+    pjlib/</span><br><span style="color: hsl(120, 100%, 40%);">+    ...</span><br><span style="color: hsl(120, 100%, 40%);">+```</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+### Adjust pjproject git ignores.</span><br><span style="color: hsl(120, 100%, 40%);">+One final step is required to keep your pjproject repo from being dirtied</span><br><span style="color: hsl(120, 100%, 40%);">+by the build process.  Add the following lines to your pjproject (not asterisk)</span><br><span style="color: hsl(120, 100%, 40%);">+repo's .git/info/exclude file...</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+```plain</span><br><span style="color: hsl(120, 100%, 40%);">+**/*.astdep</span><br><span style="color: hsl(120, 100%, 40%);">+**/*asterisk_malloc_debug*</span><br><span style="color: hsl(120, 100%, 40%);">+**/_pjsua.o</span><br><span style="color: hsl(120, 100%, 40%);">+**/_pjsua.so</span><br><span style="color: hsl(120, 100%, 40%);">+```</span><br><span style="color: hsl(120, 100%, 40%);">+Don't add these to the top-level .gitignore file!  If you do, they'll become</span><br><span style="color: hsl(120, 100%, 40%);">+part of any change you submit upstream.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+## Usage</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Just run `./configure` and `make` as you would for any other asterisk build.</span><br><span style="color: hsl(120, 100%, 40%);">+When you make changes to pjproject source files, they'll be automatically</span><br><span style="color: hsl(120, 100%, 40%);">+recompiled the next time you build asterisk.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+You can do git operations in the pjproject repo while it's still symlinked</span><br><span style="color: hsl(120, 100%, 40%);">+into the asterisk source.  Assuming you made the proper changes to</span><br><span style="color: hsl(120, 100%, 40%);">+pjproject's .git/info/exclude file, a commit in the pjproject repo _should_ contain</span><br><span style="color: hsl(120, 100%, 40%);">+only the changes you made.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+You can run `make` commands directly in third-party/pjproject  The only</span><br><span style="color: hsl(120, 100%, 40%);">+requirement is that an asterisk top-level `configure` had to have been</span><br><span style="color: hsl(120, 100%, 40%);">+run at least once.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+You can always revert to standard bundled pjproject by running an asterisk</span><br><span style="color: hsl(120, 100%, 40%);">+top-level `make distclean`, removing the third-party/pjproject/source</span><br><span style="color: hsl(120, 100%, 40%);">+symlink, and re-running a top-level `configure`.  That will download and</span><br><span style="color: hsl(120, 100%, 40%);">+extract the pjproject tarball to the `third-party/pjproject/source`</span><br><span style="color: hsl(120, 100%, 40%);">+directory as usual.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+### Notes</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+While your pjproject repo is symlinked into the asterisk source tree,</span><br><span style="color: hsl(120, 100%, 40%);">+you should not run `configure` directly in the pjproject repo.  You won't get</span><br><span style="color: hsl(120, 100%, 40%);">+the proper options applied to be compatible with Asterisk.  You can run</span><br><span style="color: hsl(120, 100%, 40%);">+`make` though.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Although asterisk_malloc_debug and site_config.h are applied to the pjproject</span><br><span style="color: hsl(120, 100%, 40%);">+repo, No patches from the `third-party/pjproject/patches` directory are</span><br><span style="color: hsl(120, 100%, 40%);">+applied.  Since you're probably working off the pjproject master branch,</span><br><span style="color: hsl(120, 100%, 40%);">+the patches aren't needed.  Also, applying the patches would contaminate</span><br><span style="color: hsl(120, 100%, 40%);">+the pjproject repo and you wouldn't be able to do a clean commit there.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+You'll see compile and/or link warnings you wouldn't see with a normal</span><br><span style="color: hsl(120, 100%, 40%);">+bundled build.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+## How it works</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+When an asterisk top-level `configure` is run, `third-party/pjproject/configure.m4 `</span><br><span style="color: hsl(120, 100%, 40%);">+checks whether `third-party/pjproject/source` is a symlink or is a git</span><br><span style="color: hsl(120, 100%, 40%);">+repository.  If neither are true, the build isn't considered "out-of-tree"</span><br><span style="color: hsl(120, 100%, 40%);">+and the normal pjproject bundled process occurs.</span><br><span style="color: hsl(120, 100%, 40%);">+If either is true, it sets `PJPROJECT_BUNDLED_OOT=yes` for the Makefiles.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+When a `make` is done, either from top-level asterisk or from the</span><br><span style="color: hsl(120, 100%, 40%);">+third-party/pjproject directory, it checks `PJPROJECT_BUNDLED_OOT`</span><br><span style="color: hsl(120, 100%, 40%);">+and if set to yes it...</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    * Alters the behavior of `clean` and `distclean` to just run</span><br><span style="color: hsl(120, 100%, 40%);">+    pjproject's `clean` or `distclean` targets and to NOT remove the</span><br><span style="color: hsl(120, 100%, 40%);">+    `source` directory or symlink as it would normally do.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    * Generates `astdep` dependency files in the pjproject source tree</span><br><span style="color: hsl(120, 100%, 40%);">+    if they don't already exist.  These are git-ignored by the edit</span><br><span style="color: hsl(120, 100%, 40%);">+    to pjproject's `.git/info/exclude` done above.  You'll</span><br><span style="color: hsl(120, 100%, 40%);">+    see new progress messages during the make as the astdep files are</span><br><span style="color: hsl(120, 100%, 40%);">+    built.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    * Copies asterisk_malloc_debug.c, asterisk_malloc_debug.h and</span><br><span style="color: hsl(120, 100%, 40%);">+    config_site.h from the patches directory into the pjproject source</span><br><span style="color: hsl(120, 100%, 40%);">+    tree.  These are also git-ignored by the edit to pjproject's</span><br><span style="color: hsl(120, 100%, 40%);">+    `.git/info/exclude` file.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    * Compiles only the out-of-date source files into their respective</span><br><span style="color: hsl(120, 100%, 40%);">+    libpj libraries.  That in turn triggers the asterisk top-level</span><br><span style="color: hsl(120, 100%, 40%);">+    make to re-link main/libasteriskpj.so.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>diff --git a/third-party/pjproject/configure.m4 b/third-party/pjproject/configure.m4</span><br><span>index f67ef57..2f26625 100644</span><br><span>--- a/third-party/pjproject/configure.m4</span><br><span>+++ b/third-party/pjproject/configure.m4</span><br><span>@@ -47,6 +47,14 @@</span><br><span>           if test "${GREP}" = ":" ; then</span><br><span>                   AC_MSG_ERROR(grep is required to build bundled pjproject)</span><br><span>            fi</span><br><span style="color: hsl(120, 100%, 40%);">+            if test "${FIND}" = ":" ; then</span><br><span style="color: hsl(120, 100%, 40%);">+                    AC_MSG_ERROR(find is required to build bundled pjproject)</span><br><span style="color: hsl(120, 100%, 40%);">+             fi</span><br><span style="color: hsl(120, 100%, 40%);">+            if test "x${AST_DEVMODE}" != "x" ; then</span><br><span style="color: hsl(120, 100%, 40%);">+                   if test "${REALPATH}" = ":" ; then</span><br><span style="color: hsl(120, 100%, 40%);">+                                AC_MSG_ERROR(realpath is required to build bundled pjproject in dev mode)</span><br><span style="color: hsl(120, 100%, 40%);">+                     fi</span><br><span style="color: hsl(120, 100%, 40%);">+            fi</span><br><span> </span><br><span>               AC_ARG_VAR([PJPROJECT_CONFIGURE_OPTS],[Additional configure options to pass to bundled pjproject])</span><br><span>           this_host=$(./config.sub $(./config.guess))</span><br><span>@@ -74,11 +82,19 @@</span><br><span>                    esac</span><br><span>                 fi</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-          export TAR PATCH SED NM EXTERNALS_CACHE_DIR AST_DOWNLOAD_CACHE DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT CUT GREP</span><br><span style="color: hsl(120, 100%, 40%);">+          # Determine if we're doing an out-of-tree build...</span><br><span style="color: hsl(120, 100%, 40%);">+                AH_TEMPLATE(m4_bpatsubst([[HAVE_PJPROJECT_BUNDLED_OOT]], [(.*)]), [Define if doing a bundled pjproject out-of-tree build.])</span><br><span style="color: hsl(120, 100%, 40%);">+           if test -L ${PJPROJECT_DIR}/source -o -d ${PJPROJECT_DIR}/source/.git ; then</span><br><span style="color: hsl(120, 100%, 40%);">+                  AC_DEFINE([HAVE_PJPROJECT_BUNDLED_OOT], 1)</span><br><span style="color: hsl(120, 100%, 40%);">+                    PJPROJECT_BUNDLED_OOT=yes</span><br><span style="color: hsl(120, 100%, 40%);">+             fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+          export TAR PATCH SED NM EXTERNALS_CACHE_DIR AST_DOWNLOAD_CACHE DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT CUT GREP FIND REALPATH</span><br><span>           export NOISY_BUILD AST_DEVMODE</span><br><span>               ${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} \</span><br><span>                       PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" \</span><br><span>                     EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" \</span><br><span style="color: hsl(120, 100%, 40%);">+                       PJPROJECT_BUNDLED_OOT="${PJPROJECT_BUNDLED_OOT}" \</span><br><span>                         configure</span><br><span>            if test $? -ne 0 ; then</span><br><span>                      AC_MSG_RESULT(failed)</span><br><span>@@ -88,7 +104,11 @@</span><br><span> </span><br><span>              AC_MSG_CHECKING(for bundled pjproject)</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-              PJPROJECT_INCLUDE=$(${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" echo_cflags)</span><br><span style="color: hsl(120, 100%, 40%);">+            PJPROJECT_INCLUDE=$(${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} \</span><br><span style="color: hsl(120, 100%, 40%);">+                    PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" \</span><br><span style="color: hsl(120, 100%, 40%);">+                      EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" \</span><br><span style="color: hsl(120, 100%, 40%);">+                       PJPROJECT_BUNDLED_OOT="${PJPROJECT_BUNDLED_OOT}" \</span><br><span style="color: hsl(120, 100%, 40%);">+                  echo_cflags)</span><br><span>                 PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE"</span><br><span>              PBX_PJPROJECT=1</span><br><span> </span><br><span>@@ -113,6 +133,7 @@</span><br><span>            AC_DEFINE([HAVE_PJPROJECT_ON_VALID_ICE_PAIR_CALLBACK], 1, [Define if your system has the on_valid_pair pjnath callback.])</span><br><span> </span><br><span>                AC_SUBST([PJPROJECT_BUNDLED])</span><br><span style="color: hsl(120, 100%, 40%);">+         AC_SUBST([PJPROJECT_BUNDLED_OOT])</span><br><span>            AC_SUBST([PJPROJECT_DIR])</span><br><span>            AC_SUBST([PBX_PJPROJECT])</span><br><span>            AC_SUBST([PJPROJECT_LIB])</span><br><span>diff --git a/third-party/pjproject/dependency_utils b/third-party/pjproject/dependency_utils</span><br><span>new file mode 100755</span><br><span>index 0000000..fb221ea</span><br><span>--- /dev/null</span><br><span>+++ b/third-party/pjproject/dependency_utils</span><br><span>@@ -0,0 +1,96 @@</span><br><span style="color: hsl(120, 100%, 40%);">+#!/bin/sh</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[ "x${SED}" = "x" ] && SED=sed</span><br><span style="color: hsl(120, 100%, 40%);">+[ "x${GREP}" = "x" ] && GREP=grep</span><br><span style="color: hsl(120, 100%, 40%);">+[ "x${REALPATH}" = "x" ] && REALPATH=realpath</span><br><span style="color: hsl(120, 100%, 40%);">+[ "x${DIRNAME}" = "x" ] && DIRNAME=dirname</span><br><span style="color: hsl(120, 100%, 40%);">+[ "x${BASENAME}" = "x" ] && BASENAME=basename</span><br><span style="color: hsl(120, 100%, 40%);">+[ "x${GREP}" = "x" ] && GREP=grep</span><br><span style="color: hsl(120, 100%, 40%);">+if [ "x${TARGET_NAME}" = "x" ] ; then</span><br><span style="color: hsl(120, 100%, 40%);">+    if [ ! -f build.mak ] ; then</span><br><span style="color: hsl(120, 100%, 40%);">+          exit 0;</span><br><span style="color: hsl(120, 100%, 40%);">+       fi</span><br><span style="color: hsl(120, 100%, 40%);">+    TARGET_NAME=$(${SED} -n -r -e "s/export\s+TARGET_NAME\s*:=\s*(.*)/\1/gp" build.mak)</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+getlibname() {</span><br><span style="color: hsl(120, 100%, 40%);">+   dep="$1"</span><br><span style="color: hsl(120, 100%, 40%);">+    libdir=$(${DIRNAME} $(${DIRNAME} "${dep}"))/lib</span><br><span style="color: hsl(120, 100%, 40%);">+     depname=$(${BASENAME} "${dep}")</span><br><span style="color: hsl(120, 100%, 40%);">+     depprefix="${depname%%-${TARGET_NAME}.depend}"</span><br><span style="color: hsl(120, 100%, 40%);">+      case ${depprefix} in</span><br><span style="color: hsl(120, 100%, 40%);">+          .pjlib)</span><br><span style="color: hsl(120, 100%, 40%);">+                       libfile=libpj</span><br><span style="color: hsl(120, 100%, 40%);">+                 ;;</span><br><span style="color: hsl(120, 100%, 40%);">+            .pjsua-lib)</span><br><span style="color: hsl(120, 100%, 40%);">+                   libfile=libpjsua</span><br><span style="color: hsl(120, 100%, 40%);">+                      ;;</span><br><span style="color: hsl(120, 100%, 40%);">+            .*)</span><br><span style="color: hsl(120, 100%, 40%);">+                   libfile=lib${depprefix#.*}</span><br><span style="color: hsl(120, 100%, 40%);">+                    ;;</span><br><span style="color: hsl(120, 100%, 40%);">+    esac</span><br><span style="color: hsl(120, 100%, 40%);">+  echo "${libdir}/${libfile}-${TARGET_NAME}.a"</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+gendepfile() {</span><br><span style="color: hsl(120, 100%, 40%);">+   pjdf="$1"</span><br><span style="color: hsl(120, 100%, 40%);">+   astdf="${pjdf%*.depend}.astdep"</span><br><span style="color: hsl(120, 100%, 40%);">+     dirname=$(${DIRNAME} "${astdf}")</span><br><span style="color: hsl(120, 100%, 40%);">+    lines=$(grep -E -o -- "[.][.]/[^ ]+" "${pjdf}" | sort -u | wc -l)</span><br><span style="color: hsl(120, 100%, 40%);">+ libname=$(getlibname "${pjdf}")</span><br><span style="color: hsl(120, 100%, 40%);">+     backslash="\\"</span><br><span style="color: hsl(120, 100%, 40%);">+      echo "${libname}: ${backslash}" >"${astdf}"</span><br><span style="color: hsl(120, 100%, 40%);">+    for dep in $(grep -E -o -- "[.][.]/[^ ]+" "${pjdf}" | sort -u) ; do</span><br><span style="color: hsl(120, 100%, 40%);">+               ( echo "${dep}" | grep -Eq "(test|/bin/)" ; ) && continue</span><br><span style="color: hsl(120, 100%, 40%);">+         newdep=$( cd "${dirname}" ; ${REALPATH} -L --relative-to=../../ "${dep}" ; )</span><br><span style="color: hsl(120, 100%, 40%);">+              lines=$(( ${lines} - 1 ))</span><br><span style="color: hsl(120, 100%, 40%);">+             if [ ${lines} -eq 0 ] ; then</span><br><span style="color: hsl(120, 100%, 40%);">+                  echo "source/${newdep}" >>"${astdf}"</span><br><span style="color: hsl(120, 100%, 40%);">+                else</span><br><span style="color: hsl(120, 100%, 40%);">+                  echo "source/${newdep} ${backslash}" >>"${astdf}"</span><br><span style="color: hsl(120, 100%, 40%);">+           fi</span><br><span style="color: hsl(120, 100%, 40%);">+    done</span><br><span style="color: hsl(120, 100%, 40%);">+  echo >>"${astdf}"</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+getpjdepname () {</span><br><span style="color: hsl(120, 100%, 40%);">+     lib="$1"</span><br><span style="color: hsl(120, 100%, 40%);">+    builddir=$(${DIRNAME} $(${DIRNAME} "${lib}"))/build</span><br><span style="color: hsl(120, 100%, 40%);">+ libname=$(${BASENAME} "${lib}")</span><br><span style="color: hsl(120, 100%, 40%);">+     libprefix="${libname%%-${TARGET_NAME}.a}"</span><br><span style="color: hsl(120, 100%, 40%);">+   nolib=$(echo "${libprefix}" | ${SED} -r -e "s@^lib@@g")</span><br><span style="color: hsl(120, 100%, 40%);">+   case ${nolib} in</span><br><span style="color: hsl(120, 100%, 40%);">+              pj)</span><br><span style="color: hsl(120, 100%, 40%);">+                   depfile=.pjlib</span><br><span style="color: hsl(120, 100%, 40%);">+                        ;;</span><br><span style="color: hsl(120, 100%, 40%);">+            pjsua)</span><br><span style="color: hsl(120, 100%, 40%);">+                        depfile=.pjsua-lib</span><br><span style="color: hsl(120, 100%, 40%);">+                    ;;</span><br><span style="color: hsl(120, 100%, 40%);">+            resample)</span><br><span style="color: hsl(120, 100%, 40%);">+                     depfile=resample/.libresample</span><br><span style="color: hsl(120, 100%, 40%);">+                 ;;</span><br><span style="color: hsl(120, 100%, 40%);">+            *)</span><br><span style="color: hsl(120, 100%, 40%);">+                    depfile=.${nolib}</span><br><span style="color: hsl(120, 100%, 40%);">+                     ;;</span><br><span style="color: hsl(120, 100%, 40%);">+    esac</span><br><span style="color: hsl(120, 100%, 40%);">+  echo "${builddir}/${depfile}-${TARGET_NAME}.depend"</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+case $1 in</span><br><span style="color: hsl(120, 100%, 40%);">+        getpjdepname)</span><br><span style="color: hsl(120, 100%, 40%);">+         shift</span><br><span style="color: hsl(120, 100%, 40%);">+         for lib in $@ ; do getpjdepname "${lib}" ; done</span><br><span style="color: hsl(120, 100%, 40%);">+             ;;</span><br><span style="color: hsl(120, 100%, 40%);">+    gendepfile)</span><br><span style="color: hsl(120, 100%, 40%);">+           shift</span><br><span style="color: hsl(120, 100%, 40%);">+         for dep in $@ ; do gendepfile "${dep}" ; done</span><br><span style="color: hsl(120, 100%, 40%);">+               ;;</span><br><span style="color: hsl(120, 100%, 40%);">+    getlibname)</span><br><span style="color: hsl(120, 100%, 40%);">+           shift</span><br><span style="color: hsl(120, 100%, 40%);">+         for dep in $@ ; do getlibname "${dep}" ; done</span><br><span style="color: hsl(120, 100%, 40%);">+               ;;</span><br><span style="color: hsl(120, 100%, 40%);">+    *)</span><br><span style="color: hsl(120, 100%, 40%);">+            echo Invalid command</span><br><span style="color: hsl(120, 100%, 40%);">+          exit 1</span><br><span style="color: hsl(120, 100%, 40%);">+                ;;</span><br><span style="color: hsl(120, 100%, 40%);">+esac</span><br><span></span><br></pre><div style="white-space:pre-wrap"></div><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/17838">change 17838</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/17838"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Idb1251040affdab31d27cd272dda68676da9b268 </div>
<div style="display:none"> Gerrit-Change-Number: 17838 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>