mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-18 20:37:56 +00:00
Detect both wget/curl and allow user to select the agent
Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
parent
c31ed45a65
commit
35f89c4064
@ -62,6 +62,8 @@ export awk := @AWK@
|
|||||||
export grep := @GREP@
|
export grep := @GREP@
|
||||||
export make := @MAKE@
|
export make := @MAKE@
|
||||||
export sed := @SED@
|
export sed := @SED@
|
||||||
|
export wget := @wget@
|
||||||
|
export curl := @curl@
|
||||||
export libtool := @LIBTOOL@
|
export libtool := @LIBTOOL@
|
||||||
export libtoolize := @LIBTOOLIZE@
|
export libtoolize := @LIBTOOLIZE@
|
||||||
export objcopy := @OBJCOPY@
|
export objcopy := @OBJCOPY@
|
||||||
@ -155,6 +157,7 @@ uninstall: real-uninstall
|
|||||||
# Build rules
|
# Build rules
|
||||||
|
|
||||||
build-bin: $(PROG_NAME) \
|
build-bin: $(PROG_NAME) \
|
||||||
|
scripts/scripts.mk \
|
||||||
scripts/crosstool-NG.sh \
|
scripts/crosstool-NG.sh \
|
||||||
scripts/saveSample.sh \
|
scripts/saveSample.sh \
|
||||||
scripts/showConfig.sh
|
scripts/showConfig.sh
|
||||||
@ -187,6 +190,8 @@ define sed_it
|
|||||||
-e 's,@@CT_make@@,$(make),g;' \
|
-e 's,@@CT_make@@,$(make),g;' \
|
||||||
-e 's,@@CT_bash@@,$(bash),g;' \
|
-e 's,@@CT_bash@@,$(bash),g;' \
|
||||||
-e 's,@@CT_awk@@,$(awk),g;' \
|
-e 's,@@CT_awk@@,$(awk),g;' \
|
||||||
|
-e 's,@@CT_wget@@,$(wget),g;' \
|
||||||
|
-e 's,@@CT_curl@@,$(curl),g;' \
|
||||||
$< >$@
|
$< >$@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
@ -258,6 +263,8 @@ FORCE:
|
|||||||
clean-bin:
|
clean-bin:
|
||||||
@echo " RM '$(PROG_NAME)'"
|
@echo " RM '$(PROG_NAME)'"
|
||||||
@rm -f $(PROG_NAME)
|
@rm -f $(PROG_NAME)
|
||||||
|
@echo " RM 'scripts/scripts.mk'"
|
||||||
|
@rm -f scripts/scripts.mk
|
||||||
@echo " RM 'scripts/crosstool-NG.sh'"
|
@echo " RM 'scripts/crosstool-NG.sh'"
|
||||||
@rm -f scripts/crosstool-NG.sh
|
@rm -f scripts/crosstool-NG.sh
|
||||||
@echo " RM 'scripts/saveSample.sh'"
|
@echo " RM 'scripts/saveSample.sh'"
|
||||||
|
@ -2,6 +2,23 @@
|
|||||||
|
|
||||||
comment "Downloading"
|
comment "Downloading"
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "Download agent"
|
||||||
|
|
||||||
|
config DOWNLOAD_AGENT_WGET
|
||||||
|
bool "wget"
|
||||||
|
depends on CONFIGURE_has_wget
|
||||||
|
|
||||||
|
config DOWNLOAD_AGENT_CURL
|
||||||
|
bool "curl"
|
||||||
|
depends on CONFIGURE_has_curl
|
||||||
|
|
||||||
|
config DOWNLOAD_AGENT_NONE
|
||||||
|
bool "none (forbid download)"
|
||||||
|
select FORBID_DOWNLOAD
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
config FORBID_DOWNLOAD
|
config FORBID_DOWNLOAD
|
||||||
bool
|
bool
|
||||||
prompt "Forbid downloads"
|
prompt "Forbid downloads"
|
||||||
@ -11,7 +28,7 @@ config FORBID_DOWNLOAD
|
|||||||
If you do not have network connectivity when you run crosstool-NG,
|
If you do not have network connectivity when you run crosstool-NG,
|
||||||
and some files are missing, it can be a long time before crosstool-NG
|
and some files are missing, it can be a long time before crosstool-NG
|
||||||
fails.
|
fails.
|
||||||
|
|
||||||
Saying 'y' here will prevent crosstool-NG from downloading missing
|
Saying 'y' here will prevent crosstool-NG from downloading missing
|
||||||
files, thus failing early so that you don't get stuck.
|
files, thus failing early so that you don't get stuck.
|
||||||
|
|
||||||
@ -22,7 +39,7 @@ config FORCE_DOWNLOAD
|
|||||||
prompt "Force downloads"
|
prompt "Force downloads"
|
||||||
help
|
help
|
||||||
Force downloading tarballs, even if one already exists.
|
Force downloading tarballs, even if one already exists.
|
||||||
|
|
||||||
Useful if you suspect a tarball to be damaged.
|
Useful if you suspect a tarball to be damaged.
|
||||||
|
|
||||||
config CONNECT_TIMEOUT
|
config CONNECT_TIMEOUT
|
||||||
@ -31,7 +48,7 @@ config CONNECT_TIMEOUT
|
|||||||
default 10
|
default 10
|
||||||
help
|
help
|
||||||
Maximum time in seconds that you allow the connection to the server to take.
|
Maximum time in seconds that you allow the connection to the server to take.
|
||||||
|
|
||||||
The scenario is as follows;
|
The scenario is as follows;
|
||||||
- some enterprise networks have firewalls that prohibit FTP traffic, while
|
- some enterprise networks have firewalls that prohibit FTP traffic, while
|
||||||
still allowing HTTP
|
still allowing HTTP
|
||||||
@ -39,13 +56,29 @@ config CONNECT_TIMEOUT
|
|||||||
- after this number of seconds, it is considered that the connection could
|
- after this number of seconds, it is considered that the connection could
|
||||||
not be established, and the next URL in the list is tried, until we reach
|
not be established, and the next URL in the list is tried, until we reach
|
||||||
an URL that will go through the firewall, most probably an http:// URL.
|
an URL that will go through the firewall, most probably an http:// URL.
|
||||||
|
|
||||||
If you have a slow network, you'd better set this value higher than the default
|
If you have a slow network, you'd better set this value higher than the default
|
||||||
10s. If you know a firewall is blocking connections, but your network is globally
|
10s. If you know a firewall is blocking connections, but your network is globally
|
||||||
fast, you can try to lower this value to jump more quickly to allowed URLs. YMMV.
|
fast, you can try to lower this value to jump more quickly to allowed URLs. YMMV.
|
||||||
|
|
||||||
If '-1' is specified, no timeout reconfiguration options are passed to wget.
|
If '-1' is specified, no timeout reconfiguration options are passed to wget.
|
||||||
|
|
||||||
|
if DOWNLOAD_AGENT_WGET
|
||||||
|
|
||||||
|
config DOWNLOAD_WGET_OPTIONS
|
||||||
|
string "Extra options to wget"
|
||||||
|
default "--passive-ftp --tries=3 -nc --progress=dot:binary"
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
if DOWNLOAD_AGENT_CURL
|
||||||
|
|
||||||
|
config DOWNLOAD_CURL_OPTIONS
|
||||||
|
string "Extra options to curl"
|
||||||
|
default "--location --ftp-pasv --retry 3 --fail --silent"
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
config ONLY_DOWNLOAD
|
config ONLY_DOWNLOAD
|
||||||
bool
|
bool
|
||||||
prompt "Stop after downloading tarballs"
|
prompt "Stop after downloading tarballs"
|
||||||
|
12
configure.ac
12
configure.ac
@ -218,12 +218,22 @@ ACX_CHECK_PROGS_REQ([makeinfo], [makeinfo])
|
|||||||
ACX_CHECK_PROGS_REQ([cut], [cut])
|
ACX_CHECK_PROGS_REQ([cut], [cut])
|
||||||
ACX_CHECK_PROGS_REQ([stat], [stat])
|
ACX_CHECK_PROGS_REQ([stat], [stat])
|
||||||
ACX_CHECK_PROGS_REQ([readlink], [readlink])
|
ACX_CHECK_PROGS_REQ([readlink], [readlink])
|
||||||
ACX_CHECK_PROGS_REQ([wget], [wget])
|
|
||||||
ACX_CHECK_PROGS_REQ([tar], [tar])
|
ACX_CHECK_PROGS_REQ([tar], [tar])
|
||||||
ACX_CHECK_PROGS_REQ([gzip], [gzip])
|
ACX_CHECK_PROGS_REQ([gzip], [gzip])
|
||||||
ACX_CHECK_PROGS_REQ([bzip2], [bzip2])
|
ACX_CHECK_PROGS_REQ([bzip2], [bzip2])
|
||||||
ACX_CHECK_PROGS_REQ([help2man], [help2man])
|
ACX_CHECK_PROGS_REQ([help2man], [help2man])
|
||||||
|
|
||||||
|
# Not a fatal failure even if we have neither - the tarballs may
|
||||||
|
# be provided in a local directory.
|
||||||
|
AC_CHECK_PROGS([wget], [wget])
|
||||||
|
ACX_SET_KCONFIG_OPTION([wget])
|
||||||
|
AC_SUBST([wget])
|
||||||
|
|
||||||
|
AC_CHECK_PROGS([curl], [curl])
|
||||||
|
ACX_SET_KCONFIG_OPTION([curl])
|
||||||
|
AC_SUBST([curl])
|
||||||
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Still boring, but remember the path, now...
|
# Still boring, but remember the path, now...
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
4
ct-ng.in
4
ct-ng.in
@ -28,7 +28,7 @@ include $(CT_LIB_DIR)/paths.mk
|
|||||||
# Some distributions (eg. Ubuntu) thought it wise to point /bin/sh to
|
# Some distributions (eg. Ubuntu) thought it wise to point /bin/sh to
|
||||||
# a truly POSIX-conforming shell, ash in this case. This is not so good
|
# a truly POSIX-conforming shell, ash in this case. This is not so good
|
||||||
# as we, smart (haha!) developers (as smart we ourselves think we are),
|
# as we, smart (haha!) developers (as smart we ourselves think we are),
|
||||||
# got used to bashisms, and are enclined to easiness... So force use of
|
# got used to bashisms, and are inclined to easiness... So force use of
|
||||||
# bash.
|
# bash.
|
||||||
export SHELL=$(bash)
|
export SHELL=$(bash)
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ export SHELL=$(bash)
|
|||||||
# We do not need any GREP_OPTIONS anyway, so set it to empty.
|
# We do not need any GREP_OPTIONS anyway, so set it to empty.
|
||||||
export GREP_OPTIONS=
|
export GREP_OPTIONS=
|
||||||
|
|
||||||
# Make the restart/stop steps availabe to scripts/crostool-NG.sh
|
# Make the restart/stop steps available to scripts/crostool-NG.sh
|
||||||
export CT_STOP:=$(STOP)
|
export CT_STOP:=$(STOP)
|
||||||
export CT_RESTART:=$(RESTART)
|
export CT_RESTART:=$(RESTART)
|
||||||
|
|
||||||
|
@ -663,29 +663,34 @@ CT_DoGetFile() {
|
|||||||
local url="${1}"
|
local url="${1}"
|
||||||
local dest="${CT_TARBALLS_DIR}/${url##*/}"
|
local dest="${CT_TARBALLS_DIR}/${url##*/}"
|
||||||
local tmp="${dest}.tmp-dl"
|
local tmp="${dest}.tmp-dl"
|
||||||
|
local ok
|
||||||
|
local T
|
||||||
|
|
||||||
# Remove potential left-over from a previous run
|
# Remove potential left-over from a previous run
|
||||||
rm -f "${tmp}"
|
rm -f "${tmp}"
|
||||||
|
|
||||||
# We also retry a few times, in case there is a transient error (eg. behind
|
# Replace a special value of '-1' with empty string
|
||||||
# a dynamic IP that changes during the transfer...)
|
if [ ${CT_CONNECT_TIMEOUT} != -1 ]; then
|
||||||
# With automated download as we are doing, it can be very dangerous to
|
T="${CT_CONNECT_TIMEOUT}"
|
||||||
# continue the downloads. It's far better to simply overwrite the
|
|
||||||
# destination file.
|
|
||||||
# Some company networks have firewalls to connect to the internet, but it's
|
|
||||||
# not easy to detect them, so force a global ${CT_CONNECT_TIMEOUT}-second
|
|
||||||
# timeout.
|
|
||||||
if [ ${CT_CONNECT_TIMEOUT} = -1 ]; then
|
|
||||||
T=
|
|
||||||
else
|
|
||||||
T="-T ${CT_CONNECT_TIMEOUT}"
|
|
||||||
fi
|
fi
|
||||||
if CT_DoExecLog ALL wget --passive-ftp --tries=3 -nc \
|
|
||||||
--progress=dot:binary \
|
if [ "${CT_DOWNLOAD_AGENT_WGET}" = "y" ]; then
|
||||||
${T} \
|
if CT_DoExecLog ALL wget ${CT_DOWNLOAD_WGET_OPTIONS} \
|
||||||
-O "${tmp}" \
|
${T:+-T ${T}} \
|
||||||
"${url}"
|
-O "${tmp}" \
|
||||||
then
|
"${url}"; then
|
||||||
|
ok=y
|
||||||
|
fi
|
||||||
|
elif [ "${CT_DOWNLOAD_AGENT_CURL}" = "y" ]; then
|
||||||
|
if CT_DoExecLog ALL curl ${CT_DOWNLOAD_CURL_OPTIONS} \
|
||||||
|
${T:+--connect-timeout ${T}} \
|
||||||
|
-o "${tmp}" \
|
||||||
|
"${url}"; then
|
||||||
|
ok=y
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${ok}" = "y" ]; then
|
||||||
# Success, we got it, good!
|
# Success, we got it, good!
|
||||||
mv "${tmp}" "${dest}"
|
mv "${tmp}" "${dest}"
|
||||||
CT_DoLog DEBUG "Got it from: \"${url}\""
|
CT_DoLog DEBUG "Got it from: \"${url}\""
|
||||||
|
@ -26,9 +26,19 @@ updatetools: $(CONFIG_SUB_DEST) $(CONFIG_GUESS_DEST)
|
|||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
# How to retrieve the tools
|
# How to retrieve the tools
|
||||||
|
|
||||||
wget_opt=-o /dev/null
|
ifneq ($(strip $(V)),2)
|
||||||
ifeq ($(strip $(V)),2)
|
wget_silent_opt = -o /dev/null
|
||||||
wget_opt=
|
curl_silent_opt = --silent
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq (@@CT_wget@@,)
|
||||||
|
download_cmd = wget --passive-ftp $(wget_silent_opt) -O $@
|
||||||
|
else
|
||||||
|
ifneq (@@CT_curl@@,)
|
||||||
|
download_cmd = curl --ftp-pasv $(curl_silent_opt) -o $@
|
||||||
|
else
|
||||||
|
download_cmd = $(error wget or curl needed for downloads)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
PHONY += scripts
|
PHONY += scripts
|
||||||
@ -37,13 +47,13 @@ scripts:
|
|||||||
$(SILENT)mkdir -p $@
|
$(SILENT)mkdir -p $@
|
||||||
|
|
||||||
$(CONFIG_SUB_DEST): scripts FORCE
|
$(CONFIG_SUB_DEST): scripts FORCE
|
||||||
@$(CT_ECHO) ' WGET $@'
|
@$(CT_ECHO) ' DOWNLOAD $@'
|
||||||
$(SILENT)wget $(wget_opt) -O $@ $(CONFIG_SUB_SRC)
|
$(SILENT)$(download_cmd) $(CONFIG_SUB_SRC)
|
||||||
$(SILENT)chmod u+rwx,go+rx-w $@
|
$(SILENT)chmod u+rwx,go+rx-w $@
|
||||||
|
|
||||||
$(CONFIG_GUESS_DEST): scripts FORCE
|
$(CONFIG_GUESS_DEST): scripts FORCE
|
||||||
@$(CT_ECHO) ' WGET $@'
|
@$(CT_ECHO) ' DOWNLOAD $@'
|
||||||
$(SILENT)wget $(wget_opt) -O $@ $(CONFIG_GUESS_SRC)
|
$(SILENT)$(download_cmd) $(CONFIG_GUESS_SRC)
|
||||||
$(SILENT)chmod u+rwx,go+rx-w $@
|
$(SILENT)chmod u+rwx,go+rx-w $@
|
||||||
|
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
Loading…
Reference in New Issue
Block a user