]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
configure: Add --with-download-cache option
authorGeorge Joseph <gjoseph@digium.com>
Wed, 9 Aug 2017 13:01:33 +0000 (07:01 -0600)
committerGeorge Joseph <gjoseph@digium.com>
Wed, 9 Aug 2017 13:01:33 +0000 (07:01 -0600)
To make building without an internet connection easier, a new
./configure option '--with-download-cache' was added that sets
the cache for externals (like pjproject, the codecs and the DPMA),
AND the sounds files.  It can also be specified as an environment
variable named "AST_DOWNLOAD_CACHE".  The existing
'--with-sounds-cache' option / SOUNDS_CACHE_DIR env variable and
'--with-externals-cache' option / EXTERNALS_CACHE_DIR env variable
remain and if specified, will override '--with-downloads-cache'.

Change-Id: I5c3cf15ee61e8fe191b52732303e969854f8d861

CHANGES
build_tools/download_externals
build_tools/list_valid_installed_externals
configure
configure.ac
makeopts.in
third-party/pjproject/configure.m4

diff --git a/CHANGES b/CHANGES
index c56d7f0afe3f5374e43ad7955b5929e7ccc2796f..3cc0ee6539d63826d53d64956683d37823501b61 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -17,6 +17,13 @@ Core
  * VP9 is now a supported passthrough video codec and it can be used by
    specifying "vp9" in the allow line.
 
+Build System
+------------------
+ * A '--with-download-cache' option is now available which is equivalent to
+   setting '--with-sounds-cache' and '--with-externals-cache' to the same
+   value.  The download cache can also be set via the AST_DOWNLOAD_CACHE
+   environment variable.
+
 res_pjsip
 ------------------
  * The "external_media_address" on transports is now resolved using dnsmgr and
index b0a414ed1fd7bf3ff95155897ca5bfd0bbc2957b..f6cc52390753542559a113ab674f5d1733905b7a 100755 (executable)
@@ -26,7 +26,11 @@ if [[ -z "${tmpdir}" ]] ; then
 fi
 trap "rm -rf ${tmpdir}" EXIT
 
-sed -r -e "s/^([^ =]+)\s*=\s*(.*)$/\1=\"\2\"/g" ${ASTTOPDIR}/makeopts >${tmpdir}/makeopts
+# We have to pre-process the makeopts file so it will be parsable by bash
+# Surround values with double quotes
+# Convert make  $(or) functions to bash ${name:-value}
+sed -r  -e "s/^([^ =]+)\s*=\s*(.*)$/\1=\"\2\"/g" \
+       -e 's/^([^ =]+)="\$\(or ([^,]*),([^)]+)\)"/_tmp="\2"\n\1="${_tmp:-\3}"/g'  ${ASTTOPDIR}/makeopts >${tmpdir}/makeopts
 source ${tmpdir}/makeopts
 if [[ -z "${ASTMODDIR}" ]] ; then
        echo "${module_name}: Unable to parse ${ASTTOPDIR}/makeopts."
index 12aff3f95a05657f04857505ff4d697b57d9bf80..194801c94aeef450a6f188e409f332fd81cd8a35 100755 (executable)
@@ -14,7 +14,11 @@ if [[ -z "${tmpdir}" ]] ; then
 fi
 trap "rm -rf ${tmpdir}" EXIT
 
-sed -r -e "s/^([^ =]+)\s*=\s*(.*)$/\1=\"\2\"/g" ${ASTTOPDIR}/makeopts >${tmpdir}/makeopts
+# We have to pre-process the makeopts file so it will be parsable by bash
+# Surround values with double quotes
+# Convert make  $(or) functions to bash ${name:-value}
+sed -r  -e "s/^([^ =]+)\s*=\s*(.*)$/\1=\"\2\"/g" \
+       -e 's/^([^ =]+)="\$\(or ([^,]*),([^)]+)\)"/_tmp="\2"\n\1="${_tmp:-\3}"/g'  ${ASTTOPDIR}/makeopts >${tmpdir}/makeopts
 source ${tmpdir}/makeopts
 if [[ -z "${ASTMODDIR}" ]] ; then
        echo "${module_name}: Unable to parse ${ASTTOPDIR}/makeopts."
index 50b2ff8af30364d9178f32462a4501e7e55e7da9..8308b9ef68fd58f764a908a6072fdaaaa0cc3e91 100755 (executable)
--- a/configure
+++ b/configure
@@ -1200,6 +1200,7 @@ AST_NESTED_FUNCTIONS
 AST_CODE_COVERAGE
 EXTERNALS_CACHE_DIR
 SOUNDS_CACHE_DIR
+AST_DOWNLOAD_CACHE
 AST_DEVMODE_STRICT
 AST_DEVMODE
 NOISY_BUILD
@@ -1353,6 +1354,7 @@ ac_user_opts='
 enable_option_checking
 with_gnu_ld
 enable_dev_mode
