The script contrib/download_prerequisites now accepts the command line
argument '--proxy'. Which instructs the fetcher program to use the
specified proxy.

Signed-off-by: Mert Kirpici <mert.kirp...@protonmail.ch>
---
contrib/download_prerequisites | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/contrib/download_prerequisites b/contrib/download_prerequisites
index 7d0c4b5ea8d..4a297f29dd2 100755
--- a/contrib/download_prerequisites
+++ b/contrib/download_prerequisites
@@ -58,11 +58,6 @@ case $OS in
;;
esac

-if type wget > /dev/null ; then
- fetch='wget'
-else
- fetch='curl -LO'
-fi
chksum_extension='sha512'
directory='.'

@@ -74,6 +69,7 @@ GCC source tree and the GCC build will do the right thing.
The following options are available:

--directory=DIR download and unpack packages into DIR instead of '.'
+ --proxy=URL download via specified http proxy server URL
--force download again overwriting existing packages
--no-force do not download existing packages again (default)
--isl download ISL, needed for Graphite loop optimizations (default)
@@ -143,6 +139,12 @@ do
--directory=*)
directory="${arg#--directory=}"
;;
+ --proxy=*)
+ proxy="${arg#--proxy=}"
+ ;;
+ --proxy)
+ argnext='proxy'
+ ;;
--force)
force=1
;;
@@ -202,6 +204,9 @@ do
directory)
directory="${arg}"
;;
+ proxy)
+ proxy="${arg}"
+ ;;
*)
die "The impossible has happened"
;;
@@ -218,6 +223,14 @@ unset arg argnext
[ -d "${directory}" ] \
|| die "No such directory: ${directory}"

+if type wget > /dev/null ; then
+ fetch='wget'
+ [ -z "${proxy}" ] || fetch="${fetch} -e use_proxy=on -e http_proxy=${proxy}"
+else
+ fetch='curl -LO'
+ [ -z "${proxy}" ] || fetch="${fetch} --proxy ${proxy}"
+fi
+
for ar in $(echo_archives)
do
if [ ${force} -gt 0 ]; then rm -f "${directory}/${ar}"; fi
--
2.20.1

Reply via email to