diff --git a/build_tools/download_externals b/build_tools/download_externals index f6cc52390753542559a113ab674f5d1733905b7a..efeb6c53c6ffc2b5bbee0298be1c296f4f34fb83 100755 --- a/build_tools/download_externals +++ b/build_tools/download_externals @@ -5,7 +5,24 @@ if [[ ( ${BASH_VERSINFO[0]} == 4 && ${BASH_VERSINFO[1]} > 1 ) || ${BASH_VERSINFO fi set -e + ASTTOPDIR=${ASTTOPDIR:-.} +export make=`sed -n -r -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` +cache_dir=`getvar EXTERNALS_CACHE_DIR` +DOWNLOAD_TO_STDOUT=`getvar DOWNLOAD_TO_STDOUT` +HOST_CPU=`getvar HOST_CPU` +INSTALL=`getvar INSTALL` module_name=${1%%-*} variant=${1##*-} @@ -26,24 +43,16 @@ if [[ -z "${tmpdir}" ]] ; then fi trap "rm -rf ${tmpdir}" EXIT -# 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." exit 1 fi -XMLSTARLET=${XMLSTARLET:-xmlstarlet} if [[ "${XMLSTARLET}" = ":" ]] ; then echo "${module_name}: The externals downloader requires xmlstarlet to be installed." exit 1 fi -cache_dir="${EXTERNALS_CACHE_DIR}" if [[ -z ${cache_dir} ]] ; then cache_dir=${tmpdir} fi @@ -191,7 +200,7 @@ if [[ -f ${cache_dir}/${full_name}.manifest.xml ]] ; then fi if [[ ${need_download} = 1 ]] ; then - echo "${full_name}: Downloading ${remote_url}/${tarball}" + echo "${full_name}: Downloading ${remote_url}/${tarball} to ${cache_dir}/${tarball}" ${DOWNLOAD_TO_STDOUT} ${remote_url}/${tarball} > ${cache_dir}/${tarball} || { echo "${full_name}: Unable to fetch ${remote_url}/${tarball}" exit 1 diff --git a/build_tools/list_valid_installed_externals b/build_tools/list_valid_installed_externals index 194801c94aeef450a6f188e409f332fd81cd8a35..ed362743ca812d3d54034d50f623f7b0dcc3485c 100755 --- a/build_tools/list_valid_installed_externals +++ b/build_tools/list_valid_installed_externals @@ -6,6 +6,23 @@ fi set -e ASTTOPDIR=${ASTTOPDIR:-.} +export make=`sed -n -r -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` +cache_dir=`getvar EXTERNALS_CACHE_DIR` +DOWNLOAD_TO_STDOUT=`getvar DOWNLOAD_TO_STDOUT` +HOST_CPU=`getvar HOST_CPU` +INSTALL=`getvar INSTALL` tmpdir=$(mktemp -d) if [[ -z "${tmpdir}" ]] ; then @@ -14,18 +31,11 @@ if [[ -z "${tmpdir}" ]] ; then fi trap "rm -rf ${tmpdir}" EXIT -# 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." exit 1 fi -XMLSTARLET=${XMLSTARLET:-xmlstarlet} if [[ "${XMLSTARLET}" = ":" ]] ; then echo "${module_name}: The externals downloader requires xmlstarlet to be installed." exit 1