CI: Various updates to buildAsterisk.sh
[asterisk/asterisk.git] / build_tools / list_valid_installed_externals
index 12aff3f..862447a 100755 (executable)
@@ -6,6 +6,20 @@ fi
 set -e
 
 ASTTOPDIR=${ASTTOPDIR:-.}
+export make=`sed -n -e "s/^MAKE\s*=\s*//gp" ${ASTTOPDIR}/makeopts`
+
+getvar() {
+       $make --quiet --no-print-directory -f- <<EOF
+include ${ASTTOPDIR}/makeopts
+all:
+       @echo "\$($1)"
+EOF
+}
+
+
+XMLSTARLET=`getvar XMLSTARLET`
+ASTMODDIR=`getvar ASTMODDIR`
+HOST_CPU=`getvar HOST_CPU`
 
 tmpdir=$(mktemp -d)
 if [[ -z "${tmpdir}" ]] ; then
@@ -14,14 +28,11 @@ if [[ -z "${tmpdir}" ]] ; then
 fi
 trap "rm -rf ${tmpdir}" EXIT
 
-sed -r -e "s/^([^ =]+)\s*=\s*(.*)$/\1=\"\2\"/g" ${ASTTOPDIR}/makeopts >${tmpdir}/makeopts
-source ${tmpdir}/makeopts
 if [[ -z "${ASTMODDIR}" ]] ; then
        echo "${module_name}: Unable to parse ${ASTTOPDIR}/makeopts."
        exit 1
 fi
 
-XMLSTARLET=${XMLSTARLET:-xmlstarlet}
 if [[ "${XMLSTARLET}" = ":" ]] ; then
        echo "${module_name}: The externals downloader requires xmlstarlet to be installed."
        exit 1