public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] download_prerequisites: Add option --proxy
@ 2020-08-17  8:54 Mert Kirpici
  0 siblings, 0 replies; only message in thread
From: Mert Kirpici @ 2020-08-17  8:54 UTC (permalink / raw)
  To: gcc-patches

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.kirpici@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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-17  8:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-17  8:54 [PATCH] download_prerequisites: Add option --proxy Mert Kirpici

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).