+with_download_cache
 with_sounds_cache
 with_externals_cache
 enable_coverage
@@ -2096,6 +2098,9 @@ Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-download-cache=PATH
+                          use cached sound AND external module tarfiles in
+                          PATH
   --with-sounds-cache=PATH
                           use cached sound tarfiles in PATH
   --with-externals-cache=PATH
@@ -9016,6 +9021,30 @@ fi
 
 
 
+# Check whether --with-download-cache was given.
+if test "${with_download_cache+set}" = set; then :
+  withval=$with_download_cache;
+       case ${withval} in
+       n|no)
+               unset AST_DOWNLOAD_CACHE
+               ;;
+       *)
+               if test "x${withval}" = "x"; then
+                       :
+               else
+                       AST_DOWNLOAD_CACHE="${withval}"
+               fi
+               ;;
+       esac
+
+else
+  :
+fi
+
+
+
+
+
 # Check whether --with-sounds-cache was given.
 if test "${with_sounds_cache+set}" = set; then :
   withval=$with_sounds_cache;
@@ -9278,11 +9307,11 @@ $as_echo "configuring" >&6; }
                PJPROJECT_CONFIGURE_OPTS+=" --host=$host"
        fi
 
-       export TAR PATCH SED NM EXTERNALS_CACHE_DIR DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT
+       export TAR PATCH SED NM EXTERNALS_CACHE_DIR AST_DOWNLOAD_CACHE DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT
        export NOISY_BUILD
        ${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} \
                PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" \
-               EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR}" \
+               EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" \
                configure
        if test $? -ne 0 ; then
                { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
@@ -9295,7 +9324,7 @@ $as_echo "$as_me: Unable to configure ${PJPROJECT_DIR}" >&6;}
        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bundled pjproject" >&5
 $as_echo_n "checking for bundled pjproject... " >&6; }
 
-       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)
+       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)
        PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE"
        PBX_PJPROJECT=1
 
index 96f635a24d62597e2b2a20f4c98b01a9e3b3fa95..6c5f4e3cb41038a284d84f5cc6eea61217f8cb8f 100644 (file)
@@ -408,6 +408,7 @@ AC_SUBST(NOISY_BUILD)
 AC_SUBST(AST_DEVMODE)
 AC_SUBST(AST_DEVMODE_STRICT)
 
+AST_OPTION_ONLY([download-cache], [AST_DOWNLOAD_CACHE], [cached sound AND external module tarfiles], [])
 AST_OPTION_ONLY([sounds-cache], [SOUNDS_CACHE_DIR], [cached sound tarfiles], [])
 AST_OPTION_ONLY([externals-cache], [EXTERNALS_CACHE_DIR], [cached external module tarfiles], [])
 
index c615a4a996ef110ed578280cc75ad0ba050b7ac9..4baefa298a54ceced83fe6fe4ce28464be3442dd 100644 (file)
@@ -29,8 +29,9 @@ FETCH=@FETCH@
 DOWNLOAD=@DOWNLOAD@
 DOWNLOAD_TO_STDOUT=@DOWNLOAD_TO_STDOUT@
 DOWNLOAD_TIMEOUT=@DOWNLOAD_TIMEOUT@
-SOUNDS_CACHE_DIR=@SOUNDS_CACHE_DIR@
-EXTERNALS_CACHE_DIR=@EXTERNALS_CACHE_DIR@
+AST_DOWNLOAD_CACHE=@AST_DOWNLOAD_CACHE@
+SOUNDS_CACHE_DIR=$(or @SOUNDS_CACHE_DIR@,${AST_DOWNLOAD_CACHE})
+EXTERNALS_CACHE_DIR=$(or @EXTERNALS_CACHE_DIR@,${AST_DOWNLOAD_CACHE})
 RUBBER=@RUBBER@
 CATDVI=@CATDVI@
 KPATHSEA=@KPATHSEA@
index 709a706a1b0a218f6a062dd2891941d385b4062d..2d3353476e9e70412cfa531dfdb5e7c6a7465b0d 100644 (file)
@@ -49,11 +49,11 @@ AC_DEFUN([_PJPROJECT_CONFIGURE],
                PJPROJECT_CONFIGURE_OPTS+=" --host=$host"
        fi
 
-       export TAR PATCH SED NM EXTERNALS_CACHE_DIR DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT
+       export TAR PATCH SED NM EXTERNALS_CACHE_DIR AST_DOWNLOAD_CACHE DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT
        export NOISY_BUILD
        ${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} \
                PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" \
-               EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR}" \
+               EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" \
                configure
        if test $? -ne 0 ; then
                AC_MSG_RESULT(failed)
@@ -63,7 +63,7 @@ AC_DEFUN([_PJPROJECT_CONFIGURE],
 
        AC_MSG_CHECKING(for bundled pjproject)
 
-       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)
+       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)
        PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE"
        PBX_PJPROJECT=1