<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/6183">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">configure:  Add --with-download-cache option<br><br>To make building without an internet connection easier, a new<br>./configure option '--with-download-cache' was added that sets<br>the cache for externals (like pjproject, the codecs and the DPMA),<br>AND the sounds files.  It can also be specified as an environment<br>variable named "AST_DOWNLOAD_CACHE".  The existing<br>'--with-sounds-cache' option / SOUNDS_CACHE_DIR env variable and<br>'--with-externals-cache' option / EXTERNALS_CACHE_DIR env variable<br>remain and if specified, will override '--with-downloads-cache'.<br><br>Change-Id: I5c3cf15ee61e8fe191b52732303e969854f8d861<br>---<br>M CHANGES<br>M build_tools/download_externals<br>M build_tools/list_valid_installed_externals<br>M configure<br>M configure.ac<br>M makeopts.in<br>M third-party/pjproject/configure.m4<br>7 files changed, 56 insertions(+), 10 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/83/6183/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/CHANGES b/CHANGES<br>index daef588..caf0e5d 100644<br>--- a/CHANGES<br>+++ b/CHANGES<br>@@ -17,6 +17,13 @@<br>  * VP9 is now a supported passthrough video codec and it can be used by<br>    specifying "vp9" in the allow line.<br> <br>+Build System<br>+------------------<br>+ * A '--with-download-cache' option is now available which is equivalent to<br>+   setting '--with-sounds-cache' and '--with-externals-cache' to the same<br>+   value.  The download cache can also be set via the AST_DOWNLOAD_CACHE<br>+   environment variable.<br>+<br> res_pjsip<br> ------------------<br>  * The "external_media_address" on transports is now resolved using dnsmgr and<br>diff --git a/build_tools/download_externals b/build_tools/download_externals<br>index b0a414e..f6cc523 100755<br>--- a/build_tools/download_externals<br>+++ b/build_tools/download_externals<br>@@ -26,7 +26,11 @@<br> fi<br> trap "rm -rf ${tmpdir}" EXIT<br> <br>-sed -r -e "s/^([^ =]+)\s*=\s*(.*)$/\1=\"\2\"/g" ${ASTTOPDIR}/makeopts >${tmpdir}/makeopts<br>+# We have to pre-process the makeopts file so it will be parsable by bash<br>+# Surround values with double quotes<br>+# Convert make  $(or) functions to bash ${name:-value}<br>+sed -r  -e "s/^([^ =]+)\s*=\s*(.*)$/\1=\"\2\"/g" \<br>+  -e 's/^([^ =]+)="\$\(or ([^,]*),([^)]+)\)"/_tmp="\2"\n\1="${_tmp:-\3}"/g'  ${ASTTOPDIR}/makeopts >${tmpdir}/makeopts<br> source ${tmpdir}/makeopts<br> if [[ -z "${ASTMODDIR}" ]] ; then<br>       echo "${module_name}: Unable to parse ${ASTTOPDIR}/makeopts."<br>diff --git a/build_tools/list_valid_installed_externals b/build_tools/list_valid_installed_externals<br>index 12aff3f..194801c 100755<br>--- a/build_tools/list_valid_installed_externals<br>+++ b/build_tools/list_valid_installed_externals<br>@@ -14,7 +14,11 @@<br> fi<br> trap "rm -rf ${tmpdir}" EXIT<br> <br>-sed -r -e "s/^([^ =]+)\s*=\s*(.*)$/\1=\"\2\"/g" ${ASTTOPDIR}/makeopts >${tmpdir}/makeopts<br>+# We have to pre-process the makeopts file so it will be parsable by bash<br>+# Surround values with double quotes<br>+# Convert make  $(or) functions to bash ${name:-value}<br>+sed -r  -e "s/^([^ =]+)\s*=\s*(.*)$/\1=\"\2\"/g" \<br>+        -e 's/^([^ =]+)="\$\(or ([^,]*),([^)]+)\)"/_tmp="\2"\n\1="${_tmp:-\3}"/g'  ${ASTTOPDIR}/makeopts >${tmpdir}/makeopts<br> source ${tmpdir}/makeopts<br> if [[ -z "${ASTMODDIR}" ]] ; then<br>       echo "${module_name}: Unable to parse ${ASTTOPDIR}/makeopts."<br>diff --git a/configure b/configure<br>index ae9c51b..472a322 100755<br>--- a/configure<br>+++ b/configure<br>@@ -1216,6 +1216,7 @@<br> AST_CODE_COVERAGE<br> EXTERNALS_CACHE_DIR<br> SOUNDS_CACHE_DIR<br>+AST_DOWNLOAD_CACHE<br> AST_DEVMODE_STRICT<br> AST_DEVMODE<br> NOISY_BUILD<br>@@ -1369,6 +1370,7 @@<br> enable_option_checking<br> with_gnu_ld<br> enable_dev_mode<br>+with_download_cache<br> with_sounds_cache<br> with_externals_cache<br> enable_coverage<br>@@ -2113,6 +2115,9 @@<br>   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]<br>   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)<br>   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]<br>+  --with-download-cache=PATH<br>+                          use cached sound AND external module tarfiles in<br>+                          PATH<br>   --with-sounds-cache=PATH<br>                           use cached sound tarfiles in PATH<br>   --with-externals-cache=PATH<br>@@ -9037,6 +9042,30 @@<br> <br> <br> <br>+# Check whether --with-download-cache was given.<br>+if test "${with_download_cache+set}" = set; then :<br>+  withval=$with_download_cache;<br>+        case ${withval} in<br>+   n|no)<br>+                unset AST_DOWNLOAD_CACHE<br>+             ;;<br>+   *)<br>+           if test "x${withval}" = "x"; then<br>+                        :<br>+            else<br>+                 AST_DOWNLOAD_CACHE="${withval}"<br>+            fi<br>+           ;;<br>+   esac<br>+<br>+else<br>+  :<br>+fi<br>+<br>+<br>+<br>+<br>+<br> # Check whether --with-sounds-cache was given.<br> if test "${with_sounds_cache+set}" = set; then :<br>   withval=$with_sounds_cache;<br>@@ -9299,11 +9328,11 @@<br>               PJPROJECT_CONFIGURE_OPTS+=" --host=$host"<br>   fi<br> <br>-        export TAR PATCH SED NM EXTERNALS_CACHE_DIR DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT<br>+     export TAR PATCH SED NM EXTERNALS_CACHE_DIR AST_DOWNLOAD_CACHE DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT<br>   export NOISY_BUILD<br>    ${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} \<br>                PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" \<br>-             EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR}" \<br>+             EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" \<br>               configure<br>     if test $? -ne 0 ; then<br>               { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5<br>@@ -9316,7 +9345,7 @@<br>  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bundled pjproject" >&5<br> $as_echo_n "checking for bundled pjproject... " >&6; }<br> <br>-   PJPROJECT_INCLUDE=$(${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR}" echo_cflags)<br>+  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)<br>    PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE"<br>       PBX_PJPROJECT=1<br> <br>diff --git a/configure.ac b/configure.ac<br>index f53e563..d5464da 100644<br>--- a/configure.ac<br>+++ b/configure.ac<br>@@ -407,6 +407,7 @@<br> AC_SUBST(AST_DEVMODE)<br> AC_SUBST(AST_DEVMODE_STRICT)<br> <br>+AST_OPTION_ONLY([download-cache], [AST_DOWNLOAD_CACHE], [cached sound AND external module tarfiles], [])<br> AST_OPTION_ONLY([sounds-cache], [SOUNDS_CACHE_DIR], [cached sound tarfiles], [])<br> AST_OPTION_ONLY([externals-cache], [EXTERNALS_CACHE_DIR], [cached external module tarfiles], [])<br> <br>diff --git a/makeopts.in b/makeopts.in<br>index 9686826..913771b 100644<br>--- a/makeopts.in<br>+++ b/makeopts.in<br>@@ -29,8 +29,9 @@<br> DOWNLOAD=@DOWNLOAD@<br> DOWNLOAD_TO_STDOUT=@DOWNLOAD_TO_STDOUT@<br> DOWNLOAD_TIMEOUT=@DOWNLOAD_TIMEOUT@<br>-SOUNDS_CACHE_DIR=@SOUNDS_CACHE_DIR@<br>-EXTERNALS_CACHE_DIR=@EXTERNALS_CACHE_DIR@<br>+AST_DOWNLOAD_CACHE=@AST_DOWNLOAD_CACHE@<br>+SOUNDS_CACHE_DIR=$(or @SOUNDS_CACHE_DIR@,${AST_DOWNLOAD_CACHE})<br>+EXTERNALS_CACHE_DIR=$(or @EXTERNALS_CACHE_DIR@,${AST_DOWNLOAD_CACHE})<br> RUBBER=@RUBBER@<br> CATDVI=@CATDVI@<br> KPATHSEA=@KPATHSEA@<br>diff --git a/third-party/pjproject/configure.m4 b/third-party/pjproject/configure.m4<br>index 709a706..2d33534 100644<br>--- a/third-party/pjproject/configure.m4<br>+++ b/third-party/pjproject/configure.m4<br>@@ -49,11 +49,11 @@<br>            PJPROJECT_CONFIGURE_OPTS+=" --host=$host"<br>   fi<br> <br>-        export TAR PATCH SED NM EXTERNALS_CACHE_DIR DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT<br>+     export TAR PATCH SED NM EXTERNALS_CACHE_DIR AST_DOWNLOAD_CACHE DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT<br>   export NOISY_BUILD<br>    ${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} \<br>                PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" \<br>-             EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR}" \<br>+             EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" \<br>               configure<br>     if test $? -ne 0 ; then<br>               AC_MSG_RESULT(failed)<br>@@ -63,7 +63,7 @@<br> <br>   AC_MSG_CHECKING(for bundled pjproject)<br> <br>-    PJPROJECT_INCLUDE=$(${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR}" echo_cflags)<br>+  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)<br>    PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE"<br>       PBX_PJPROJECT=1<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6183">change 6183</a>. To unsubscribe, 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/6183"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 14 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I5c3cf15ee61e8fe191b52732303e969854f8d861 </div>
<div style="display:none"> Gerrit-Change-Number: 6183 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>