Joseph Myers <jos...@codesourcery.com> writes:

> On Sun, 11 Sep 2016, Moritz Klammler wrote:
>
>> gmp='gmp-4.3.2.tar.bz2'
>> mpfr='mpfr-2.4.2.tar.bz2'
>> mpc='mpc-0.8.1.tar.gz'
>> isl='isl-0.15.tar.bz2'
>
> These are not the versions used in the current script (given which,
> presumably you need to check for any other changes to the script since
> you started work on your version that need to be reflected in it).

Thanks for checking, you're right; I should have checked that.  I
couldn't spot any other relevant changes, however.

Attached is the patch for the updated script.  FWIW, I have also tested
bootstrapping the default configuration plus `--disable-multilib` on
x86_64 GNU/Linux.

I have made an actual diff now, containing also the checksum files.  I
can make no guarantees that these are accurate, though.  I've simply
downloaded them over the same insecure FTP connection that is used to
download the archives the signatures are supposed to verify.  Please
somebody with a means of doing so double-check the signature files.


Index: contrib/download_prerequisites
===================================================================
--- contrib/download_prerequisites	(revision 240106)
+++ contrib/download_prerequisites	(working copy)
@@ -1,60 +1,211 @@
-#! /bin/sh
+#! /bin/sh -eu
+#! -*- coding:utf-8; mode:shell-script; -*-
 
-# Download some prerequisites needed by gcc.
-# Run this from the top level of the gcc source tree and the gcc
-# build will do the right thing.
+# Download some prerequisites needed by GCC.
+# Run this from the top level of the GCC source tree and the GCC build will do
+# the right thing.  Run it with the `--help` option for more information.
 #
-# (C) 2010-2016 Free Software Foundation
+# (C) 2016 Free Software Foundation
 #
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see http://www.gnu.org/licenses/.
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program.  If not, see http://www.gnu.org/licenses/.
 
-# If you want to disable Graphite loop optimizations while building GCC,
-# DO NOT set GRAPHITE_LOOP_OPT as yes so that the isl package will not
-# be downloaded.
-GRAPHITE_LOOP_OPT=yes
 
-if [ ! -e gcc/BASE-VER ] ; then
-	echo "You must run this script in the top level GCC source directory."
-	exit 1
-fi
+program='download_prerequisites'
+version='(unversioned)'
 
-# Necessary to build GCC.
-MPFR=mpfr-3.1.4
-GMP=gmp-6.1.0
-MPC=mpc-1.0.3
+graphite=1
+verify=1
+force=0
+chksum='sha512'
+directory='.'
 
-wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$MPFR.tar.bz2 || exit 1
-tar xjf $MPFR.tar.bz2 || exit 1
-if test -L mpfr; then rm -f mpfr; fi
-ln -sf $MPFR mpfr || exit 1
+gmp='gmp-6.1.0.tar.bz2'
+mpfr='mpfr-3.1.4.tar.bz2'
+mpc='mpc-1.0.3.tar.gz'
+isl='isl-0.16.1.tar.bz2'
 
-wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$GMP.tar.bz2 || exit 1
-tar xjf $GMP.tar.bz2  || exit 1
-if test -L gmp; then rm -f gmp; fi
-ln -sf $GMP gmp || exit 1
+base_url='ftp://gcc.gnu.org/pub/gcc/infrastructure/'
 
-wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$MPC.tar.gz || exit 1
-tar xzf $MPC.tar.gz || exit 1
-if test -L mpc; then rm -f mpc; fi
-ln -sf $MPC mpc || exit 1
+echo_archives() {
+    echo "${gmp}"
+    echo "${mpfr}"
+    echo "${mpc}"
+    if [ ${graphite} -gt 0 ]; then echo "${isl}"; fi
+}
 
-# Necessary to build GCC with the Graphite loop optimizations.
-if [ "$GRAPHITE_LOOP_OPT" = "yes" ] ; then
-  ISL=isl-0.16.1
+helptext="usage: ${program} [OPTION...]
 
