diff options
author | Patrick Georgi <pgeorgi@chromium.org> | 2017-01-07 09:28:43 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2017-01-10 14:43:49 +0100 |
commit | df1ff231e4d378f25ba0d986191287a3af690a68 (patch) | |
tree | 74851d6001702d82b5f42997f903a9ceb4c0ac55 | |
parent | 3d0288d6767fc4b0ddeb270392a22bf1894767cd (diff) |
buildgcc: try curl if wget is not present
There are systems that come with curl but not wget (eg macOS) and they
now have to install one less additional dependency.
Also fix some cosmetic issues in console output and require valid
certificates on https downloads.
Change-Id: Idc2ce892fbb6629aebfe1ae2a95dcef4d5d93aca
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-on: https://review.coreboot.org/18048
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
-rwxr-xr-x | util/crossgcc/buildgcc | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc index 0dfca26e04..1cefcd5768 100755 --- a/util/crossgcc/buildgcc +++ b/util/crossgcc/buildgcc @@ -130,9 +130,9 @@ please_install() *) solution="using your OS packaging system" ;; esac - printf "${RED}ERROR:${red} Missing tool: Please install \'$1\'. (eg $solution)${NC}\n" >&2 + printf "${RED}ERROR:${red} Missing tool: Please install '$1'. (eg $solution)${NC}\n" >&2 if [ -n "$2" ]; then - printf "${RED}ERROR:${red} or install \'$2\'.${NC}\n" >&2 + printf "${RED}ERROR:${red} or install '$2'.${NC}\n" >&2 fi } @@ -282,15 +282,6 @@ compute_sum() { printf "(checksum created. ${RED}Note. Please upload sum/$1.cksum if the corresponding archive is upgraded.)${NC}" } -download_showing_percentage() { - url=$1 - printf " ..${red} 0%%" - wget --no-check-certificate $url 2>&1 | while read line; do - echo $line | grep -o "[0-9]\+%" | awk '{printf("\b\b\b\b%4s", $1)}' - done - printf "${NC}" -} - download() { package=$1 archive="$(eval echo \$$package"_ARCHIVE")" @@ -299,7 +290,7 @@ download() { printf " * $FILE " if test -f tarballs/$FILE && check_sum $FILE ; then - printf "(cached)" + echo "(cached)" else printf "(downloading from $archive)" rm -f tarballs/$FILE @@ -310,10 +301,9 @@ download() { fi if [ ! -f tarballs/$FILE ]; then - printf "\n${RED}Failed to download $FILE.${NC}\n" + printf "${RED}Failed to download $FILE.${NC}\n" exit 1 fi - printf "\n" } unpack_and_patch() { @@ -891,9 +881,25 @@ searchtool flex flex > /dev/null searchtool g++ "Free Software Foundation" nofail > /dev/null || \ searchtool clang "clang version" nofail > /dev/null || \ searchtool clang "LLVM" "" "g++" > /dev/null -searchtool wget > /dev/null searchtool bzip2 "bzip2," > /dev/null +if searchtool wget "GNU" nofail > /dev/null; then + download_showing_percentage() { + url=$1 + printf " ..${red} 0%%" + wget $url 2>&1 | while read line; do + echo $line | grep -o "[0-9]\+%" | awk '{printf("\b\b\b\b%4s", $1)}' + done + echo "${NC}" + } +elif searchtool curl "^curl " > /dev/null; then + download_showing_percentage() { + url=$1 + echo + curl -#OL $url + } +fi + check_for_library "-lz" "zlib (zlib1g-dev or zlib-devel)" CC=cc |