-  wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$ISL.tar.bz2 || exit 1
-  tar xjf $ISL.tar.bz2  || exit 1
-  if test -L isl; then rm -f isl; fi
-  ln -sf $ISL isl || exit 1
+Downloads some prerequisites needed by GCC.  Run this from the top level of the
+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 '.'
+ --force          download again overwriting existing packages
+ --no-force       do not download existing packages again (default)
+ --isl            download ISL, needed for Graphite loop optimizations (default)
+ --graphite       same as --isl
+ --no-isl         don't download ISL
+ --no-graphite    same as --no-isl
+ --verify         verify package integrity after download (default)
+ --no-verify      don't verify package integrity
+ --sha512         use SHA512 checksum to verify package integrity (default)
+ --md5            use MD5 checksum to verify package integrity
+ --help           show this text and exit
+ --version        show version information and exit
+"
+
+versiontext="${program} ${version}
+Copyright (C) 2016 Free Software Foundation, Inc.
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+die() {
+    echo "error: $@" >&2
+    exit 1
+}
+
+for arg in "$@"
+do
+    case "${arg}" in
+        --help)
+            echo "${helptext}"
+            exit
+            ;;
+        --version)
+            echo "${versiontext}"
+            exit
+            ;;
+    esac
+done
+unset arg
+
+argnext=
+for arg in "$@"
+do
+    if [ "x${argnext}" = x ]
+    then
+        case "${arg}" in
+            --directory)
+                argnext='directory'
+                ;;
+            --directory=*)
+                directory="${arg#--directory=}"
+                ;;
+            --force)
+                force=1
+                ;;
+            --no-force)
+                force=0
+                ;;
+            --isl|--graphite)
+                graphite=1
+                ;;
+            --no-isl|--no-graphite)
+                graphite=0
+                ;;
+            --verify)
+                verify=1
+                ;;
+            --no-verify)
+                verify=0
+                ;;
+            --sha512)
+                chksum='sha512'
+                verify=1
+                ;;
+            --md5)
+                chksum='md5'
+                verify=1
+                ;;
+            -*)
+                die "unknown option: ${arg}"
+                ;;
+            *)
+                die "too many arguments"
+                ;;
+        esac
+    else
+        case "${arg}" in
+            -*)
+                die "Missing argument for option --${argnext}"
+                ;;
+        esac
+        case "${argnext}" in
+            directory)
+                directory="${arg}"
+                ;;
+            *)
+                die "The impossible has happened"
+                ;;
+        esac
+        argnext=
+    fi
+done
+[ "x${argnext}" = x ] || die "Missing argument for option --${argnext}"
+unset arg argnext
+
+[ -e ./gcc/BASE-VER ]                                                         \
+    || die "You must run this script in the top-level GCC source directory"
+
+[ -d "${directory}" ]                                                         \
+    || die "No such directory: ${directory}"
+
+for ar in $(echo_archives)
+do
+    if [ ${force} -gt 0 ]; then rm -f "${directory}/${ar}"; fi
+    [ -e "${directory}/${ar}" ]                                               \
+        || wget --no-verbose -O "${directory}/${ar}" "${base_url}${ar}"       \
+        || die "Cannot download ${ar} from ${base_url}"
+done
+unset ar
+
+if [ ${verify} -gt 0 ]
+then
+    chksumfile="contrib/prerequisites.${chksum}"
+    [ -r "${chksumfile}" ] || die "No checksums available"
+    for ar in $(echo_archives)
+    do
+        grep "${ar}" "${chksumfile}"                                          \
+            | ( cd "${directory}" && "${chksum}sum" --check )                 \
+            || die "Cannot verify integrity of possibly corrupted file ${ar}"
+    done
+    unset chksumfile
 fi
+unset ar
+
+for ar in $(echo_archives)
+do
+    package="${ar%.tar*}"
+    if [ ${force} -gt 0 ]; then rm -rf "${directory}/${package}"; fi
+    [ -e "${directory}/${package}" ]                                          \
+        || ( cd "${directory}" && tar -xf "${ar}" )                           \
+        || die "Cannot extract package from ${ar}"
+    unset package
+done
+unset ar
+
+for ar in $(echo_archives)
+do
+    target="${directory}/${ar%.tar*}/"
+    linkname="${ar%-*}"
+    if [ ${force} -gt 0 ]; then rm -f "${linkname}"; fi
+    [ -e "${linkname}" ]                                                      \
+        || ln -s "${target}" "${linkname}"                                    \
+        || die "Cannot create symbolic link ${linkname} --> ${target}"
+    unset target linkname
+done
+unset ar
+
+echo "All prerequisites downloaded successfully."
Index: contrib/prerequisites.md5
===================================================================
--- contrib/prerequisites.md5	(nonexistent)
+++ contrib/prerequisites.md5	(working copy)
@@ -0,0 +1,39 @@
+dd6d26b592ed806a2f1b5b3deb28aeec  brik2.tar.gz
+0ebb1a56b1af0e21d9de30b644c1c059  cctools-576.dmg
+3b9a5dd3db6b4a7e9c8de02198faea25  cctools-576.tar.bz2
+0043796eff1b3187f5e7b4db6e3fc5e5  cctools-590.12.dmg
+410dd3c1471d31e24a193c674432a7f5  cctools-590.12.tar.bz2
+36232fb9525ef5101ed9089db7083d4d  cctools-590.36.dmg
+e90cf2e459c431b65a8989f79e4d625c  cctools-590.36.tar.bz2
+947123350d1ff6dcb4b0774947ac015a  cloog-0.16.1.tar.gz
+83877caaa879c7160063138bb18348e7  cloog-0.16.2.tar.gz
+be78a47bd82523250eb3e91646db5b3d  cloog-0.18.0.tar.gz
+e34fca0540d840e5d0f6427e98c92252  cloog-0.18.1.tar.gz
+f483539b30a60a3478eea70c77b26bef  cloog-parma-0.16.1.tar.gz
+060ae4df6fb8176e021b4d033a6c0b9e  cloog-ppl-0.15.11.tar.gz
+294f381eaa5ce6f96bf5c50094cb5f19  gccrepo.tar.rz
+dd60683d7057917e34630b4a787932e8  gmp-4.3.2.tar.bz2
+86ee6e54ebfc4a90b643a65e402c4048  gmp-6.1.0.tar.bz2
+3206f67d214bef0e1de1068a87c22455  gperf-2.7-19981006.pat
+bce1586384d8635a76d2f017fb067cd2  isl-0.11.1.tar.bz2
+e039bfcfb6c2ab039b8ee69bf883e824  isl-0.12.2.tar.bz2
+acd347243fca5609e3df37dba47fd0bb  isl-0.14.tar.bz2
+8428efbbc6f6e2810ce5c1ba73ecf98c  isl-0.15.tar.bz2
+ac1f25a0677912952718a51f5bc20f32  isl-0.16.1.tar.bz2
+906124171f15ee1585d840ed7d174009  libg++-2.8.1.3-20000312.diff.gz
+47b93312badd9550ccb7d113bbf0242a  libg++-2.8.1.3-20000419.diff.gz
+9e00e62b8fb7af3e41364b7c6d9f4cf8  libg++-2.8.1.3-20000816.diff.gz
+625dd5a953661b901c876f92c2c5e7a6  libg++-2.8.1.3-20000914.diff.gz
+2826dbbd081646c459b1774145ffd7bf  libg++-2.8.1.3.tar.gz
+5b34aa804d514cc295414a963aedb6bf  mpc-0.8.1.tar.gz
+d6a1d5f8ddea3abd2cc3e98f58352d26  mpc-1.0.3.tar.gz
+89e59fe665e2b3ad44a6789f40b059a0  mpfr-2.4.2.tar.bz2
+b8a2f6b0e68bef46e53da2ac439e1cf4  mpfr-3.1.4.tar.bz2
+918d22e272274f96f3c26ea5b51723e9  pooma-2.3.0-gcc.tar.gz
+918d22e272274f96f3c26ea5b51723e9  pooma-gcc.tar.gz
+e7dd265afdeaea81f7e87a72b182d875  ppl-0.10.2.tar.gz
+ba527ec0ffc830ce16fad8a4195a337e  ppl-0.11.tar.gz
+1e30484839440c95c98b8372cf2d2c49  sha512.sum
+58572309d5916942643b20ed385317ce  svk-all-entire-history.tar.rz
+ea45e1dc06856e709ada659888a78411  svk-trunk-3.4-onward.tar.rz
+642d834f4f8655d080e0be610af68e2e  svk-trunk-entire-history.tar.rz
Index: contrib/prerequisites.sha512
===================================================================
--- contrib/prerequisites.sha512	(nonexistent)
+++ contrib/prerequisites.sha512	(working copy)
@@ -0,0 +1,38 @@
+9b01839bbdf185e9a236ca87efc60f23b7fff7e59264c9ef05c93d19aed72295829b9c3458b19f3c01ca0c038947ad63ab2fc64e0179846db9a5a5e137c94524  brik2.tar.gz
+378e5718efb0edaf9d33dbf6f07f1c1931bb60b210539fe3cc9053b06ba66e88ca1dc1880958ba1d51a1fe365afeb9ac3eec903f4cf14b38bfc274be6cca8d35  cctools-576.dmg
+820b4628563cdac9cb87d4014330dfa5c2f94fb60c57f075602dc1153ed3fc910e2eea54d5ea4a1c63c33149e8e6ff8d6320ac9a3e8bc1e011caa09fb45e6896  cctools-576.tar.bz2
+82844046c0babc67364849214fc90284935953dbf7040d7c5301df3070a8d66aa04338f03865a4dc0936bb420732f125fba0aff1d5bca0da9e8a7d1b2c1174b7  cctools-590.12.dmg
+4cd431d11b234a9856cd3e357b4b701ca1f726b097597452004aa4845c83026de5a6d1a2ccca4c6482d5df9cd76d395b9f1f9d8597f31998a424cbec43d028dd  cctools-590.12.tar.bz2
+44e50658350e59b8d9a8ae786d357e4aaa7d35460d5aed76048a616d8ba020011705436f6468908737779a0f00496681a0d13e3f52a8dd0a42c24e9897ddfbef  cctools-590.36.dmg
+0603ea4f6db75af6a59e02fa3b9f325c3f21eaeef44acc618a2ac51bb51f4fa7c1d238aa6ef8bfa1a7886378124aa8d52141f209d4388b17f36c85df261ad581  cctools-590.36.tar.bz2
+3741f6085df362482ef7062d8cf3bfff54ca72890e837c3f13d10a8e159efe2b1d6e224d65911a0ba8bac57cc9b23d2cf192f416cbc9937f699d711febb8a111  cloog-0.16.1.tar.gz
+acf6123cc194d4556bb92471a73ecb52dc6ed54d09cf1e22fee28f6658a07d8a85eb27106a4f15835865e108bfc4e1a9f6340c9bb578719055a295e2d7a36075  cloog-0.16.2.tar.gz
+34404984c4269dfc19673712271b08f220b6b49e451e7479cefbc5d2f27ab8e780f5d51fbbc7cecb974dab655673d8348f2a1ece3a60feaeeb9413fccf16eb1d  cloog-0.18.0.tar.gz
+0b12d9f3c39a2425e28e1d7c0a2b3787287fe3e6e3052f094d2ab6cffeb205ce19044100cbfd805659b3e6b3d21ac2f5a3c92848f476de54edfe6b1cbd2172e9  cloog-0.18.1.tar.gz
+bcf0ed5cd4349ab183feb51f657915cbffb0e0da050a174a0d8ef8336aa87b0f1923fecfebcc43bb4163a48a54e5997e4e6c80d7e1a5983674c91f3d36462f04  cloog-parma-0.16.1.tar.gz
+71a7c42c1b0c410c52c0d7d2a7d458bdae655b816bc89d010ef471c0abcf0ccfee8cabce4a93ff066a17f756c20d5440383302c95558c9456d5db6c421840b36  cloog-ppl-0.15.11.tar.gz
+e0ca3c60481d0f2f1db68baa8b5dfbda17adabb723fea4a21279fa833a5ab9fa215e72170a14ceead9ac837945013ba20c7bbe0c13b8b49f090c1fb1ec4a9220  gccrepo.tar.rz
+2e0b0fd23e6f10742a5517981e5171c6e88b0a93c83da701b296f5c0861d72c19782daab589a7eac3f9032152a0fc7eff7f5362db8fccc4859564a9aa82329cf  gmp-4.3.2.tar.bz2
+3c82aeab9c1596d4da8afac2eec38e429e84f3211e1a572cf8fd2b546493c44c039b922a1133eaaa48bd7f3e11dbe795a384e21ed95cbe3ecc58d7ac02246117  gmp-6.1.0.tar.bz2
+af3c51991692d0467b1520f6f39745cffc45699b5133709dbb8700b044517b29c71453b7e728f50a591c486f7103095450bbfc0ba247a40efbd2fd5dae680d18  gperf-2.7-19981006.pat
+f021ef6982b30a4834bc459af3520bd74b9c6af3e479b344c2d0e1bb4550b85cd30612e342ac761d85f1d2e2160ab3183e1252696726f438e61fb070a7a7bd22  isl-0.11.1.tar.bz2
+b5dea4d6b504fac22f2d8cd9c47d6896994d3966635a514d45010243db44cfbc009574b808f3587f35d91de629110bc11b52941d4075e21f8646c59656e62aea  isl-0.12.2.tar.bz2
+117c0c6f31d91a9284a8f54a748df6494ca2ac21507a45611e911403e9610579b9323ce624aea1de0b8089b3194e59d4364f01bdb71ddcf8f6c24c749d11c4b7  isl-0.14.tar.bz2
+1e27b7798f7428abcb5e9b2e3fbe3842fede54c03bbd7bd3cf83703e1e4cca7d95c51326ab90253fe55b38c002183e8e78dfbb4d2cf20b0aabe02443c8e7d50f  isl-0.15.tar.bz2
+c188667a84dc5bdddb4ab7c35f89c91bf15a8171f4fcaf41301cf285fb7328846d9a367c096012fec4cc69d244f0bc9e95d84c09ec097394cd4093076f2a041b  isl-0.16.1.tar.bz2
+abb57356eee18eca395aa4b2ceee20360983f666458e1064f142bda4710ae02d41a47ad2c3fca6b2f3a20d40296277d31e76d2845817df4652c70da4fa3960f8  libg++-2.8.1.3-20000312.diff.gz
+7d8c160d93ad977528bbdbf8a313b4c2299b4ae24c662c491c421852604b2270cade04d34acc199b609a670ebd7a25ab1fb6636afe06f02cdd62c25484d25762  libg++-2.8.1.3-20000419.diff.gz
+6f2f4c2c94dc9b682b8cbe6601698b88c5d69fcb75bba9d0a056ec0a5939851f96e5a73aa8af6e4e32828191ea057b669475e0cf301f5dd15bdcc5acca5541dc  libg++-2.8.1.3-20000816.diff.gz
+d828131e3391ef44854073edc4ebdcf59bd2e7d28229759f61d52b77c24494bc463a0646094d2fdf1d70fd2af2d4c536965ddadf625dfc916d14daa0fea4a282  libg++-2.8.1.3-20000914.diff.gz
+dc8289b700630407d932fc28d182b14716c52df7dcdc52cd5d44bd05a9b7406f0ab639821d191f8a8544fb3ee57ae58457909a875df495dd8794268fde0afc87  libg++-2.8.1.3.tar.gz
+8cbf00a3f046a7f0ee5bb7cb3f0582b6a0221b5f34ae282752d48689bf509858a9abd613ce2b2f349606742321784ad547ae67ac7af6bf0e421c3f4d491932bf  md5.sum
+14cb9ae3d33caed24d5ae648eed28b2e00ad047a8baeff25981129af88245b4def2948573d7a00d65c5bd34e53524aa6a7351b76703c9f888b41830c1a1daae2  mpc-0.8.1.tar.gz
+0028b76df130720c1fad7de937a0d041224806ce5ef76589f19c7b49d956071a683e2f20d154c192a231e69756b19e48208f2889b0c13950ceb7b3cfaf059a43  mpc-1.0.3.tar.gz
+c004b3dbf86c04960e4a1f8db37a409a7cc4cb76135e76e98dcc5ad93aaa8deb62334ee13ff84447a7c12a5e8cb57f25c62ac908c24920f1fb1a38d79d4a4c5e  mpfr-2.4.2.tar.bz2
+51066066ff2c12ed2198605ecf68846b0c96b548adafa5b80e0c786d0df488411a5e8973358fce7192dc977ad4e68414cf14500e3c39746de62465eb145bb819  mpfr-3.1.4.tar.bz2
+a3d2a187a6ed3767cf5998fb4942bde237a0ebadfa75ab9ce8de02f786564b45613fc6954c53f1f3b76b45933cda3c763b53819b9f8d5046662ef4d9475f68ae  pooma-2.3.0-gcc.tar.gz
+df0eed010aa79ed984db158a4aeda39936b1efcba84cc497197f37b48cfb416d77690e4ecfaf74de91eb39745c2b5b9a74cd4509ef0972104065b5f2c5fdd013  ppl-0.10.2.tar.gz
+dca1d6a26708f08a99ac7a42f73059c171ceb63d3617338dd6608d93aab614838bfdd1b7e39c2df4559d7ed7bb86eb8f020ad59197681757a23a9a1bd8df9ebe  ppl-0.11.tar.gz
+85999ba5bbede5fda08500b0323910d3f759c4a92218af9ca54e70b217b980a2eab6ca96bc49b198187bc8606d4c013ed07990d2638cd62119dd6da6822e6bb6  svk-all-entire-history.tar.rz
+028f9403032c0b4d38c030668302ec5bc14f43ae7bd0ec86ef65cf7a75e9011d21730cd030a69a4ccd5187ce5d0fdd93bd8d0399355e2aefaa69d2f5b9b91c38  svk-trunk-3.4-onward.tar.rz
+03f597cc36ea4823028a0377071e280a1137d8ad198416cc32982a1cd04e255a9e28ca5481202b749438dbb4d22d770282a839f1e8098c32e23a89cde4f9ef01  svk-trunk-entire-history.tar.rz
        * contrib/download_prerequisites: Verify integrity of downloaded
        packages and added more command-line options.

        * contrib/prerequisites.sha512: New.

        * contrib/prerequisites.md5: New.

Reply via email to